
Public Member Functions | |
| NSArray | dependentKeys (String keyPath) |
| ERDDelayedNonNullConditionalAssignment (String key, Object value) | |
| ERDDelayedNonNullConditionalAssignment (EOKeyValueUnarchiver u) | |
| Object | fireNow (D2WContext c) |
Static Public Member Functions | |
| static Object | decodeWithKeyValueUnarchiver (EOKeyValueUnarchiver eokeyvalueunarchiver) |
Static Public Attributes | |
| static final Logger | log = Logger.getLogger("er.directtoweb.rules.DelayedNonNullConditionalAssigment") |
nonNullKeyPath key path to be tested for nullality off of the current D2W context. trueValue value to be returned if the key path is not null. falseValue value to be returned if the key path is null.
Because this assignment is a delayed assignment the above condition will be evaluated everytime 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"; }
| ERDDelayedNonNullConditionalAssignment | ( | EOKeyValueUnarchiver | u | ) |
Public constructor
| u | key-value unarchiver used when unarchiving from rule files. |
| ERDDelayedNonNullConditionalAssignment | ( | String | key, | |
| Object | value | |||
| ) |
Public constructor
| key | context key | |
| value | of the assignment |
| static Object decodeWithKeyValueUnarchiver | ( | EOKeyValueUnarchiver | eokeyvalueunarchiver | ) | [static] |
Static constructor required by the EOKeyValueUnarchiver interface. If this isn't implemented then the default behavior is to construct the first super class that does implement this method. Very lame.
| eokeyvalueunarchiver | to be unarchived |
| NSArray dependentKeys | ( | String | keyPath | ) |
Implementation of the 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. |
| Object fireNow | ( | D2WContext | c | ) | [virtual] |
Implementation of the abstract method from 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 dictionarykey 'trueValue' will be returned otherwise the object returned by the dictionarykey 'falseValue' will be returned.
| c | current D2W context |
Implements ERDDelayedAssignment.
final Logger log = Logger.getLogger("er.directtoweb.rules.DelayedNonNullConditionalAssigment") [static] |
logging support
1.5.8