org.drools.ide.common.client.modeldriven
Class SuggestionCompletionEngine

java.lang.Object
  extended by org.drools.ide.common.client.modeldriven.SuggestionCompletionEngine
All Implemented Interfaces:
Serializable, PortableObject

public class SuggestionCompletionEngine
extends 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.

See Also:
Serialized Form

Field Summary
 DSLSentence[] actionDSLSentences
           
static String ANNOTATION_ROLE
           
static String ANNOTATION_ROLE_EVENT
           
 DSLSentence[] anyScopeDSLItems
           
 DSLSentence[] conditionDSLSentences
          DSL language extensions, if needed, if provided by the package.
 DSLSentence[] keywordDSLItems
           
static String TYPE_BOOLEAN
           
static String TYPE_COLLECTION
          These are the explicit types supported
static String TYPE_COMPARABLE
           
static String TYPE_DATE
           
static String TYPE_FINAL_OBJECT
           
static String TYPE_NUMERIC
           
static String TYPE_OBJECT
           
static String TYPE_STRING
           
static String TYPE_THIS
           
 
Constructor Summary
SuggestionCompletionEngine()
           
 
Method Summary
 void addMethodInfo(String factName, List<MethodInfo> methodInfos)
           
 boolean containsFactType(String modelClassName)
           
 Map<String,List<ModelAnnotation>> getAnnotations()
          Return a Map of FactTypes (key) and a List (value) of their corresponding annotations.
 List<ModelAnnotation> getAnnotationsForFactType(String factType)
          Return a list of annotations for a FactType
static List<Integer> getCEPOperatorParameterSets(String operator)
          Get the parameter sets for the given CEP Operator (simple, or connective) e.g.
static List<String> getCEPWindowOperators()
          Return a list of operators applicable to CEP windows
 String[] getConditionalElements()
           
 String[] getConnectiveOperatorCompletions(String factType, String fieldName)
           
 String[] getDataEnumList(String type)
           
 int getDataEnumListsSize()
           
 DSLSentence[] getDSLActions()
           
 DSLSentence[] getDSLConditions()
           
 DropDownData getEnums(FactPattern pattern, String field)
          This returns a list of enums options (values) that can be used for the given field of the given FactPattern.
 DropDownData getEnums(String type, String field, FieldNature[] currentFieldNatures)
          Similar to the one above - but this one is for RHS.
 DropDownData getEnums(String type, String field, Map<String,String> currentValueMap)
          This returns a list of enums options (values) that can be used for the given field of the given FactPattern.
 String[] getEnumValues(String factType, String field)
          For simple cases - where a list of values are known based on a field.
 String getFactNameFromType(String type)
          Returns fact's name from class type
 String[] getFactTypes()
          Returns all the fact types.
 String getFieldClassName(String propertyName)
           
 String getFieldClassName(String modelClassName, String fieldName)
           
 ModelField.FIELD_CLASS_TYPE getFieldClassType(String modelClassName, String fieldName)
           
 String[] getFieldCompletions(FieldAccessorsAndMutators accessorOrMutator, String factType)
           
 String[] getFieldCompletions(String factType)
           
 String[] getFieldCompletionsForGlobalVariable(String varName)
           
 String getFieldType(String propertyName)
           
 String getFieldType(String modelClassName, String fieldName)
           
 String[] getGlobalCollections()
           
 String getGlobalVariable(String name)
           
 String[] getGlobalVariables()
           
 String getMethodClassType(String factName, String methodFullName)
           
 List<String> getMethodFullNames(String factName)
           
 List<String> getMethodFullNames(String factName, int paramCount)
           
 MethodInfo getMethodinfo(String factName, String methodFullName)
           
 List<MethodInfo> getMethodInfosForGlobalVariable(String varName)
           
 List<String> getMethodNames(String factName)
           
 List<String> getMethodParams(String factName, String methodNameWithParams)
           
 Map<String,ModelField[]> getModelFields()
           
 String[] getModelFields(FieldAccessorsAndMutators accessorOrMutator, String modelClassName)
           
 String[] getModelFields(String modelClassName)
           
 String[] getModifiers(String name)
           
 String[] getOperatorCompletions(String factType, String fieldName)
           
 String getParametricFieldType(String fieldName)
           
 String getParametricFieldType(String factType, String fieldName)
          returns the type of parametric class List a in a class called Toto key = "Toto.a" value = "String"
 boolean hasDataEnumLists()
           
static boolean isCEPOperator(String operator)
          Check whether an operator is a CEP operator
static boolean isCEPWindowOperator(String operator)
          Check whether an operator is a CEP 'window' operator
static boolean isCEPWindowOperatorLength(String operator)
          Check if the operator is 'window over:length'
static boolean isCEPWindowOperatorTime(String operator)
          Check if the operator is 'window over:time'
 boolean isFactTypeAnEvent(String factType)
          Check whether a given FactType has been annotated as an Event
 boolean isFilteringFacts()
           
 boolean isGlobalVariable(String name)
           
 void putAllDataEnumLists(Map<String,String[]> value)
           
 void putDataEnumList(String name, String[] value)
           
 void putParametricFieldType(String fieldName, String type)
           
 void setAccessorsAndMutators(Map<String,FieldAccessorsAndMutators> accessorsAndMutators)
           
 void setAnnotationsForTypes(Map<String,List<ModelAnnotation>> annotationsForTypes)
           
 void setDataEnumLists(Map<String,String[]> data)
           
 void setFactTypeFilter(FactTypeFilter filter)
           
 void setFactTypes(String[] factTypes)
           
 void setFieldsForTypes(Map<String,ModelField[]> fieldsForType)
           
 void setFilteringFacts(boolean filterFacts)
           
 void setGlobalCollections(String[] globalCollections)
           
 void setGlobalVariables(Map<String,String> globalTypes)
           
 void setModelFields(Map<String,ModelField[]> modelFields)
           
 void setModifiers(Map<String,String[]> map)
           
 
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 String TYPE_COLLECTION
These are the explicit types supported

See Also:
Constant Field Values

TYPE_COMPARABLE

public static final String TYPE_COMPARABLE
See Also:
Constant Field Values

TYPE_STRING

public static final String TYPE_STRING
See Also:
Constant Field Values

TYPE_NUMERIC

public static final String TYPE_NUMERIC
See Also:
Constant Field Values

TYPE_BOOLEAN

public static final String TYPE_BOOLEAN
See Also:
Constant Field Values

TYPE_DATE

public static final String TYPE_DATE
See Also:
Constant Field Values

TYPE_OBJECT

public static final String TYPE_OBJECT
See Also:
Constant Field Values

TYPE_FINAL_OBJECT

public static final String TYPE_FINAL_OBJECT
See Also:
Constant Field Values

TYPE_THIS

public static final String TYPE_THIS
See Also:
Constant Field Values

ANNOTATION_ROLE

public static final String ANNOTATION_ROLE
See Also:
Constant Field Values

ANNOTATION_ROLE_EVENT

public static final String ANNOTATION_ROLE_EVENT
See Also:
Constant Field Values

conditionDSLSentences

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


actionDSLSentences

public DSLSentence[] actionDSLSentences

keywordDSLItems

public DSLSentence[] keywordDSLItems

anyScopeDSLItems

public DSLSentence[] anyScopeDSLItems
Constructor Detail

SuggestionCompletionEngine

public SuggestionCompletionEngine()
Method Detail

getConditionalElements

public String[] getConditionalElements()

getDSLConditions

public DSLSentence[] getDSLConditions()

getDSLActions

public DSLSentence[] getDSLActions()

getConnectiveOperatorCompletions

public String[] getConnectiveOperatorCompletions(String factType,
                                                 String fieldName)

getFieldCompletions

public String[] getFieldCompletions(String factType)

getFieldCompletions

public String[] getFieldCompletions(FieldAccessorsAndMutators accessorOrMutator,
                                    String factType)

getOperatorCompletions

public String[] getOperatorCompletions(String factType,
                                       String fieldName)

getFieldCompletionsForGlobalVariable

public String[] getFieldCompletionsForGlobalVariable(String varName)

getMethodInfosForGlobalVariable

public List<MethodInfo> getMethodInfosForGlobalVariable(String varName)

getEnums

public DropDownData getEnums(FactPattern pattern,
                             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 DropDownData getEnums(String type,
                             String field,
                             FieldNature[] currentFieldNatures)
Similar to the one above - but this one is for RHS.


getEnums

public DropDownData getEnums(String type,
                             String field,
                             Map<String,String> currentValueMap)
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.


getEnumValues

public String[] getEnumValues(String factType,
                              String field)
For simple cases - where a list of values are known based on a field.


addMethodInfo

public void addMethodInfo(String factName,
                          List<MethodInfo> methodInfos)

getMethodParams

public List<String> getMethodParams(String factName,
                                    String methodNameWithParams)

getMethodNames

public List<String> getMethodNames(String factName)

getMethodinfo

public MethodInfo getMethodinfo(String factName,
                                String methodFullName)

getMethodClassType

public String getMethodClassType(String factName,
                                 String methodFullName)

getMethodFullNames

public List<String> getMethodFullNames(String factName)

getMethodFullNames

public List<String> getMethodFullNames(String factName,
                                       int paramCount)

getFactNameFromType

public String getFactNameFromType(String type)
Returns fact's name from class type

Parameters:
type -
Returns:

getParametricFieldType

public String getParametricFieldType(String factType,
                                     String fieldName)
returns the type of parametric class List a in a class called Toto key = "Toto.a" value = "String"


getParametricFieldType

public String getParametricFieldType(String fieldName)

putParametricFieldType

public void putParametricFieldType(String fieldName,
                                   String type)

getGlobalVariable

public String getGlobalVariable(String name)

isGlobalVariable

public boolean isGlobalVariable(String name)

setGlobalVariables

public void setGlobalVariables(Map<String,String> globalTypes)

getGlobalVariables

public String[] getGlobalVariables()

setModifiers

public void setModifiers(Map<String,String[]> map)

getModifiers

public String[] getModifiers(String name)

setGlobalCollections

public void setGlobalCollections(String[] globalCollections)

getGlobalCollections

public String[] getGlobalCollections()

getDataEnumList

public String[] getDataEnumList(String type)

setDataEnumLists

public void setDataEnumLists(Map<String,String[]> data)

putDataEnumList

public void putDataEnumList(String name,
                            String[] value)

putAllDataEnumLists

public void putAllDataEnumLists(Map<String,String[]> value)

getDataEnumListsSize

public int getDataEnumListsSize()

hasDataEnumLists

public boolean hasDataEnumLists()

setAnnotationsForTypes

public void setAnnotationsForTypes(Map<String,List<ModelAnnotation>> annotationsForTypes)

setFactTypes

public void setFactTypes(String[] factTypes)

setFactTypeFilter

public void setFactTypeFilter(FactTypeFilter filter)

setFieldsForTypes

public void setFieldsForTypes(Map<String,ModelField[]> fieldsForType)

getFactTypes

public String[] getFactTypes()
Returns all the fact types.

Returns:

getAnnotationsForFactType

public List<ModelAnnotation> getAnnotationsForFactType(String factType)
Return a list of annotations for a FactType

Parameters:
factType -
Returns:

getAnnotations

public Map<String,List<ModelAnnotation>> getAnnotations()
Return a Map of FactTypes (key) and a List (value) of their corresponding annotations.

Returns:

isFactTypeAnEvent

public boolean isFactTypeAnEvent(String factType)
Check whether a given FactType has been annotated as an Event

Parameters:
factType -
Returns:

containsFactType

public boolean containsFactType(String modelClassName)

getModelFields

public String[] getModelFields(FieldAccessorsAndMutators accessorOrMutator,
                               String modelClassName)

getModelFields

public String[] getModelFields(String modelClassName)

getFieldClassName

public String getFieldClassName(String propertyName)
Parameters:
propertyName - of the type class.field
Returns:

getFieldClassName

public String getFieldClassName(String modelClassName,
                                String fieldName)

getFieldClassType

public ModelField.FIELD_CLASS_TYPE getFieldClassType(String modelClassName,
                                                     String fieldName)

getFieldType

public String getFieldType(String propertyName)

getFieldType

public String getFieldType(String modelClassName,
                           String fieldName)

setAccessorsAndMutators

public void setAccessorsAndMutators(Map<String,FieldAccessorsAndMutators> accessorsAndMutators)

setModelFields

public void setModelFields(Map<String,ModelField[]> modelFields)

getModelFields

public Map<String,ModelField[]> getModelFields()

isFilteringFacts

public boolean isFilteringFacts()

setFilteringFacts

public void setFilteringFacts(boolean filterFacts)

isCEPOperator

public static boolean isCEPOperator(String operator)
Check whether an operator is a CEP operator

Parameters:
operator -
Returns:
True if the operator is a CEP operator

getCEPOperatorParameterSets

public static List<Integer> getCEPOperatorParameterSets(String operator)
Get the parameter sets for the given CEP Operator (simple, or connective) e.g. CEP operator "during" requires 0, 1, 2 or 4 parameters so the returned list contains 0, 1, 2 and 4.

Parameters:
operator -
Returns:

getCEPWindowOperators

public static List<String> getCEPWindowOperators()
Return a list of operators applicable to CEP windows

Returns:

isCEPWindowOperator

public static boolean isCEPWindowOperator(String operator)
Check whether an operator is a CEP 'window' operator

Parameters:
operator -
Returns:
True if the operator is a CEP 'window' operator

isCEPWindowOperatorTime

public static boolean isCEPWindowOperatorTime(String operator)
Check if the operator is 'window over:time'

Parameters:
operator -
Returns:
if

isCEPWindowOperatorLength

public static boolean isCEPWindowOperatorLength(String operator)
Check if the operator is 'window over:length'

Parameters:
operator -
Returns:
if


Copyright © 2001-2011 JBoss by Red Hat. All Rights Reserved.