public class RuleImpl extends Object implements Externalizable, Wireable, Dialectable, org.kie.internal.definition.rule.InternalRule, org.kie.api.definition.rule.Query
Modifier and Type | Class and Description |
---|---|
static class |
RuleImpl.SafeEnabled |
static class |
RuleImpl.SafeSalience |
Wireable.Immutable
Modifier and Type | Field and Description |
---|---|
protected String |
activationListener |
static String |
DEFAULT_CONSEQUENCE_NAME |
Constructor and Description |
---|
RuleImpl() |
RuleImpl(String name)
Construct a
Rule |
Modifier and Type | Method and Description |
---|---|
void |
addChild(RuleImpl child) |
void |
addMetaAttribute(String key,
Object value) |
void |
addNamedConsequence(String name,
Consequence consequence) |
void |
addPattern(RuleConditionElement element)
Add a pattern to the rule.
|
void |
addUsedQuery(QueryImpl query) |
protected List<QueryImpl> |
collectDependingQueries(LinkedList<QueryImpl> accumulator) |
boolean |
equals(Object obj) |
String |
getActivationGroup() |
String |
getActivationListener() |
String |
getAgendaGroup() |
boolean |
getAutoFocus() |
String[] |
getCalendars() |
List<RuleImpl> |
getChildren() |
Consequence |
getConsequence()
Retrieve the
Consequence associated with this
Rule . |
ConsequenceMetaData |
getConsequenceMetaData() |
Calendar |
getDateEffective() |
Calendar |
getDateExpires() |
Declaration |
getDeclaration(String identifier)
Retrieve a parameter
Declaration by identifier. |
Map<String,Declaration> |
getDeclarations()
Retrieve the set of all root fact object parameter
Declarations . |
List<QueryImpl> |
getDependingQueries()
Returns the lists of queries from which this rule (or query) depends on ordered
by their relative dependencies, e.g. if R1 -> A -> B -> C (where the letter are queries)
it will return [C, B, A]
|
String |
getDialect() |
Enabled |
getEnabled() |
String |
getFullyQualifiedName() |
String |
getId() |
org.kie.api.definition.KieDefinition.KnowledgeType |
getKnowledgeType() |
GroupElement |
getLhs()
Retrieve the
List of Conditions for this
rule. |
int |
getLoadOrder() |
Map<String,Object> |
getMetaData() |
Object |
getMetaData(String name) |
static String |
getMethodBytecode(Class cls,
String ruleClassName,
String packageName,
String methodName,
String resource) |
String |
getName()
Retrieve the name of this rule.
|
Consequence |
getNamedConsequence(String consequenceName) |
Map<String,Consequence> |
getNamedConsequences() |
String |
getNamespace() |
String |
getPackage() |
String |
getPackageName() |
RuleImpl |
getParent() |
String[] |
getRequiredDeclarationsForConsequence(String consequenceName) |
org.kie.api.io.Resource |
getResource() |
String |
getRuleFlowGroup() |
String |
getRuleUnitClassName() |
Salience |
getSalience()
Retrieve the
Rule salience. |
int |
getSalienceValue()
Retrieve the
Rule salience value. |
Timer |
getTimer()
Returns the Timer semantics for a rule.
|
GroupElement[] |
getTransformedLhs(LogicTransformer transformer,
Map<String,Class<?>> globals)
Uses the LogicTransformer to process the Rule patters - if no ORs are
used this will return an array of a single AND element.
|
boolean |
hasChildren() |
int |
hashCode() |
boolean |
hasLogicalDependency()
This field is updated at runtime, when the first logical assertion is done.
|
boolean |
hasNamedConsequences() |
boolean |
hasRuleUnit() |
boolean |
isAllMatches() |
boolean |
isDataDriven() |
boolean |
isEager() |
boolean |
isEffective(Tuple tuple,
RuleTerminalNode rtn,
WorkingMemory workingMemory)
This returns true is the rule is effective.
|
boolean |
isEnabled(Tuple tuple,
RuleTerminalNode rtn,
WorkingMemory workingMemory) |
boolean |
isLockOnActive() |
boolean |
isMainAgendaGroup() |
boolean |
isNoLoop() |
boolean |
isQuery() |
boolean |
isSalienceDynamic()
Returns
true if the rule uses dynamic salience, false otherwise. |
boolean |
isSemanticallyValid()
This will return if the semantic actions or predicates in the rules
are valid.
|
boolean |
isValid()
Determine if this rule is internally consistent and valid.
|
void |
readExternal(ObjectInput in) |
void |
removeChild(RuleImpl child) |
void |
setActivationGroup(String activationGroup) |
void |
setActivationListener(String activationListener) |
RuleImpl |
setAgendaGroup(String agendaGroup) |
void |
setAllMatches(boolean allMatches) |
void |
setAutoFocus(boolean autoFocus) |
void |
setCalendars(String[] calendars) |
void |
setConsequence(Consequence consequence)
Set the
Consequence that is associated with the successful
match of this rule. |
void |
setDataDriven(boolean dataDriven) |
void |
setDateEffective(Calendar effectiveDate)
Sets the date from which this rule takes effect (can include time to the millisecond).
|
void |
setDateExpires(Calendar expiresDate)
Sets the date after which the rule will no longer apply (can include time to the millisecond).
|
void |
setDialect(String dialect) |
void |
setEager(boolean eager) |
void |
setEnabled(Enabled b)
A rule is enabled by default.
|
void |
setHasLogicalDependency(boolean hasLogicalDependency) |
void |
setLhs(GroupElement lhsRoot) |
void |
setLoadOrder(int loadOrder) |
void |
setLockOnActive(boolean lockOnActive) |
void |
setNoLoop(boolean noLoop) |
RuleImpl |
setPackage(String pkg) |
void |
setParent(RuleImpl parent) |
void |
setRequiredDeclarationsForConsequence(String consequenceName,
String[] requiredDeclarations) |
void |
setResource(org.kie.api.io.Resource resource) |
void |
setRuleFlowGroup(String ruleFlowGroup) |
void |
setRuleUnitClass(Class<? extends org.kie.api.runtime.rule.RuleUnit> ruleUnit) |
void |
setRuleUnitClassName(String ruleUnitClassName) |
void |
setSalience(Salience salience)
Set the
Rule |
void |
setSemanticallyValid(boolean valid) |
void |
setTimer(Timer timer)
Sets the timer semantics for a rule.
|
String |
toRuleNameAndPathString() |
String |
toString() |
void |
wire(Object object) |
void |
writeExternal(ObjectOutput out) |
public static final String DEFAULT_CONSEQUENCE_NAME
protected String activationListener
public RuleImpl()
public RuleImpl(String name)
Rule with the given name for the specified pkg parent
name
- The name of this rule.public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
public void addUsedQuery(QueryImpl query)
public List<QueryImpl> getDependingQueries()
protected List<QueryImpl> collectDependingQueries(LinkedList<QueryImpl> accumulator)
public org.kie.api.io.Resource getResource()
getResource
in interface org.kie.internal.definition.rule.InternalRule
public void setResource(org.kie.api.io.Resource resource)
public String getDialect()
getDialect
in interface Dialectable
getDialect
in interface org.kie.internal.definition.rule.InternalRule
public void setDialect(String dialect)
public Timer getTimer()
public void setTimer(Timer timer)
public boolean isValid()
A Rule
must include at least one parameter declaration and
one condition.
isValid
in interface org.kie.internal.definition.rule.InternalRule
true
if this rule is valid, else
false
.public String getPackage()
public String getPackageName()
getPackageName
in interface org.kie.api.definition.rule.Query
getPackageName
in interface org.kie.api.definition.rule.Rule
public String getName()
getName
in interface org.kie.api.definition.rule.Query
getName
in interface org.kie.api.definition.rule.Rule
public String getFullyQualifiedName()
getFullyQualifiedName
in interface org.kie.internal.definition.rule.InternalRule
public Salience getSalience()
Rule
salience.public int getSalienceValue()
Rule
salience value.getSalienceValue
in interface org.kie.internal.definition.rule.InternalRule
public boolean isSalienceDynamic()
true
if the rule uses dynamic salience, false
otherwise.isSalienceDynamic
in interface org.kie.internal.definition.rule.InternalRule
true
if the rule uses dynamic salience, else false
.public void setSalience(Salience salience)
Rule salience.
salience
- The salience.public String getAgendaGroup()
getAgendaGroup
in interface org.kie.internal.definition.rule.InternalRule
public boolean isMainAgendaGroup()
isMainAgendaGroup
in interface org.kie.internal.definition.rule.InternalRule
public boolean isNoLoop()
isNoLoop
in interface org.kie.internal.definition.rule.InternalRule
public boolean isEffective(Tuple tuple, RuleTerminalNode rtn, WorkingMemory workingMemory)
public void setNoLoop(boolean noLoop)
public boolean getAutoFocus()
getAutoFocus
in interface org.kie.internal.definition.rule.InternalRule
public void setAutoFocus(boolean autoFocus)
public String getActivationGroup()
getActivationGroup
in interface org.kie.internal.definition.rule.InternalRule
public void setActivationGroup(String activationGroup)
public String getRuleFlowGroup()
getRuleFlowGroup
in interface org.kie.internal.definition.rule.InternalRule
public void setRuleFlowGroup(String ruleFlowGroup)
public Declaration getDeclaration(String identifier)
Declaration
by identifier.identifier
- The identifier.null
if no declaration matches
the identifier
.public String[] getRequiredDeclarationsForConsequence(String consequenceName)
public void setRequiredDeclarationsForConsequence(String consequenceName, String[] requiredDeclarations)
public boolean hasLogicalDependency()
public void setHasLogicalDependency(boolean hasLogicalDependency)
public boolean isLockOnActive()
isLockOnActive
in interface org.kie.internal.definition.rule.InternalRule
public void setLockOnActive(boolean lockOnActive)
public Map<String,Declaration> getDeclarations()
Declarations
.Declarations
in order which specify the
root fact objects.public void addPattern(RuleConditionElement element)
element
- The Test
to add.InvalidRuleException
public GroupElement getLhs()
List
of Conditions
for this
rule.List
of Conditions
.public void setLhs(GroupElement lhsRoot)
public GroupElement[] getTransformedLhs(LogicTransformer transformer, Map<String,Class<?>> globals) throws InvalidPatternException
InvalidPatternException
public void setConsequence(Consequence consequence)
Consequence
that is associated with the successful
match of this rule.consequence
- The Consequence
to attach to this
Rule
.public Consequence getConsequence()
Consequence
associated with this
Rule
.Consequence
.public boolean hasNamedConsequences()
public Map<String,Consequence> getNamedConsequences()
public Consequence getNamedConsequence(String consequenceName)
public void addNamedConsequence(String name, Consequence consequence)
public int getLoadOrder()
public void setLoadOrder(int loadOrder)
public boolean isEager()
public void setEager(boolean eager)
public boolean isDataDriven()
public void setDataDriven(boolean dataDriven)
public boolean isAllMatches()
public void setAllMatches(boolean allMatches)
public String toRuleNameAndPathString()
public void setSemanticallyValid(boolean valid)
public boolean isSemanticallyValid()
public String[] getCalendars()
public void setCalendars(String[] calendars)
public void setDateEffective(Calendar effectiveDate)
effectiveDate
- public void setDateExpires(Calendar expiresDate)
expiresDate
- public Calendar getDateEffective()
getDateEffective
in interface org.kie.internal.definition.rule.InternalRule
public Calendar getDateExpires()
getDateExpires
in interface org.kie.internal.definition.rule.InternalRule
public void setEnabled(Enabled b)
public Enabled getEnabled()
public boolean isEnabled(Tuple tuple, RuleTerminalNode rtn, WorkingMemory workingMemory)
public String getActivationListener()
public void setActivationListener(String activationListener)
public Map<String,Object> getMetaData()
getMetaData
in interface org.kie.api.definition.rule.Query
getMetaData
in interface org.kie.api.definition.rule.Rule
public void setParent(RuleImpl parent)
public RuleImpl getParent()
public void addChild(RuleImpl child)
public void removeChild(RuleImpl child)
public boolean hasChildren()
public boolean isQuery()
public org.kie.api.definition.KieDefinition.KnowledgeType getKnowledgeType()
getKnowledgeType
in interface org.kie.api.definition.KieDefinition
public String getNamespace()
getNamespace
in interface org.kie.api.definition.KieDefinition
public String getId()
getId
in interface org.kie.api.definition.KieDefinition
public ConsequenceMetaData getConsequenceMetaData()
public String getRuleUnitClassName()
public void setRuleUnitClass(Class<? extends org.kie.api.runtime.rule.RuleUnit> ruleUnit)
public void setRuleUnitClassName(String ruleUnitClassName)
public boolean hasRuleUnit()
Copyright © 2001–2019 JBoss by Red Hat. All rights reserved.