public class KnowledgePackageImpl extends Object implements InternalKnowledgePackage, Externalizable
Constructor and Description |
---|
KnowledgePackageImpl() |
KnowledgePackageImpl(String name)
Construct.
|
Modifier and Type | Method and Description |
---|---|
void |
addAccumulateFunction(String name,
org.kie.api.runtime.rule.AccumulateFunction function) |
void |
addCloningResource(String key,
Object resource) |
void |
addEntryPointId(String id) |
void |
addFactTemplate(FactTemplate factTemplate) |
void |
addFunction(Function function) |
void |
addGlobal(String identifier,
Class<?> clazz) |
void |
addImport(ImportDeclaration importDecl) |
void |
addProcess(org.kie.api.definition.process.Process process)
Add a rule flow to this package.
|
void |
addRule(RuleImpl rule)
Add a
Rule to this Package . |
void |
addStaticImport(String functionImport) |
void |
addTypeDeclaration(TypeDeclaration typeDecl) |
void |
addWindowDeclaration(WindowDeclaration window) |
void |
checkValidity()
This will throw an exception if the package is not valid
|
void |
clear() |
KnowledgePackageImpl |
deepCloneIfAlreadyInUse(ClassLoader classLoader) |
boolean |
equals(Object object) |
Map<String,org.kie.api.runtime.rule.AccumulateFunction> |
getAccumulateFunctions() |
ClassFieldAccessorStore |
getClassFieldAccessorStore() |
DialectRuntimeRegistry |
getDialectRuntimeRegistry() |
Set<String> |
getEntryPointIds() |
String |
getErrorSummary()
This will return the error summary (if any) if the package is invalid.
|
FactTemplate |
getFactTemplate(String name) |
org.kie.api.definition.type.FactType |
getFactType(String typeName) |
Collection<org.kie.api.definition.type.FactType> |
getFactTypes() |
Map<String,org.kie.api.definition.type.FactType> |
getFactTypesMap() |
Function |
getFunction(String name) |
Collection<String> |
getFunctionNames() |
Map<String,Function> |
getFunctions() |
Map<String,String> |
getGlobals() |
Collection<org.kie.api.definition.rule.Global> |
getGlobalVariables() |
Map<String,ImportDeclaration> |
getImports() |
String |
getName()
Retrieve the name of this
Package . |
ClassLoader |
getPackageClassLoader() |
Collection<org.kie.api.definition.process.Process> |
getProcesses() |
Collection<org.kie.api.definition.rule.Query> |
getQueries() |
Map<org.kie.api.io.ResourceType,org.kie.api.internal.io.ResourceTypePackage> |
getResourceTypePackages() |
RuleImpl |
getRule(String name)
Retrieve a
Rule by name. |
Map<String,org.kie.api.definition.process.Process> |
getRuleFlows()
Get the rule flows for this package.
|
Collection<org.kie.api.definition.rule.Rule> |
getRules() |
List<RuleImpl> |
getRulesGeneratedFromResource(org.kie.api.io.Resource resource) |
RuleUnitDescriptionLoader |
getRuleUnitDescriptionLoader() |
Set<String> |
getStaticImports() |
TraitRegistry |
getTraitRegistry() |
TypeDeclaration |
getTypeDeclaration(Class<?> clazz) |
TypeDeclaration |
getTypeDeclaration(String type) |
Map<String,TypeDeclaration> |
getTypeDeclarations() |
org.kie.soup.project.datamodel.commons.types.TypeResolver |
getTypeResolver() |
Map<String,WindowDeclaration> |
getWindowDeclarations() |
int |
hashCode() |
boolean |
hasTraitRegistry() |
boolean |
isValid() |
boolean |
needsStreamMode() |
void |
readExternal(ObjectInput stream)
Handles the read serialization of the Package.
|
boolean |
removeFromResourceTypePackageGeneratedFromResource(org.kie.api.io.Resource resource) |
void |
removeFunction(String functionName) |
void |
removeFunctionImport(String functionImport) |
List<Function> |
removeFunctionsGeneratedFromResource(org.kie.api.io.Resource resource) |
void |
removeGlobal(String identifier) |
boolean |
removeObjectsGeneratedFromResource(org.kie.api.io.Resource resource) |
List<org.kie.api.definition.process.Process> |
removeProcessesGeneratedFromResource(org.kie.api.io.Resource resource) |
void |
removeRule(RuleImpl rule) |
void |
removeRuleFlow(String id)
Rule flows can be removed by ID.
|
List<RuleImpl> |
removeRulesGeneratedFromResource(org.kie.api.io.Resource resource) |
void |
removeTypeDeclaration(String type) |
List<TypeDeclaration> |
removeTypesGeneratedFromResource(org.kie.api.io.Resource resource) |
void |
resetErrors()
Once this is called, the package will be marked as invalid
|
void |
setClassFieldAccessorCache(ClassFieldAccessorCache classFieldAccessorCache) |
void |
setDialectRuntimeRegistry(DialectRuntimeRegistry dialectRuntimeRegistry) |
void |
setError(String summary)
Once this is called, the package will be marked as invalid
|
void |
setNeedStreamMode() |
void |
setTypeResolver(org.kie.soup.project.datamodel.commons.types.TypeResolver typeResolver) |
String |
toString() |
void |
writeExternal(ObjectOutput stream)
Handles the write serialization of the Package.
|
public KnowledgePackageImpl()
public KnowledgePackageImpl(String name)
name
- The name of this Package
.public Map<org.kie.api.io.ResourceType,org.kie.api.internal.io.ResourceTypePackage> getResourceTypePackages()
getResourceTypePackages
in interface InternalKnowledgePackage
public Collection<org.kie.api.definition.rule.Rule> getRules()
getRules
in interface org.kie.api.definition.KiePackage
public Collection<org.kie.api.definition.process.Process> getProcesses()
getProcesses
in interface org.kie.api.definition.KiePackage
public Collection<org.kie.api.definition.type.FactType> getFactTypes()
getFactTypes
in interface org.kie.api.definition.KiePackage
public Collection<org.kie.api.definition.rule.Query> getQueries()
getQueries
in interface org.kie.api.definition.KiePackage
public Collection<String> getFunctionNames()
getFunctionNames
in interface org.kie.api.definition.KiePackage
public Collection<org.kie.api.definition.rule.Global> getGlobalVariables()
getGlobalVariables
in interface org.kie.api.definition.KiePackage
public void writeExternal(ObjectOutput stream) throws IOException
writeExternal
in interface Externalizable
stream
- out the stream to write the object to; should be an instance
of DroolsObjectOutputStream or OutputStreamIOException
public void readExternal(ObjectInput stream) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
stream,
- the stream to read data from in order to restore the object;
should be an instance of DroolsObjectInputStream or
InputStreamIOException
ClassNotFoundException
public String getName()
Package
.getName
in interface org.kie.api.definition.KiePackage
Package
.public ClassLoader getPackageClassLoader()
getPackageClassLoader
in interface InternalKnowledgePackage
public DialectRuntimeRegistry getDialectRuntimeRegistry()
getDialectRuntimeRegistry
in interface InternalKnowledgePackage
public void setDialectRuntimeRegistry(DialectRuntimeRegistry dialectRuntimeRegistry)
setDialectRuntimeRegistry
in interface InternalKnowledgePackage
public void addImport(ImportDeclaration importDecl)
addImport
in interface InternalKnowledgePackage
public Map<String,ImportDeclaration> getImports()
getImports
in interface InternalKnowledgePackage
public void addTypeDeclaration(TypeDeclaration typeDecl)
addTypeDeclaration
in interface InternalKnowledgePackage
public void removeTypeDeclaration(String type)
removeTypeDeclaration
in interface InternalKnowledgePackage
public Map<String,TypeDeclaration> getTypeDeclarations()
getTypeDeclarations
in interface InternalKnowledgePackage
public TypeDeclaration getTypeDeclaration(Class<?> clazz)
getTypeDeclaration
in interface InternalKnowledgePackage
public TypeDeclaration getTypeDeclaration(String type)
getTypeDeclaration
in interface InternalKnowledgePackage
public void addStaticImport(String functionImport)
addStaticImport
in interface InternalKnowledgePackage
public void addFunction(Function function)
addFunction
in interface InternalKnowledgePackage
public Map<String,Function> getFunctions()
getFunctions
in interface InternalKnowledgePackage
public void addAccumulateFunction(String name, org.kie.api.runtime.rule.AccumulateFunction function)
addAccumulateFunction
in interface InternalKnowledgePackage
public Map<String,org.kie.api.runtime.rule.AccumulateFunction> getAccumulateFunctions()
getAccumulateFunctions
in interface InternalKnowledgePackage
public void removeFunctionImport(String functionImport)
public Set<String> getStaticImports()
getStaticImports
in interface InternalKnowledgePackage
public void addGlobal(String identifier, Class<?> clazz)
addGlobal
in interface InternalKnowledgePackage
public void removeGlobal(String identifier)
removeGlobal
in interface InternalKnowledgePackage
public Map<String,String> getGlobals()
getGlobals
in interface InternalKnowledgePackage
public void removeFunction(String functionName)
removeFunction
in interface InternalKnowledgePackage
public FactTemplate getFactTemplate(String name)
getFactTemplate
in interface InternalKnowledgePackage
public void addFactTemplate(FactTemplate factTemplate)
addFactTemplate
in interface InternalKnowledgePackage
public void addRule(RuleImpl rule)
Rule
to this Package
.addRule
in interface InternalKnowledgePackage
rule
- The rule to add.DuplicateRuleNameException
- If the Rule
attempting to be added has the
same name as another previously added Rule
.InvalidRuleException
- If the Rule
is not valid.public void addProcess(org.kie.api.definition.process.Process process)
addProcess
in interface InternalKnowledgePackage
public Map<String,org.kie.api.definition.process.Process> getRuleFlows()
getRuleFlows
in interface InternalKnowledgePackage
public void removeRuleFlow(String id)
removeRuleFlow
in interface InternalKnowledgePackage
public void removeRule(RuleImpl rule)
removeRule
in interface InternalKnowledgePackage
public RuleImpl getRule(String name)
Rule
by name.getRule
in interface InternalKnowledgePackage
name
- The name of the Rule
to retrieve.Rule
, or null
if not
such Rule
has been added to this
Package
.public void setError(String summary)
setError
in interface InternalKnowledgePackage
public void resetErrors()
resetErrors
in interface InternalKnowledgePackage
public boolean isValid()
isValid
in interface InternalKnowledgePackage
public void checkValidity()
checkValidity
in interface InternalKnowledgePackage
public String getErrorSummary()
public void clear()
clear
in interface InternalKnowledgePackage
public org.kie.api.definition.type.FactType getFactType(String typeName)
getFactType
in interface InternalKnowledgePackage
public ClassFieldAccessorStore getClassFieldAccessorStore()
getClassFieldAccessorStore
in interface InternalKnowledgePackage
public void setClassFieldAccessorCache(ClassFieldAccessorCache classFieldAccessorCache)
setClassFieldAccessorCache
in interface InternalKnowledgePackage
public Set<String> getEntryPointIds()
getEntryPointIds
in interface InternalKnowledgePackage
public void addEntryPointId(String id)
addEntryPointId
in interface InternalKnowledgePackage
public org.kie.soup.project.datamodel.commons.types.TypeResolver getTypeResolver()
getTypeResolver
in interface InternalKnowledgePackage
public void setTypeResolver(org.kie.soup.project.datamodel.commons.types.TypeResolver typeResolver)
setTypeResolver
in interface InternalKnowledgePackage
public RuleUnitDescriptionLoader getRuleUnitDescriptionLoader()
getRuleUnitDescriptionLoader
in interface InternalKnowledgePackage
public void addWindowDeclaration(WindowDeclaration window)
addWindowDeclaration
in interface InternalKnowledgePackage
public Map<String,WindowDeclaration> getWindowDeclarations()
getWindowDeclarations
in interface InternalKnowledgePackage
public boolean hasTraitRegistry()
hasTraitRegistry
in interface InternalKnowledgePackage
public TraitRegistry getTraitRegistry()
getTraitRegistry
in interface InternalKnowledgePackage
public boolean removeObjectsGeneratedFromResource(org.kie.api.io.Resource resource)
removeObjectsGeneratedFromResource
in interface InternalKnowledgePackage
public boolean removeFromResourceTypePackageGeneratedFromResource(org.kie.api.io.Resource resource)
removeFromResourceTypePackageGeneratedFromResource
in interface InternalKnowledgePackage
public List<TypeDeclaration> removeTypesGeneratedFromResource(org.kie.api.io.Resource resource)
removeTypesGeneratedFromResource
in interface InternalKnowledgePackage
public List<RuleImpl> removeRulesGeneratedFromResource(org.kie.api.io.Resource resource)
removeRulesGeneratedFromResource
in interface InternalKnowledgePackage
public List<RuleImpl> getRulesGeneratedFromResource(org.kie.api.io.Resource resource)
getRulesGeneratedFromResource
in interface InternalKnowledgePackage
public List<Function> removeFunctionsGeneratedFromResource(org.kie.api.io.Resource resource)
removeFunctionsGeneratedFromResource
in interface InternalKnowledgePackage
public List<org.kie.api.definition.process.Process> removeProcessesGeneratedFromResource(org.kie.api.io.Resource resource)
removeProcessesGeneratedFromResource
in interface InternalKnowledgePackage
public boolean needsStreamMode()
public void setNeedStreamMode()
setNeedStreamMode
in interface InternalKnowledgePackage
public KnowledgePackageImpl deepCloneIfAlreadyInUse(ClassLoader classLoader)
deepCloneIfAlreadyInUse
in interface InternalKnowledgePackage
public void addCloningResource(String key, Object resource)
addCloningResource
in interface InternalKnowledgePackage
Copyright © 2001–2019 JBoss by Red Hat. All rights reserved.