Drools Workbench - Data Model API 6.0.0.CR4

org.drools.workbench.models.datamodel.oracle
Class PackageDataModelOracleImpl

java.lang.Object
  extended by org.drools.workbench.models.datamodel.oracle.ProjectDataModelOracleImpl
      extended by org.drools.workbench.models.datamodel.oracle.PackageDataModelOracleImpl
All Implemented Interfaces:
PackageDataModelOracle, ProjectDataModelOracle

public class PackageDataModelOracleImpl
extends ProjectDataModelOracleImpl
implements PackageDataModelOracle

Default implementation of DataModelOracle


Field Summary
protected  Map<String,String> filteredSuperTypes
           
protected  Map<String,Set<Annotation>> filteredTypeAnnotations
           
protected  Map<String,Map<String,Set<Annotation>>> filteredTypeFieldsAnnotations
           
 
Fields inherited from class org.drools.workbench.models.datamodel.oracle.ProjectDataModelOracleImpl
projectCollectionTypes, projectEventTypes, projectFieldParametersType, projectJavaEnumLists, projectMethodInformation, projectModelFields, projectName, projectSuperTypes, projectTypeAnnotations, projectTypeFieldsAnnotations, projectTypeSources
 
Constructor Summary
PackageDataModelOracleImpl()
           
 
Method Summary
 void addPackageDslActionSentences(List<DSLSentence> dslActionSentences)
           
 void addPackageDslConditionSentences(List<DSLSentence> dslConditionSentences)
           
 void addPackageGlobals(Map<String,String> packageGlobalTypes)
           
 void addPackageGuvnorEnums(Map<String,String[]> dataEnumLists)
           
 void filter()
           
 void filter(Imports imports)
           
 String[] getAllFactTypes()
          Return all fact types available to the project, i.e. everything type defined within the project or externally imported
 String[] getConnectiveOperatorCompletions(String factType, String fieldName)
          Get the Operators applicable for Connective Constraints
 List<DSLSentence> getDSLActions()
           
 List<DSLSentence> getDSLConditions()
           
 DropDownData getEnums(String type, String field)
          Get enums for a Type and Field.
 DropDownData getEnums(String type, String field, Map<String,String> currentValueMap)
          Get enums for a Type and Field where the enum list may depend upon the values of other fields.
 String[] getEnumValues(String factType, String field)
          For simple cases - where a list of values are known based on a field.
 String[] getExternalFactTypes()
          Return all fact types that are external to the package, i.e. they need to be imported to be used
 String getFactNameFromType(String type)
          Returns fact's name from class type
 String[] getFactTypes()
          Returns fact types available for rule authoring, i.e. those within the same package and those that have been imported.
 String getFieldClassName(String modelClassName, String fieldName)
           
 String[] getFieldCompletions(FieldAccessorsAndMutators accessorOrMutator, String factType)
           
 String[] getFieldCompletions(String factType)
           
 String[] getFieldCompletionsForGlobalVariable(String varName)
           
 String getFieldType(String modelClassName, String fieldName)
           
 String[] getGlobalCollections()
           
 String getGlobalVariable(String name)
           
 String[] getGlobalVariables()
           
 MethodInfo getMethodInfo(String factType, String methodFullName)
          Get information on a Method of a Fact Type
 List<MethodInfo> getMethodInfosForGlobalVariable(String varName)
           
 List<String> getMethodNames(String factType)
          Get a list of Methods for a Fact Type
 List<String> getMethodNames(String factType, int paramCount)
          Get a list of Methods for a Fact Type that have at least the specified number of parameters
 List<String> getMethodParams(String factType, String methodNameWithParams)
          Get a list of parameters for a Method of a Fact Type
 Map<String,ModelField[]> getModelFields()
           
 String[] getOperatorCompletions(String factType, String fieldName)
          Get the Operators applicable Base Constraints
 String getParametricFieldType(String factType, String fieldName)
          Get the parametric type of a Field.
 String getSuperType(String factType)
          Get the Super Type for a given FactType
 Set<Annotation> getTypeAnnotations(String factType)
          Get the Annotations for a given FactType
 Map<String,Set<Annotation>> getTypeFieldsAnnotations(String factType)
          Get the Fields Annotations for a given FactType
 TypeSource getTypeSource(String factType)
          Return where a given FactType was defined
 boolean hasEnums(String qualifiedFactField)
           
 boolean hasEnums(String factType, String field)
           
 boolean isDependentEnum(String factType, String parentField, String childField)
          Check whether the childField is related to the parentField through a chain of enumeration dependencies.
 boolean isFactTypeAnEvent(String factType)
          Check whether a given FactType is an Event for CEP purposes
 boolean isFactTypeRecognized(String factType)
          Is the Fact Type known to the DataModelOracle
 boolean isGlobalVariable(String name)
           
 void setPackageName(String packageName)
           
 
Methods inherited from class org.drools.workbench.models.datamodel.oracle.ProjectDataModelOracleImpl
addCollectionTypes, addEnumDefinitions, addEventTypes, addFactsAndFields, addFieldParametersType, addMethodInformation, addPackageNames, addRuleNames, addSuperTypes, addTypeAnnotations, addTypeFieldsAnnotations, addTypeSources, getPackageNames, getProjectCollectionTypes, getProjectEventTypes, getProjectFieldParametersType, getProjectJavaEnumLists, getProjectMethodInformation, getProjectSuperTypes, getProjectTypeSources, getRuleNames, getRuleNamesForPackage, getRuleNamesMap, getTypeAnnotations, getTypeFieldsAnnotations, setProjectName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.drools.workbench.models.commons.shared.oracle.ProjectDataModelOracle
getPackageNames, getRuleNames, getRuleNamesForPackage, getRuleNamesMap
 

Field Detail

filteredSuperTypes

protected Map<String,String> filteredSuperTypes

filteredTypeAnnotations

protected Map<String,Set<Annotation>> filteredTypeAnnotations

filteredTypeFieldsAnnotations

protected Map<String,Map<String,Set<Annotation>>> filteredTypeFieldsAnnotations
Constructor Detail

PackageDataModelOracleImpl

public PackageDataModelOracleImpl()
Method Detail

getFactTypes

public String[] getFactTypes()
Returns fact types available for rule authoring, i.e. those within the same package and those that have been imported.

Specified by:
getFactTypes in interface ProjectDataModelOracle
Overrides:
getFactTypes in class ProjectDataModelOracleImpl
Returns:

getAllFactTypes

public String[] getAllFactTypes()
Return all fact types available to the project, i.e. everything type defined within the project or externally imported

Specified by:
getAllFactTypes in interface PackageDataModelOracle
Returns:

getExternalFactTypes

public String[] getExternalFactTypes()
Return all fact types that are external to the package, i.e. they need to be imported to be used

Specified by:
getExternalFactTypes in interface PackageDataModelOracle
Returns:

getFactNameFromType

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

Specified by:
getFactNameFromType in interface ProjectDataModelOracle
Overrides:
getFactNameFromType in class ProjectDataModelOracleImpl
Parameters:
type -
Returns:

isFactTypeRecognized

public boolean isFactTypeRecognized(String factType)
Is the Fact Type known to the DataModelOracle

Specified by:
isFactTypeRecognized in interface ProjectDataModelOracle
Overrides:
isFactTypeRecognized in class ProjectDataModelOracleImpl
Parameters:
factType -
Returns:

isFactTypeAnEvent

public boolean isFactTypeAnEvent(String factType)
Check whether a given FactType is an Event for CEP purposes

Specified by:
isFactTypeAnEvent in interface ProjectDataModelOracle
Overrides:
isFactTypeAnEvent in class ProjectDataModelOracleImpl
Parameters:
factType -
Returns:

getTypeSource

public TypeSource getTypeSource(String factType)
Return where a given FactType was defined

Specified by:
getTypeSource in interface ProjectDataModelOracle
Overrides:
getTypeSource in class ProjectDataModelOracleImpl
Parameters:
factType -
Returns:

getSuperType

public String getSuperType(String factType)
Get the Super Type for a given FactType

Specified by:
getSuperType in interface ProjectDataModelOracle
Overrides:
getSuperType in class ProjectDataModelOracleImpl
Parameters:
factType -
Returns:
null if no Super Type

getTypeAnnotations

public Set<Annotation> getTypeAnnotations(String factType)
Get the Annotations for a given FactType

Specified by:
getTypeAnnotations in interface ProjectDataModelOracle
Overrides:
getTypeAnnotations in class ProjectDataModelOracleImpl
Parameters:
factType -
Returns:
Empty set if no annotations exist for the type

getTypeFieldsAnnotations

public Map<String,Set<Annotation>> getTypeFieldsAnnotations(String factType)
Get the Fields Annotations for a given FactType

Specified by:
getTypeFieldsAnnotations in interface ProjectDataModelOracle
Overrides:
getTypeFieldsAnnotations in class ProjectDataModelOracleImpl
Parameters:
factType -
Returns:
Empty Map if no annotations exist for the type

getFieldCompletions

public String[] getFieldCompletions(String factType)
Specified by:
getFieldCompletions in interface ProjectDataModelOracle
Overrides:
getFieldCompletions in class ProjectDataModelOracleImpl

getFieldCompletions

public String[] getFieldCompletions(FieldAccessorsAndMutators accessorOrMutator,
                                    String factType)
Specified by:
getFieldCompletions in interface ProjectDataModelOracle
Overrides:
getFieldCompletions in class ProjectDataModelOracleImpl

getFieldClassName

public String getFieldClassName(String modelClassName,
                                String fieldName)
Specified by:
getFieldClassName in interface ProjectDataModelOracle
Overrides:
getFieldClassName in class ProjectDataModelOracleImpl

getFieldType

public String getFieldType(String modelClassName,
                           String fieldName)
Specified by:
getFieldType in interface ProjectDataModelOracle
Overrides:
getFieldType in class ProjectDataModelOracleImpl

getModelFields

public Map<String,ModelField[]> getModelFields()
Specified by:
getModelFields in interface ProjectDataModelOracle
Overrides:
getModelFields in class ProjectDataModelOracleImpl

getOperatorCompletions

public String[] getOperatorCompletions(String factType,
                                       String fieldName)
Get the Operators applicable Base Constraints

Specified by:
getOperatorCompletions in interface ProjectDataModelOracle
Overrides:
getOperatorCompletions in class ProjectDataModelOracleImpl
Parameters:
factType -
fieldName -
Returns:

getConnectiveOperatorCompletions

public String[] getConnectiveOperatorCompletions(String factType,
                                                 String fieldName)
Get the Operators applicable for Connective Constraints

Specified by:
getConnectiveOperatorCompletions in interface ProjectDataModelOracle
Overrides:
getConnectiveOperatorCompletions in class ProjectDataModelOracleImpl
Parameters:
factType -
fieldName -
Returns:

getFieldCompletionsForGlobalVariable

public String[] getFieldCompletionsForGlobalVariable(String varName)
Specified by:
getFieldCompletionsForGlobalVariable in interface PackageDataModelOracle

getMethodInfosForGlobalVariable

public List<MethodInfo> getMethodInfosForGlobalVariable(String varName)
Specified by:
getMethodInfosForGlobalVariable in interface PackageDataModelOracle

getGlobalVariable

public String getGlobalVariable(String name)
Specified by:
getGlobalVariable in interface PackageDataModelOracle

isGlobalVariable

public boolean isGlobalVariable(String name)
Specified by:
isGlobalVariable in interface PackageDataModelOracle

getGlobalVariables

public String[] getGlobalVariables()
Specified by:
getGlobalVariables in interface PackageDataModelOracle

getGlobalCollections

public String[] getGlobalCollections()
Specified by:
getGlobalCollections in interface PackageDataModelOracle

getDSLConditions

public List<DSLSentence> getDSLConditions()
Specified by:
getDSLConditions in interface PackageDataModelOracle

getDSLActions

public List<DSLSentence> getDSLActions()
Specified by:
getDSLActions in interface PackageDataModelOracle

getEnums

public DropDownData getEnums(String type,
                             String field)
Get enums for a Type and Field.

Specified by:
getEnums in interface ProjectDataModelOracle
Overrides:
getEnums in class ProjectDataModelOracleImpl

getEnums

public DropDownData getEnums(String type,
                             String field,
                             Map<String,String> currentValueMap)
Get enums for a Type and Field where the enum list may depend upon the values of other fields.

Specified by:
getEnums in interface ProjectDataModelOracle
Overrides:
getEnums in class ProjectDataModelOracleImpl

getEnumValues

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

Specified by:
getEnumValues in interface ProjectDataModelOracle
Overrides:
getEnumValues in class ProjectDataModelOracleImpl

hasEnums

public boolean hasEnums(String factType,
                        String field)
Specified by:
hasEnums in interface ProjectDataModelOracle
Overrides:
hasEnums in class ProjectDataModelOracleImpl

hasEnums

public boolean hasEnums(String qualifiedFactField)
Specified by:
hasEnums in interface ProjectDataModelOracle
Overrides:
hasEnums in class ProjectDataModelOracleImpl

isDependentEnum

public boolean isDependentEnum(String factType,
                               String parentField,
                               String childField)
Check whether the childField is related to the parentField through a chain of enumeration dependencies. Both fields belong to the same Fact Type. Furthermore code consuming this function should ensure both parentField and childField relate to the same Fact Pattern

Specified by:
isDependentEnum in interface ProjectDataModelOracle
Overrides:
isDependentEnum in class ProjectDataModelOracleImpl
Parameters:
factType -
parentField -
childField -
Returns:

getMethodNames

public List<String> getMethodNames(String factType)
Get a list of Methods for a Fact Type

Specified by:
getMethodNames in interface ProjectDataModelOracle
Overrides:
getMethodNames in class ProjectDataModelOracleImpl
Parameters:
factType -
Returns:

getMethodNames

public List<String> getMethodNames(String factType,
                                   int paramCount)
Get a list of Methods for a Fact Type that have at least the specified number of parameters

Specified by:
getMethodNames in interface ProjectDataModelOracle
Overrides:
getMethodNames in class ProjectDataModelOracleImpl
Parameters:
factType -
paramCount -
Returns:

getMethodParams

public List<String> getMethodParams(String factType,
                                    String methodNameWithParams)
Get a list of parameters for a Method of a Fact Type

Specified by:
getMethodParams in interface ProjectDataModelOracle
Overrides:
getMethodParams in class ProjectDataModelOracleImpl
Parameters:
factType -
methodNameWithParams -
Returns:

getMethodInfo

public MethodInfo getMethodInfo(String factType,
                                String methodFullName)
Get information on a Method of a Fact Type

Specified by:
getMethodInfo in interface ProjectDataModelOracle
Overrides:
getMethodInfo in class ProjectDataModelOracleImpl
Parameters:
factType -
methodFullName -
Returns:

getParametricFieldType

public String getParametricFieldType(String factType,
                                     String fieldName)
Get the parametric type of a Field.

Specified by:
getParametricFieldType in interface ProjectDataModelOracle
Overrides:
getParametricFieldType in class ProjectDataModelOracleImpl
Parameters:
factType -
fieldName -
Returns:

filter

public void filter(Imports imports)
Specified by:
filter in interface PackageDataModelOracle

filter

public void filter()
Specified by:
filter in interface PackageDataModelOracle

setPackageName

public void setPackageName(String packageName)

addPackageGuvnorEnums

public void addPackageGuvnorEnums(Map<String,String[]> dataEnumLists)

addPackageDslConditionSentences

public void addPackageDslConditionSentences(List<DSLSentence> dslConditionSentences)

addPackageDslActionSentences

public void addPackageDslActionSentences(List<DSLSentence> dslActionSentences)

addPackageGlobals

public void addPackageGlobals(Map<String,String> packageGlobalTypes)

Drools Workbench - Data Model API 6.0.0.CR4

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