|
WebObjects 5.2 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.webobjects.directtoweb.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 FormInner classes inherited from class com.webobjects.eocontrol.EOKeyValueArchiving |
EOKeyValueArchiving.Awaking, EOKeyValueArchiving.FinishInitialization, EOKeyValueArchiving.Support |
Field Summary | |
static String |
authorKey
A key representing the author. |
static int |
DIRECT_2_WEB
A constant denoting authorship by Direct to Web. |
static String |
lhsKey
A key representing the left-hand side. |
static String |
rhsKey
A key representing the right-hand side. |
static int |
WEB_ASSISTANT
A constant denoting authorship by the Web Assistant. |
static int |
WEB_ASSISTANT_PAGE_AVAILABLE
A constant denoting authorship by the Web Assistant when generating new pageAvailable rules in the user model. |
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 int DIRECT_2_WEB
In the current implementation, the value is the int zero.
The implementation is subject to change in future releases.
author()
public static final int WEB_ASSISTANT
In the current implementation, the value is the int 100.
The implementation is subject to change in future releases.
DIRECT_2_WEB
public static final int WEB_ASSISTANT_PAGE_AVAILABLE
pageAvailable
rules in the user model.
In the current implementation, the value is the int 105.
The implementation is subject to change in future releases.
WEB_ASSISTANT
public static final String authorKey
In the current implementation, the value is "author".
The implementation is subject to change in future releases.
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.
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
- intlhs
- instance of EOQualifierauthor
- instance of AssignmentIllegalArgumentException
- if right-hand side is nullRule()
,
EOQualifier
,
Assignment
Method Detail |
public int author()
public boolean canFireInContext(D2WContext context)
context
- instance of D2WContextlhs()
,
EOQualifier.evaluateWithObject(Object)
public int compareRules(Rule otherRule)
otherRule
- instance of Rulepriority()
public Assignment createAssignment(String keyPath, String value)
keyPath
- the key pathvalue
- the valueAssignment.Assignment(String, Object)
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 static Object decodeWithKeyValueUnarchiver(EOKeyValueUnarchiver unarchiver)
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 void encodeWithKeyValueArchiver(EOKeyValueArchiver archiver)
EOKeyValueArchiving
archiver
.encodeWithKeyValueArchiver
in interface EOKeyValueArchiving
com.webobjects.eocontrol.EOKeyValueArchiving
archiver
- the EOKeyValueArchiverEOKeyValueArchiver
public Object fire(D2WContext context)
context
- instance of D2WContextrhs()
,
Assignment.fire(D2WContext)
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 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 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 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
- booleanfirstDynamicPageNameInvolved()
,
firstTaskInvolved()
,
firstEntityInvolved()
public boolean isEntityPermissionRule()
public boolean isEntityRule()
public boolean isLookRule()
public boolean isStartupRule()
rhs()
,
D2WModel.StartupTaskKey
,
D2WModel.StartupEntityNameKey
,
D2WContext.startupTask()
,
D2WContext.startupEntityName()
public boolean isTaskRule()
public EOQualifier lhs()
setLhs(EOQualifier)
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 final Assignment rhs()
setRhs(Assignment)
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 void setLhs(EOQualifier newValue)
newValue
- instance of EOQualifierlhs()
public void setRhs(Assignment newValue)
newValue
- instance of Assignmentrhs()
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 String toString()
toString
in class Object
|
Last updated Fri Feb 21 13:15:00 PST 2003. | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |