public class ERDDelayedNonNullConditionalAssignment extends ERDDelayedAssignment
Because this assignment is a delayed assignment the above condition will be evaluated every time that the D2W fired rule cache resolves to a rule of this class.
Example usage. Let's imagine that a User has a relationship called
toOwnedHouse
this relationship is only set if the User is a home
owner. Now let's imagine that we have a page configuration for displaying
information about a User. One of the propertyKeys for this page configuration
is 'residence' which is not an attribute or relationship off of the User
object. Imagine that we have already built a custom component for displaying
the address of either an owned house or a rented house for a given User.
However we want the displayed name to be either "Rented House" or
"Owned House" depending on if the User is a home owner. The usual approach
would be to create two page configurations and set the displayNameForProperty
to be different for each of these page configurations. However by using a
DelayedNonNullConditionalAssignment we will only have to use a single page
configuration. Using this rule:
pageConfguration = 'InspectUser' AND propertyKey = 'residence' =>
displayNameForProperty =
{
nonNullKeyPath = "object.toOwnedHouse";
trueValue = "Owned House";
falseValue = "Rented House";
}
EOKeyValueArchiving._NullValueSupport, EOKeyValueArchiving._NumberSupport, EOKeyValueArchiving._TimestampSupport, EOKeyValueArchiving.Awaking, EOKeyValueArchiving.FinishInitialization, EOKeyValueArchiving.Support
Modifier and Type | Field and Description |
---|---|
static org.apache.log4j.Logger |
log
logging support
|
_CLASS
Constructor and Description |
---|
ERDDelayedNonNullConditionalAssignment(EOKeyValueUnarchiver u)
Public constructor
|
ERDDelayedNonNullConditionalAssignment(String key,
Object value)
Public constructor
|
Modifier and Type | Method and Description |
---|---|
static Object |
decodeWithKeyValueUnarchiver(EOKeyValueUnarchiver eokeyvalueunarchiver)
Static constructor required by the EOKeyValueUnarchiver interface.
|
NSArray<String> |
dependentKeys(String keyPath)
Implementation of the
ERDComputingAssignmentInterface . |
Object |
fireNow(com.webobjects.directtoweb.D2WContext c)
Implementation of the abstract method from
ERDDelayedAssignment . |
fire
public ERDDelayedNonNullConditionalAssignment(EOKeyValueUnarchiver u)
u
- key-value unarchiver used when unarchiving from rule files.public static Object decodeWithKeyValueUnarchiver(EOKeyValueUnarchiver eokeyvalueunarchiver)
eokeyvalueunarchiver
- to be unarchivedpublic NSArray<String> dependentKeys(String keyPath)
ERDComputingAssignmentInterface
. This
assignment depends upon an array composed of the single value
"nonNullKeyPath" from the dictionary of the value of this assignment.
This array of keys is used when constructing the significant keys for the
passed in keyPath.keyPath
- to compute significant keys for.public Object fireNow(com.webobjects.directtoweb.D2WContext c)
ERDDelayedAssignment
. This
method is called each time this Assignment is resolved from the rule
firing cache. For the non-null conditional the dictionary key
'nonNullKeyPath' is checked against the current context. If the key path
is indeed non-null then the object returned by the dictionary key
'trueValue' will be returned otherwise the object returned by the
dictionary key 'falseValue' will be returned.fireNow
in class ERDDelayedAssignment
c
- current D2W contextCopyright © 2002 – 2024 Project Wonder.