Kie Workbench - Common - UI 6.1.0.CR1

org.kie.workbench.common.widgets.client.datamodel
Class AsyncPackageDataModelOracleImpl

java.lang.Object
  extended by org.kie.workbench.common.widgets.client.datamodel.AsyncPackageDataModelOracleImpl
All Implemented Interfaces:
AsyncPackageDataModelOracle

@Dependent
public class AsyncPackageDataModelOracleImpl
extends Object
implements AsyncPackageDataModelOracle

Default implementation of DataModelOracle


Field Summary
protected  Map<String,List<String>> filteredSuperTypes
           
protected  Map<String,Set<org.drools.workbench.models.datamodel.oracle.Annotation>> filteredTypeAnnotations
           
protected  Map<String,Map<String,Set<org.drools.workbench.models.datamodel.oracle.Annotation>>> filteredTypeFieldsAnnotations
           
protected  Map<String,Boolean> projectCollectionTypes
           
protected  Map<String,Boolean> projectEventTypes
           
protected  Map<String,String> projectFieldParametersType
           
protected  Map<String,String[]> projectJavaEnumLists
           
protected  Map<String,List<org.drools.workbench.models.datamodel.oracle.MethodInfo>> projectMethodInformation
           
protected  Map<String,org.drools.workbench.models.datamodel.oracle.ModelField[]> projectModelFields
           
protected  String projectName
           
protected  Map<String,List<String>> projectSuperTypes
           
protected  Map<String,Set<org.drools.workbench.models.datamodel.oracle.Annotation>> projectTypeAnnotations
           
protected  Map<String,Map<String,Set<org.drools.workbench.models.datamodel.oracle.Annotation>>> projectTypeFieldsAnnotations
           
protected  Map<String,org.drools.workbench.models.datamodel.oracle.TypeSource> projectTypeSources
           
protected  org.jboss.errai.common.client.api.Caller<IncrementalDataModelService> service
           
 
Constructor Summary
AsyncPackageDataModelOracleImpl()
           
 
Method Summary
 void addCollectionTypes(Map<String,Boolean> collectionTypes)
           
 void addDslActionSentences(List<org.drools.workbench.models.datamodel.rule.DSLSentence> dslActionSentences)
           
 void addDslConditionSentences(List<org.drools.workbench.models.datamodel.rule.DSLSentence> dslConditionSentences)
           
 void addEventTypes(Map<String,Boolean> eventTypes)
           
 void addFieldParametersType(Map<String,String> fieldParametersType)
           
 void addGlobals(Map<String,String> packageGlobalTypes)
           
 void addJavaEnumDefinitions(Map<String,String[]> dataEnumLists)
           
 void addMethodInformation(Map<String,List<org.drools.workbench.models.datamodel.oracle.MethodInfo>> methodInformation)
           
 void addModelFields(Map<String,org.drools.workbench.models.datamodel.oracle.ModelField[]> modelFields)
           
 void addPackageNames(List<String> packageNames)
           
 void addSuperTypes(Map<String,List<String>> superTypes)
           
 void addTypeAnnotations(Map<String,Set<org.drools.workbench.models.datamodel.oracle.Annotation>> annotations)
           
 void addTypeFieldsAnnotations(Map<String,Map<String,Set<org.drools.workbench.models.datamodel.oracle.Annotation>>> typeFieldsAnnotations)
           
 void addTypeSources(Map<String,org.drools.workbench.models.datamodel.oracle.TypeSource> typeSources)
           
 void addWorkbenchEnumDefinitions(Map<String,String[]> dataEnumLists)
           
 void filter()
           
 void filter(org.drools.workbench.models.datamodel.imports.Imports imports)
           
 String[] getAllFactTypes()
          Return all fact types available to the project, i.e. everything type defined within the project or externally imported
 void getConnectiveOperatorCompletions(String factType, String fieldName, org.uberfire.client.callbacks.Callback<String[]> callback)
          Get the Operators applicable for Connective Constraints
 List<org.drools.workbench.models.datamodel.rule.DSLSentence> getDSLActions()
           
 List<org.drools.workbench.models.datamodel.rule.DSLSentence> getDSLConditions()
           
 org.drools.workbench.models.datamodel.oracle.DropDownData getEnums(String type, String field)
          Get enums for a Type and Field.
 org.drools.workbench.models.datamodel.oracle.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 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)
           
 void getFieldCompletions(String factType, org.uberfire.client.callbacks.Callback<org.drools.workbench.models.datamodel.oracle.ModelField[]> callback)
           
 void getFieldCompletions(String factType, org.drools.workbench.models.datamodel.oracle.FieldAccessorsAndMutators accessorOrMutator, org.uberfire.client.callbacks.Callback<org.drools.workbench.models.datamodel.oracle.ModelField[]> callback)
           
 void getFieldCompletionsForGlobalVariable(String varName, org.uberfire.client.callbacks.Callback<org.drools.workbench.models.datamodel.oracle.ModelField[]> callback)
           
 String getFieldType(String modelClassName, String fieldName)
           
 String getFQCNByFactName(String factName)
           
 String[] getGlobalCollections()
           
 String getGlobalVariable(String name)
           
 String[] getGlobalVariables()
           
 void getMethodInfo(String factType, String methodNameWithParams, org.uberfire.client.callbacks.Callback<org.drools.workbench.models.datamodel.oracle.MethodInfo> callback)
          Get information on a Method of a Fact Type
 void getMethodInfos(String factType, org.uberfire.client.callbacks.Callback<List<org.drools.workbench.models.datamodel.oracle.MethodInfo>> callback)
          Get a list of MethodInfos for a Fact Type
 void getMethodInfos(String factType, int parameterCount, org.uberfire.client.callbacks.Callback<List<org.drools.workbench.models.datamodel.oracle.MethodInfo>> callback)
          Get a list of MethodInfos for a Fact Type that have at least the specified number of parameters
 void getMethodInfosForGlobalVariable(String varName, org.uberfire.client.callbacks.Callback<List<org.drools.workbench.models.datamodel.oracle.MethodInfo>> callback)
           
 void getMethodParams(String factType, String methodNameWithParams, org.uberfire.client.callbacks.Callback<List<String>> callback)
          Get a list of parameters for a Method of a Fact Type
 void getOperatorCompletions(String factType, String fieldName, org.uberfire.client.callbacks.Callback<String[]> callback)
          Get the Operators applicable Base Constraints
 List<String> getPackageNames()
           
 String getParametricFieldType(String factType, String fieldName)
          Get the parametric type of a Field.
 void getSuperType(String factType, org.uberfire.client.callbacks.Callback<String> callback)
          Get the Super Type for a given FactType
 void getSuperTypes(String factType, org.uberfire.client.callbacks.Callback<List<String>> callback)
           
 void getTypeAnnotations(String factType, org.uberfire.client.callbacks.Callback<Set<org.drools.workbench.models.datamodel.oracle.Annotation>> callback)
          Get the Annotations for a given FactType
 void getTypeFieldsAnnotations(String factType, org.uberfire.client.callbacks.Callback<Map<String,Set<org.drools.workbench.models.datamodel.oracle.Annotation>>> callback)
          Get the Fields Annotations for a given FactType
 void getTypeSource(String factType, org.uberfire.client.callbacks.Callback<org.drools.workbench.models.datamodel.oracle.TypeSource> callback)
          Return where a given FactType was defined
 boolean hasEnums(String qualifiedFactField)
           
 boolean hasEnums(String factType, String field)
           
 void init(org.uberfire.backend.vfs.Path resourcePath)
           
 boolean isDependentEnum(String factType, String parentField, String childField)
          Check whether the childField is related to the parentField through a chain of enumeration dependencies.
 void isFactTypeAnEvent(String factType, org.uberfire.client.callbacks.Callback<Boolean> callback)
          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)
           
 void setProjectName(String projectName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

service

@Inject
protected org.jboss.errai.common.client.api.Caller<IncrementalDataModelService> service

projectName

protected String projectName

projectModelFields

protected Map<String,org.drools.workbench.models.datamodel.oracle.ModelField[]> projectModelFields

projectFieldParametersType

protected Map<String,String> projectFieldParametersType

projectEventTypes

protected Map<String,Boolean> projectEventTypes

projectTypeSources

protected Map<String,org.drools.workbench.models.datamodel.oracle.TypeSource> projectTypeSources

projectSuperTypes

protected Map<String,List<String>> projectSuperTypes

projectTypeAnnotations

protected Map<String,Set<org.drools.workbench.models.datamodel.oracle.Annotation>> projectTypeAnnotations

projectTypeFieldsAnnotations

protected Map<String,Map<String,Set<org.drools.workbench.models.datamodel.oracle.Annotation>>> projectTypeFieldsAnnotations

projectJavaEnumLists

protected Map<String,String[]> projectJavaEnumLists

projectMethodInformation

protected Map<String,List<org.drools.workbench.models.datamodel.oracle.MethodInfo>> projectMethodInformation

projectCollectionTypes

protected Map<String,Boolean> projectCollectionTypes

filteredSuperTypes

protected Map<String,List<String>> filteredSuperTypes

filteredTypeAnnotations

protected Map<String,Set<org.drools.workbench.models.datamodel.oracle.Annotation>> filteredTypeAnnotations

filteredTypeFieldsAnnotations

protected Map<String,Map<String,Set<org.drools.workbench.models.datamodel.oracle.Annotation>>> filteredTypeFieldsAnnotations
Constructor Detail

AsyncPackageDataModelOracleImpl

public AsyncPackageDataModelOracleImpl()
Method Detail

init

public void init(org.uberfire.backend.vfs.Path resourcePath)
Specified by:
init in interface AsyncPackageDataModelOracle

getPackageNames

public List<String> getPackageNames()
Specified by:
getPackageNames in interface AsyncPackageDataModelOracle

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 AsyncPackageDataModelOracle
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 AsyncPackageDataModelOracle
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 AsyncPackageDataModelOracle
Returns:

getFQCNByFactName

public String getFQCNByFactName(String factName)
Specified by:
getFQCNByFactName in interface AsyncPackageDataModelOracle

getFactNameFromType

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

Specified by:
getFactNameFromType in interface AsyncPackageDataModelOracle
Parameters:
type - for example org.test.Person or Person
Returns:
Shorter type name Person, not org.test.Person

isFactTypeRecognized

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

Specified by:
isFactTypeRecognized in interface AsyncPackageDataModelOracle
Parameters:
factType -
Returns:

isFactTypeAnEvent

public void isFactTypeAnEvent(String factType,
                              org.uberfire.client.callbacks.Callback<Boolean> callback)
Check whether a given FactType is an Event for CEP purposes

Specified by:
isFactTypeAnEvent in interface AsyncPackageDataModelOracle
Parameters:
factType -

getTypeSource

public void getTypeSource(String factType,
                          org.uberfire.client.callbacks.Callback<org.drools.workbench.models.datamodel.oracle.TypeSource> callback)
Return where a given FactType was defined

Specified by:
getTypeSource in interface AsyncPackageDataModelOracle
Parameters:
factType -

getSuperType

public void getSuperType(String factType,
                         org.uberfire.client.callbacks.Callback<String> callback)
Get the Super Type for a given FactType

Specified by:
getSuperType in interface AsyncPackageDataModelOracle
Parameters:
factType -

getSuperTypes

public void getSuperTypes(String factType,
                          org.uberfire.client.callbacks.Callback<List<String>> callback)
Specified by:
getSuperTypes in interface AsyncPackageDataModelOracle

getTypeAnnotations

public void getTypeAnnotations(String factType,
                               org.uberfire.client.callbacks.Callback<Set<org.drools.workbench.models.datamodel.oracle.Annotation>> callback)
Get the Annotations for a given FactType

Specified by:
getTypeAnnotations in interface AsyncPackageDataModelOracle
Parameters:
factType -

getTypeFieldsAnnotations

public void getTypeFieldsAnnotations(String factType,
                                     org.uberfire.client.callbacks.Callback<Map<String,Set<org.drools.workbench.models.datamodel.oracle.Annotation>>> callback)
Get the Fields Annotations for a given FactType

Specified by:
getTypeFieldsAnnotations in interface AsyncPackageDataModelOracle
Parameters:
factType -

getFieldCompletions

public void getFieldCompletions(String factType,
                                org.uberfire.client.callbacks.Callback<org.drools.workbench.models.datamodel.oracle.ModelField[]> callback)
Specified by:
getFieldCompletions in interface AsyncPackageDataModelOracle

getFieldCompletions

public void getFieldCompletions(String factType,
                                org.drools.workbench.models.datamodel.oracle.FieldAccessorsAndMutators accessorOrMutator,
                                org.uberfire.client.callbacks.Callback<org.drools.workbench.models.datamodel.oracle.ModelField[]> callback)
Specified by:
getFieldCompletions in interface AsyncPackageDataModelOracle

getFieldType

public String getFieldType(String modelClassName,
                           String fieldName)
Specified by:
getFieldType in interface AsyncPackageDataModelOracle

getFieldClassName

public String getFieldClassName(String modelClassName,
                                String fieldName)
Specified by:
getFieldClassName in interface AsyncPackageDataModelOracle

getParametricFieldType

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

Specified by:
getParametricFieldType in interface AsyncPackageDataModelOracle
Parameters:
factType -
fieldName -
Returns:

getOperatorCompletions

public void getOperatorCompletions(String factType,
                                   String fieldName,
                                   org.uberfire.client.callbacks.Callback<String[]> callback)
Get the Operators applicable Base Constraints

Specified by:
getOperatorCompletions in interface AsyncPackageDataModelOracle
Parameters:
factType -
fieldName -

getConnectiveOperatorCompletions

public void getConnectiveOperatorCompletions(String factType,
                                             String fieldName,
                                             org.uberfire.client.callbacks.Callback<String[]> callback)
Get the Operators applicable for Connective Constraints

Specified by:
getConnectiveOperatorCompletions in interface AsyncPackageDataModelOracle
Parameters:
factType -
fieldName -

getMethodInfos

public void getMethodInfos(String factType,
                           org.uberfire.client.callbacks.Callback<List<org.drools.workbench.models.datamodel.oracle.MethodInfo>> callback)
Get a list of MethodInfos for a Fact Type

Specified by:
getMethodInfos in interface AsyncPackageDataModelOracle
Parameters:
factType -
callback -

getMethodInfos

public void getMethodInfos(String factType,
                           int parameterCount,
                           org.uberfire.client.callbacks.Callback<List<org.drools.workbench.models.datamodel.oracle.MethodInfo>> callback)
Get a list of MethodInfos for a Fact Type that have at least the specified number of parameters

Specified by:
getMethodInfos in interface AsyncPackageDataModelOracle
Parameters:
factType -
parameterCount -
callback -

getMethodParams

public void getMethodParams(String factType,
                            String methodNameWithParams,
                            org.uberfire.client.callbacks.Callback<List<String>> callback)
Get a list of parameters for a Method of a Fact Type

Specified by:
getMethodParams in interface AsyncPackageDataModelOracle
Parameters:
factType -
methodNameWithParams -

getMethodInfo

public void getMethodInfo(String factType,
                          String methodNameWithParams,
                          org.uberfire.client.callbacks.Callback<org.drools.workbench.models.datamodel.oracle.MethodInfo> callback)
Get information on a Method of a Fact Type

Specified by:
getMethodInfo in interface AsyncPackageDataModelOracle
Parameters:
factType -
methodNameWithParams -

getGlobalVariables

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

getGlobalVariable

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

isGlobalVariable

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

getFieldCompletionsForGlobalVariable

public void getFieldCompletionsForGlobalVariable(String varName,
                                                 org.uberfire.client.callbacks.Callback<org.drools.workbench.models.datamodel.oracle.ModelField[]> callback)
Specified by:
getFieldCompletionsForGlobalVariable in interface AsyncPackageDataModelOracle

getMethodInfosForGlobalVariable

public void getMethodInfosForGlobalVariable(String varName,
                                            org.uberfire.client.callbacks.Callback<List<org.drools.workbench.models.datamodel.oracle.MethodInfo>> callback)
Specified by:
getMethodInfosForGlobalVariable in interface AsyncPackageDataModelOracle

getGlobalCollections

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

getDSLConditions

public List<org.drools.workbench.models.datamodel.rule.DSLSentence> getDSLConditions()
Specified by:
getDSLConditions in interface AsyncPackageDataModelOracle

getDSLActions

public List<org.drools.workbench.models.datamodel.rule.DSLSentence> getDSLActions()
Specified by:
getDSLActions in interface AsyncPackageDataModelOracle

getEnums

public org.drools.workbench.models.datamodel.oracle.DropDownData getEnums(String type,
                                                                          String field)
Get enums for a Type and Field.

Specified by:
getEnums in interface AsyncPackageDataModelOracle

getEnums

public org.drools.workbench.models.datamodel.oracle.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 AsyncPackageDataModelOracle

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 AsyncPackageDataModelOracle

hasEnums

public boolean hasEnums(String factType,
                        String field)
Specified by:
hasEnums in interface AsyncPackageDataModelOracle

hasEnums

public boolean hasEnums(String qualifiedFactField)
Specified by:
hasEnums in interface AsyncPackageDataModelOracle

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 AsyncPackageDataModelOracle
Parameters:
factType -
parentField -
childField -
Returns:

filter

public void filter(org.drools.workbench.models.datamodel.imports.Imports imports)
Specified by:
filter in interface AsyncPackageDataModelOracle

filter

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

setProjectName

public void setProjectName(String projectName)
Specified by:
setProjectName in interface AsyncPackageDataModelOracle

setPackageName

public void setPackageName(String packageName)
Specified by:
setPackageName in interface AsyncPackageDataModelOracle

addModelFields

public void addModelFields(Map<String,org.drools.workbench.models.datamodel.oracle.ModelField[]> modelFields)
Specified by:
addModelFields in interface AsyncPackageDataModelOracle

addFieldParametersType

public void addFieldParametersType(Map<String,String> fieldParametersType)
Specified by:
addFieldParametersType in interface AsyncPackageDataModelOracle

addEventTypes

public void addEventTypes(Map<String,Boolean> eventTypes)
Specified by:
addEventTypes in interface AsyncPackageDataModelOracle

addTypeSources

public void addTypeSources(Map<String,org.drools.workbench.models.datamodel.oracle.TypeSource> typeSources)
Specified by:
addTypeSources in interface AsyncPackageDataModelOracle

addSuperTypes

public void addSuperTypes(Map<String,List<String>> superTypes)
Specified by:
addSuperTypes in interface AsyncPackageDataModelOracle

addTypeAnnotations

public void addTypeAnnotations(Map<String,Set<org.drools.workbench.models.datamodel.oracle.Annotation>> annotations)
Specified by:
addTypeAnnotations in interface AsyncPackageDataModelOracle

addTypeFieldsAnnotations

public void addTypeFieldsAnnotations(Map<String,Map<String,Set<org.drools.workbench.models.datamodel.oracle.Annotation>>> typeFieldsAnnotations)
Specified by:
addTypeFieldsAnnotations in interface AsyncPackageDataModelOracle

addJavaEnumDefinitions

public void addJavaEnumDefinitions(Map<String,String[]> dataEnumLists)
Specified by:
addJavaEnumDefinitions in interface AsyncPackageDataModelOracle

addMethodInformation

public void addMethodInformation(Map<String,List<org.drools.workbench.models.datamodel.oracle.MethodInfo>> methodInformation)
Specified by:
addMethodInformation in interface AsyncPackageDataModelOracle

addCollectionTypes

public void addCollectionTypes(Map<String,Boolean> collectionTypes)
Specified by:
addCollectionTypes in interface AsyncPackageDataModelOracle

addPackageNames

public void addPackageNames(List<String> packageNames)
Specified by:
addPackageNames in interface AsyncPackageDataModelOracle

addWorkbenchEnumDefinitions

public void addWorkbenchEnumDefinitions(Map<String,String[]> dataEnumLists)
Specified by:
addWorkbenchEnumDefinitions in interface AsyncPackageDataModelOracle

addDslConditionSentences

public void addDslConditionSentences(List<org.drools.workbench.models.datamodel.rule.DSLSentence> dslConditionSentences)
Specified by:
addDslConditionSentences in interface AsyncPackageDataModelOracle

addDslActionSentences

public void addDslActionSentences(List<org.drools.workbench.models.datamodel.rule.DSLSentence> dslActionSentences)
Specified by:
addDslActionSentences in interface AsyncPackageDataModelOracle

addGlobals

public void addGlobals(Map<String,String> packageGlobalTypes)
Specified by:
addGlobals in interface AsyncPackageDataModelOracle

Kie Workbench - Common - UI 6.1.0.CR1

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