com.jaxfront.core.rule
Class RuleImpl

java.lang.Object
  extended by com.jaxfront.core.rule.RuleImpl
All Implemented Interfaces:
Rule, java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
SimpleRuleImpl

public class RuleImpl
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable, Rule

The Rule class extends the xml schema definition for more interactive behaviour! This is necessary because of the limitations of the XML Schema Specifiation. The rule class is implementation of the ECA (Event - Condition - Action) paradigma known from active database theory. Rules can only be definied in the xui specification.A rule will allways triggered by an event. Following events are possible: saveDocument -> fired calling serialization() on the Document class initialisation -> fired on initial document load or if a new Element will be added to the Document propertyChange -> fired on valueChanges A rule gets evaluated after the occurance of an event. If all conditions (in this version the relation between conditions are always a boolean AND) are evaluated as true, all defined actions get performed.

Version:
1.60
See Also:
Condition, AbstractAction, Serialized Form

Field Summary
 
Fields inherited from interface com.jaxfront.core.rule.Rule
ABOUT_TO_PERSIST, CHANGE, CHANGE_AND_INITIALIZATION, COPYCONTENT, DOM_DELETED, DOM_INITIALIZED, LIST_ITEM_DESELECTED, LIST_ITEM_SELECTED, NONE, ONCREATE, PASTECONTENT, PERSISTENT, PROPERTYCHANGE, SAVEDOCUMENT, STRUCTURE_CHANGE, STRUCTURE_CHANGE_ADD, STRUCTURE_CHANGE_REMOVE, VISUALIZED
 
Constructor Summary
RuleImpl(long type, Type source)
          A Rule needs sourceType to be checked against with and a type which specifies the event type.
RuleImpl(long type, Type source, java.lang.String scope)
          A Rule needs sourceType to be checked against with and a type which specifies the event type.
RuleImpl(long type, Type source, java.lang.String scope, boolean doesConcernNoneSerializableSource)
          A Rule needs sourceType to be checked against with and a type which specifies the event type.
RuleImpl(long type, Type source, java.lang.String executionMode, java.lang.String scope, boolean doesConcernNoneSerializableSource, boolean doesConcernOnlyVisible)
          A Rule needs sourceType to be checked against with and a type which specifies the event type.
RuleImpl(java.lang.String id, long type, Type source, java.lang.String executionMode, java.lang.String scope, boolean doesConcernNoneSerializableSource, boolean doesConcernOnlyVisible)
           
 
Method Summary
 void apply(Type eventSource, java.lang.Object event)
          Applies ECA behaviour for the given sourceType
 void apply(Type eventSource, java.lang.Object event, boolean isRunningAsServer)
          Applies ECA behaviour for the given sourceType.
 void apply(Type eventSource, java.lang.Object event, boolean isRunningAsServer, java.util.Stack callStack)
           
 java.lang.Object clone(Type newSource)
           
 boolean doesConcern(Type sourceType)
          Indicates if the passing type does concern this rule.
 java.util.List getActions()
          Returns the actions for this rule.
 ConditionExpression getCondition()
          Returns the defined condition for this rule.
 java.lang.String getExecutionMode()
           
 java.lang.String getId()
           
 int getPriority()
           
 long getRuleType()
          Return the rule type.
 java.lang.String getScope()
           
 Type getSource()
          Returns the source of this E-C-A rule.
 long getType()
          Returns the event type of this rule (propertyChange,saveDocument or initialization)
 boolean isAboutToPersistRule()
          Indicates if this rule is of type on persistent.
 boolean isChangeAndInitializationRule()
          Indicates if this rule is of type change & initialization.
 boolean isChangeRule()
          Indicates if this rule is of type change.
 boolean isCopyContentRule()
          Indicates if this rule is of type on copyContent.
 boolean isDomDeletedRule()
          Indicates if this rule is of type save document.
 boolean isDomInitialized()
          Indicates if the DOM is visualized.
 boolean isListItemDeselectedRule()
          Indicates if this rule is of type listtypedeselected.
 boolean isListItemSelectedRule()
          Indicates if this rule is of type listtypeselected.
 boolean isOnCreationRule()
          Indicates if this rule is of type initializisation.
 boolean isPasteContentRule()
          Indicates if this rule is of type on creation.
 boolean isPersistentRule()
          Indicates if this rule is of type save document.
 boolean isPropertyChangeRule()
          Indicates if this rule is of type property change.
 boolean isReleased()
           
 boolean isSaveDocumentRule()
          Indicates if this rule is of type save document.
 boolean isStructureChangeAddRule()
          Indicates if this rule is of type structure change (add).
 boolean isStructureChangeRemoveRule()
          Indicates if this rule is of type structure change (remove).
 boolean isStructureChangeRule()
          Indicates if this rule is of type structure change.
 boolean isVisualizerInitializationRule()
          Indicates if this rule is of type initializisation.
 void release()
          Release all allocated resources for this rule.
 void setCondition(ConditionExpression condition)
          Sets the condition of this rule.
 void setPriority(int priority)
          Sets the priority of this rule.
 void setSource(Type type)
           
 java.lang.String toString()
          Returns a short description of the sourceType, eventType and all registered Conditions and Events
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RuleImpl

public RuleImpl(long type,
                Type source)
A Rule needs sourceType to be checked against with and a type which specifies the event type. The event type is necessary for the EventMulticaster to know if a Rule has to be fired or not.

Parameters:
String - type type of event saveDocument -> fired calling serialization() on the Document class initialisation -> fired on initial document load or if a new Element will be added to the Document propertyChange -> fired on valueChanges
source - source base for the ECA behaviour

RuleImpl

public RuleImpl(long type,
                Type source,
                java.lang.String scope)
A Rule needs sourceType to be checked against with and a type which specifies the event type. The event type is necessary for the EventMulticaster to know if a Rule has to be fired or not.

Parameters:
type - type of event save -> fired calling serialization() on the Document class initialisation -> fired on initial document load or if a new Element will be added to the Document propertyChange -> fired on valueChanges
source - source base for the ECA behaviour
scope - defines the scope of this rule in case of an occured event

RuleImpl

public RuleImpl(long type,
                Type source,
                java.lang.String scope,
                boolean doesConcernNoneSerializableSource)
A Rule needs sourceType to be checked against with and a type which specifies the event type. The event type is necessary for the EventMulticaster to know if a Rule has to be fired or not.

Parameters:
type - type of event save -> fired calling serialization() on the Document class initialisation -> fired on initial document load or if a new Element will be added to the Document propertyChange -> fired on valueChanges
source - source base for the ECA behaviour
scope - defines the scope of this rule in case of an occured event
doesConcernNoneSerializableSource - apply the rule if the source is not serializable

RuleImpl

public RuleImpl(long type,
                Type source,
                java.lang.String executionMode,
                java.lang.String scope,
                boolean doesConcernNoneSerializableSource,
                boolean doesConcernOnlyVisible)
A Rule needs sourceType to be checked against with and a type which specifies the event type. The event type is necessary for the EventMulticaster to know if a Rule has to be fired or not.

Parameters:
type - type of event save -> fired calling serialization() on the Document class initialisation -> fired on initial document load or if a new Element will be added to the Document propertyChange -> fired on valueChanges
source - source base for the ECA behaviour
executionMode - place where the rule needs to be executed (client,server or both)
scope - defines the scope of this rule in case of an occured event
doesConcernNoneSerializableSource - apply the rule if the source is not serializable

RuleImpl

public RuleImpl(java.lang.String id,
                long type,
                Type source,
                java.lang.String executionMode,
                java.lang.String scope,
                boolean doesConcernNoneSerializableSource,
                boolean doesConcernOnlyVisible)
Method Detail

apply

public void apply(Type eventSource,
                  java.lang.Object event)
Description copied from interface: Rule
Applies ECA behaviour for the given sourceType

Specified by:
apply in interface Rule
event - TODO

apply

public void apply(Type eventSource,
                  java.lang.Object event,
                  boolean isRunningAsServer)
Description copied from interface: Rule
Applies ECA behaviour for the given sourceType. In some circumstances its necessary to apply the rule as temporary (e.g. if a component is displayed as dialog and not committed yet)

Specified by:
apply in interface Rule
event - TODO
isRunningAsServer - defines if this rule should be applied in server mode

apply

public void apply(Type eventSource,
                  java.lang.Object event,
                  boolean isRunningAsServer,
                  java.util.Stack callStack)
Specified by:
apply in interface Rule

doesConcern

public boolean doesConcern(Type sourceType)
Description copied from interface: Rule
Indicates if the passing type does concern this rule.

Specified by:
doesConcern in interface Rule
Parameters:
sourceType - source of an occured change

getActions

public java.util.List getActions()
Description copied from interface: Rule
Returns the actions for this rule.

Specified by:
getActions in interface Rule

getCondition

public ConditionExpression getCondition()
Description copied from interface: Rule
Returns the defined condition for this rule.

Specified by:
getCondition in interface Rule

getSource

public Type getSource()
Description copied from interface: Rule
Returns the source of this E-C-A rule.

Specified by:
getSource in interface Rule

getType

public long getType()
Returns the event type of this rule (propertyChange,saveDocument or initialization)


isVisualizerInitializationRule

public boolean isVisualizerInitializationRule()
Indicates if this rule is of type initializisation.

Specified by:
isVisualizerInitializationRule in interface Rule

isOnCreationRule

public boolean isOnCreationRule()
Indicates if this rule is of type initializisation.

Specified by:
isOnCreationRule in interface Rule

isChangeRule

public boolean isChangeRule()
Indicates if this rule is of type change.

Specified by:
isChangeRule in interface Rule

isChangeAndInitializationRule

public boolean isChangeAndInitializationRule()
Indicates if this rule is of type change & initialization.

Specified by:
isChangeAndInitializationRule in interface Rule

isPropertyChangeRule

public boolean isPropertyChangeRule()
Indicates if this rule is of type property change.

Specified by:
isPropertyChangeRule in interface Rule

isStructureChangeRule

public boolean isStructureChangeRule()
Indicates if this rule is of type structure change.

Specified by:
isStructureChangeRule in interface Rule

isStructureChangeAddRule

public boolean isStructureChangeAddRule()
Indicates if this rule is of type structure change (add).

Specified by:
isStructureChangeAddRule in interface Rule

isStructureChangeRemoveRule

public boolean isStructureChangeRemoveRule()
Indicates if this rule is of type structure change (remove).

Specified by:
isStructureChangeRemoveRule in interface Rule

isSaveDocumentRule

public boolean isSaveDocumentRule()
Indicates if this rule is of type save document.

Specified by:
isSaveDocumentRule in interface Rule

isDomDeletedRule

public boolean isDomDeletedRule()
Indicates if this rule is of type save document.

Specified by:
isDomDeletedRule in interface Rule

isPersistentRule

public boolean isPersistentRule()
Indicates if this rule is of type save document.

Specified by:
isPersistentRule in interface Rule

isAboutToPersistRule

public boolean isAboutToPersistRule()
Description copied from interface: Rule
Indicates if this rule is of type on persistent.

Specified by:
isAboutToPersistRule in interface Rule

isDomInitialized

public boolean isDomInitialized()
Indicates if the DOM is visualized.

Specified by:
isDomInitialized in interface Rule

isListItemSelectedRule

public boolean isListItemSelectedRule()
Description copied from interface: Rule
Indicates if this rule is of type listtypeselected.

Specified by:
isListItemSelectedRule in interface Rule

isListItemDeselectedRule

public boolean isListItemDeselectedRule()
Description copied from interface: Rule
Indicates if this rule is of type listtypedeselected.

Specified by:
isListItemDeselectedRule in interface Rule

isCopyContentRule

public boolean isCopyContentRule()
Description copied from interface: Rule
Indicates if this rule is of type on copyContent.

Specified by:
isCopyContentRule in interface Rule

isPasteContentRule

public boolean isPasteContentRule()
Description copied from interface: Rule
Indicates if this rule is of type on creation.

Specified by:
isPasteContentRule in interface Rule

release

public void release()
Description copied from interface: Rule
Release all allocated resources for this rule.

Specified by:
release in interface Rule

setCondition

public void setCondition(ConditionExpression condition)
Sets the condition of this rule.

Specified by:
setCondition in interface Rule
Parameters:
condition - condition for this rule

toString

public java.lang.String toString()
Returns a short description of the sourceType, eventType and all registered Conditions and Events

Overrides:
toString in class java.lang.Object

clone

public java.lang.Object clone(Type newSource)
Specified by:
clone in interface Rule

setSource

public void setSource(Type type)

getScope

public java.lang.String getScope()

getExecutionMode

public java.lang.String getExecutionMode()

getPriority

public int getPriority()
Specified by:
getPriority in interface Rule

setPriority

public void setPriority(int priority)
Description copied from interface: Rule
Sets the priority of this rule.

Specified by:
setPriority in interface Rule

getId

public java.lang.String getId()
Specified by:
getId in interface Rule

getRuleType

public long getRuleType()
Description copied from interface: Rule
Return the rule type.

Specified by:
getRuleType in interface Rule

isReleased

public boolean isReleased()
Specified by:
isReleased in interface Rule