|
WebObjects 5.4 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.webobjects.directtoweb.Rule
public class Rule
The Rule class represents a simple inference.
A rule consists of a left-hand side and right-hand side. The left-hand side is a set of pre-conditions, represented by a qualifier. The right-hand side is a post-condition, represented by an assignment.
One rule may take precendence over another, depending on authorship, context, and fit. In general, a more specific rule has higher priority.
The D2WModel class makes extensive use of rules.
The implementation is subject to change in future releases.
D2WModel
,
Assignment
,
EOQualifier
,
Serialized FormNested Class Summary |
---|
Nested classes/interfaces inherited from interface com.webobjects.eocontrol.EOKeyValueArchiving |
---|
EOKeyValueArchiving.Awaking, EOKeyValueArchiving.FinishInitialization, EOKeyValueArchiving.Support |
Field Summary | |
---|---|
static String |
authorKey
A key representing the author. |
static String |
lhsKey
A key representing the left-hand side. |
static String |
rhsKey
A key representing the right-hand side. |
Constructor Summary | |
---|---|
Rule()
Creates an instance of Rule. |
|
Rule(int author,
EOQualifier lhs,
Assignment rhs)
Creates an instance of Rule with the specified author, left-hand side, and right-hand side. |
Method Summary | |
---|---|
int |
author()
Gets the author. |
boolean |
canFireInContext(D2WContext context)
Indicates whether the rule can fire by evaluating the left-hand side with the specified context. |
int |
compareRules(Rule otherRule)
Compares two rules, based on priority. |
Assignment |
createAssignment(String keyPath,
String value)
Creates an assignment with the specified key path and value. |
Vector |
dataTypesInvolved()
Gets the set of names of data types involved. |
static Object |
decodeWithKeyValueUnarchiver(EOKeyValueUnarchiver unarchiver)
|
Vector |
dynamicPagesInvolved()
Gets the set of names of dynamic pages involved. |
void |
encodeWithKeyValueArchiver(EOKeyValueArchiver archiver)
Asks the receiver to archive its state into the EOKeyValueArchiver archiver . |
Object |
fire(D2WContext context)
Fires the right-hand side with the specified context. |
String |
firstDynamicPageNameInvolved()
Gets the name of the first dynamic page involved. |
String |
firstEntityInvolved()
Gets the name of the first entity involved. |
String |
firstPropertyKeyInvolved()
Gets the name of the first property key involved. |
String |
firstTaskInvolved()
Gets the name of the first task involved. |
boolean |
hasSameSettingsAs(com.apple.client.directtoweb.common.Settings settings,
boolean areSettingsForADynamicPage)
Compares the rule with the specified settings. |
boolean |
isEntityPermissionRule()
Indicates that a rule involves the assignment of an entity permission. |
boolean |
isEntityRule()
Indicates that a rule involves the assignment of an entity. |
boolean |
isLookRule()
Indicates that a rule involves the assignment of a look. |
boolean |
isStartupRule()
Indicates that a rule involves the assignment of a start-up task or start-up entity name. |
boolean |
isTaskRule()
Indicates that a rule involves the assignment of a task. |
EOQualifier |
lhs()
Gets the left-hand side. |
int |
priority()
Gets the priority of the rule. |
Assignment |
rhs()
Gets the left-hand side. |
String |
rhsKeyPath()
Gets the key path of the right-hand side. |
int |
rhsKeyPathHash()
Gets the hashcode of the key path of the right-hand side. |
void |
setLhs(EOQualifier newValue)
Sets the left-hand side to the specified value. |
void |
setRhs(Assignment newValue)
Sets the right-hand side to the specified value. |
Vector |
tasksInvolved()
Gets the set of names of tasks involved. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String lhsKey
In the current implementation, the value is "lhs".
The implementation is subject to change in future releases.
public static final String rhsKey
In the current implementation, the value is "rhs".
The implementation is subject to change in future releases.
public static final String authorKey
In the current implementation, the value is "author".
The implementation is subject to change in future releases.
Constructor Detail |
---|
public Rule()
In the current implementation, the default author is DIRECT_2_WEB, and both the left-hand side and right-hand side remain unassigned. Note: A rule should not be used before the right-hand side is set.
The implementation is subject to change in future releases.
DIRECT_2_WEB
,
Rule(int, EOQualifier, Assignment)
public Rule(int author, EOQualifier lhs, Assignment rhs)
The interface is subject to change in future releases.
author
- instance of Assignmentlhs
- instance of EOQualifier
IllegalArgumentException
- if right-hand side is nullRule()
,
EOQualifier
,
Assignment
Method Detail |
---|
public static Object decodeWithKeyValueUnarchiver(EOKeyValueUnarchiver unarchiver)
public void encodeWithKeyValueArchiver(EOKeyValueArchiver archiver)
EOKeyValueArchiving
archiver
.
encodeWithKeyValueArchiver
in interface EOKeyValueArchiving
archiver
- the EOKeyValueArchiverEOKeyValueArchiver
public int author()
public EOQualifier lhs()
setLhs(EOQualifier)
public void setLhs(EOQualifier newValue)
newValue
- instance of EOQualifierlhs()
public final Assignment rhs()
setRhs(Assignment)
public void setRhs(Assignment newValue)
newValue
- instance of Assignmentrhs()
public final String rhsKeyPath()
rhs()
,
Assignment#keyPath()
public int rhsKeyPathHash()
The current implementation caches the value of the hashcode.
The implementation is subject to change in future releases.
rhsKeyPath()
,
Object.hashCode()
public String toString()
toString
in class Object
public boolean canFireInContext(D2WContext context)
context
- instance of D2WContext
lhs()
,
EOQualifier.evaluateWithObject(Object)
public Object fire(D2WContext context)
context
- instance of D2WContext
rhs()
,
Assignment#fire(D2WContext)
public Assignment createAssignment(String keyPath, String value)
keyPath
- the key pathvalue
- the value
Assignment#Assignment(String, Object)
public int priority()
The current implementation caches the value of the priority. A "dummy true" rule has low priority. Dynamic page rules have priority over others. A complex EOAndQualifier is higher than a simple one.
The implementation is subject to change in future releases.
author()
,
D2WModel#DummyTrueKey
,
EOQualifier
public int compareRules(Rule otherRule)
otherRule
- instance of Rule
priority()
public Vector tasksInvolved()
The current implementation caches the names.
Traverses the left-hand side, looking at EOKeyValueQualifiers that
specify a task, for example, task="Edit"
.
The implementation is subject to change in future releases.
java.util.Vector
lhs()
,
D2WModel#TaskKey
,
firstTaskInvolved()
public Vector dynamicPagesInvolved()
The current implementation caches the names. Traverses the left-hand side, looking at EOKeyValueQualifiers that specify a dynamic page.
The implementation is subject to change in future releases.
java.util.Vector
firstDynamicPageNameInvolved()
,
lhs()
,
D2WModel#DynamicPageKey
public String firstTaskInvolved()
The current implementation caches the name. Traverses the left-hand side, looking for the first EOKeyValueQualifier that specifies a task.
The implementation is subject to change in future releases.
tasksInvolved()
,
lhs()
,
D2WModel#TaskKey
public String firstPropertyKeyInvolved()
The current implementation caches the name. Traverses the left-hand side, looking for the first EOKeyValueQualifier that specifies a property key.
The implementation is subject to change in future releases.
lhs()
,
D2WModel#PropertyKeyKey
public String firstDynamicPageNameInvolved()
The current implementation caches the name. Traverses the left-hand side, looking for the first EOKeyValueQualifier that specifies a dynamic page.
The implementation is subject to change in future releases.
dynamicPagesInvolved()
,
lhs()
,
D2WModel#DynamicPageKey
public String firstEntityInvolved()
The current implementation caches the name. Traverses the left-hand side, looking for the first EOKeyValueQualifier that specifies an entity.
The implementation is subject to change in future releases.
lhs()
public Vector dataTypesInvolved()
The current implementation caches the names. Traverses the left-hand side, looking at EOKeyValueQualifiers that specify a class name.
The implementation is subject to change in future releases.
java.util.Vector
lhs()
public boolean hasSameSettingsAs(com.apple.client.directtoweb.common.Settings settings, boolean areSettingsForADynamicPage)
areSettingsForADynamicPage
is true;
looks at the first task involved and first entity involved otherwise.
If areSettingsForADynamicPage
is true
,
it returns true
if firstDynamicPageNameInvolved
equals the dynamicPage
of
settings
; false
otherwise.
If areSettingsForADynamicPage
is false
,
it returns true
if firstTaskInvolved
and firstEntityInvolved
equal the
task
and entity
(respectively) of settings
.
The current implementation assumes that the rule is of the form (task="xx" and entity="yy"); no EOOrQualifiers.
The implementation is subject to change in future releases.
settings
- instance of SettingsareSettingsForADynamicPage
- boolean
firstDynamicPageNameInvolved()
,
firstTaskInvolved()
,
firstEntityInvolved()
public boolean isStartupRule()
rhs()
,
D2WModel#StartupTaskKey
,
D2WModel#StartupEntityNameKey
,
D2WContext#startupTask()
,
D2WContext#startupEntityName()
public boolean isLookRule()
public boolean isTaskRule()
public boolean isEntityRule()
public boolean isEntityPermissionRule()
|
Last updated Tuesday, October 9, 2007 08:58 PDT | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |