org.drools.brms.client.modeldriven
Class SuggestionCompletionEngine

java.lang.Object
  extended by org.drools.brms.client.modeldriven.SuggestionCompletionEngine
All Implemented Interfaces:
PortableObject

public class SuggestionCompletionEngine
extends java.lang.Object
implements PortableObject

An suggestion completion processor. This should be usable in both GWT/Web and the IDE. The data for this can be loaded into this from simple string lists.

Author:
Michael Neale

Field Summary
 DSLSentence[] actionDSLSentences
           
 DSLSentence[] conditionDSLSentences
          DSL language extensions, if needed, if provided by the package.
 java.util.Map dataEnumLists
          Contains a map of { TypeName.field : String[] } - where a list is valid values to display in a drop down for a given Type.field combination.
 java.lang.String[] factTypes
          A list of fact types (never fully qualified).
 java.util.Map fieldsForType
          A map of types to the fields.
 java.util.Map fieldTypes
          A map of the Fields to their types, needed for operator completions, as well as other things like rendering strings, dates etc.
 java.util.Map globalTypes
          Contains a map of globals (name is key) and their type (value).
static java.lang.String TYPE_BOOLEAN
           
static java.lang.String TYPE_COLLECTION
          These are the explicit types supported
static java.lang.String TYPE_COMPARABLE
           
static java.lang.String TYPE_NUMERIC
           
static java.lang.String TYPE_OBJECT
           
static java.lang.String TYPE_STRING
           
 
Constructor Summary
SuggestionCompletionEngine()
           
 
Method Summary
 java.lang.String[] getConditionalElements()
           
 java.lang.String[] getConnectiveOperatorCompletions(java.lang.String factType, java.lang.String fieldName)
           
 DSLSentence[] getDSLActions()
           
 DSLSentence[] getDSLConditions()
           
 java.lang.String[] getEnums(FactPattern pat, java.lang.String field)
          This returns a list of enums options (values) that can be used for the given field of the given FactPattern.
 java.lang.String[] getEnums(java.lang.String type, ActionFieldValue[] currentValues, java.lang.String field)
           
 java.lang.String[] getFactTypes()
           
 java.lang.String[] getFieldCompletions(java.lang.String factType)
           
 java.lang.String[] getFieldCompletionsForGlobalVariable(java.lang.String varName)
           
 java.lang.String getFieldType(java.lang.String factType, java.lang.String fieldName)
          A map of the Fields to their types, needed for operator completions, as well as other things like rendering strings, dates etc.
 java.lang.String[] getGlobalVariables()
           
 java.lang.String[] getOperatorCompletions(java.lang.String factType, java.lang.String fieldName)
           
 boolean isGlobalVariable(java.lang.String variable)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TYPE_COLLECTION

public static final java.lang.String TYPE_COLLECTION
These are the explicit types supported

See Also:
Constant Field Values

TYPE_COMPARABLE

public static final java.lang.String TYPE_COMPARABLE
See Also:
Constant Field Values

TYPE_STRING

public static final java.lang.String TYPE_STRING
See Also:
Constant Field Values

TYPE_NUMERIC

public static final java.lang.String TYPE_NUMERIC
See Also:
Constant Field Values

TYPE_BOOLEAN

public static final java.lang.String TYPE_BOOLEAN
See Also:
Constant Field Values

TYPE_OBJECT

public static final java.lang.String TYPE_OBJECT
See Also:
Constant Field Values

factTypes

public java.lang.String[] factTypes
A list of fact types (never fully qualified).


fieldsForType

public java.util.Map fieldsForType
A map of types to the fields. key is type, value is (String[] of fields)


fieldTypes

public java.util.Map fieldTypes
A map of the Fields to their types, needed for operator completions, as well as other things like rendering strings, dates etc. This is in the format of: { 'Type.field' => 'typename' }. Should not be the exact type, perhaps just a high level interface, eg "Comparable".


globalTypes

public java.util.Map globalTypes
Contains a map of globals (name is key) and their type (value).


dataEnumLists

public java.util.Map dataEnumLists
Contains a map of { TypeName.field : String[] } - where a list is valid values to display in a drop down for a given Type.field combination.


conditionDSLSentences

public DSLSentence[] conditionDSLSentences
DSL language extensions, if needed, if provided by the package.


actionDSLSentences

public DSLSentence[] actionDSLSentences
Constructor Detail

SuggestionCompletionEngine

public SuggestionCompletionEngine()
Method Detail

getConditionalElements

public java.lang.String[] getConditionalElements()

getDSLConditions

public DSLSentence[] getDSLConditions()

getDSLActions

public DSLSentence[] getDSLActions()

getConnectiveOperatorCompletions

public java.lang.String[] getConnectiveOperatorCompletions(java.lang.String factType,
                                                           java.lang.String fieldName)

getFactTypes

public java.lang.String[] getFactTypes()

getFieldCompletions

public java.lang.String[] getFieldCompletions(java.lang.String factType)

getOperatorCompletions

public java.lang.String[] getOperatorCompletions(java.lang.String factType,
                                                 java.lang.String fieldName)

getFieldType

public java.lang.String getFieldType(java.lang.String factType,
                                     java.lang.String fieldName)
A map of the Fields to their types, needed for operator completions, as well as other things like rendering strings, dates etc. This is in the format of: { 'Type.field' => 'typename' }. Should not be the exact type, perhaps just a high level interface, eg "Comparable", "Numeric", "String".


isGlobalVariable

public boolean isGlobalVariable(java.lang.String variable)

getFieldCompletionsForGlobalVariable

public java.lang.String[] getFieldCompletionsForGlobalVariable(java.lang.String varName)

getGlobalVariables

public java.lang.String[] getGlobalVariables()

getEnums

public java.lang.String[] getEnums(FactPattern pat,
                                   java.lang.String field)
This returns a list of enums options (values) that can be used for the given field of the given FactPattern. This also takes into account enums that depend on other fields.


getEnums

public java.lang.String[] getEnums(java.lang.String type,
                                   ActionFieldValue[] currentValues,
                                   java.lang.String field)