ERDDefaultModelAssignment Class Reference

Inherits er::directtoweb::assignments::ERDAssignment.

Inherited by ERDDefaultsAssignment.

Collaboration diagram for ERDDefaultModelAssignment:

Collaboration graph
[legend]

List of all members.

Public Member Functions

Object attributeConstants (D2WContext c)
Object defaultSortOrdering (D2WContext context)
NSArray dependentKeys (String keyPath)
Object destinationEntity (D2WContext c)
Object dummyEntity (D2WContext c)
Object entity (D2WContext c)
Object entityForControllerName (D2WContext c)
Object entityForPageConfiguration (D2WContext c)
 ERDDefaultModelAssignment (String key, Object value)
 ERDDefaultModelAssignment (EOKeyValueUnarchiver u)
Object smartAttribute (D2WContext c)
Object smartDefaultAttributeWidth (D2WContext c)
Object smartDefaultRows (D2WContext c)
Object smartRelationship (D2WContext c)
Object sortKeyForList (D2WContext context)

Static Public Member Functions

static Object decodeWithKeyValueUnarchiver (EOKeyValueUnarchiver eokeyvalueunarchiver)

Static Public Attributes

static final Logger log = Logger.getLogger(ERDDefaultModelAssignment.class)

Protected Member Functions

int attributeWidthAsInt (D2WContext c)
EOEntity dummyEntity ()
Object entityForKey (D2WContext c, String key)
boolean isTaskWithoutEntity (String task)
int smartDefaultAttributeWidthAsInt (D2WContext c)

Static Protected Attributes

static final NSDictionary keys

Private Attributes

EOEntity _dummyEntity


Detailed Description

A bunch of methods used for pulling default values from EOModels.
Provides defaults for the following keys:

Constructor & Destructor Documentation

ERDDefaultModelAssignment ( EOKeyValueUnarchiver  u  ) 

Public constructor

Parameters:
u key-value unarchiver used when unarchiving from rule files.

ERDDefaultModelAssignment ( String  key,
Object  value 
)

Public constructor

Parameters:
key context key
value of the assignment


Member Function Documentation

Object attributeConstants ( D2WContext  c  ) 

Returns the default value for the entity based on the controllerName.

Parameters:
c current D2W context
Returns:
the entity.

int attributeWidthAsInt ( D2WContext  c  )  [protected]

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.

Parameters:
eokeyvalueunarchiver to be unarchived
Returns:
decoded assignment of this class

Reimplemented in ERDDefaultsAssignment.

Object defaultSortOrdering ( D2WContext  context  ) 

Called when firing this assignment with the key-path: defaultSortOrdering.

Returns:
the first value of the display property keys, with ascending comparison.

NSArray dependentKeys ( String  keyPath  ) 

Implementation of the ERDComputingAssignmentInterface. This array of keys is used when constructing the significant keys for the passed in keyPath.

Parameters:
keyPath to compute significant keys for.
Returns:
array of context keys this assignment depends upon.

Implements ERDComputingAssignmentInterface.

Object destinationEntity ( D2WContext  c  ) 

Returns the default value for the destination entity. This is a value add because we are now also able to set the destination entity in other rules.

Parameters:
c current D2W context
Returns:
the destination entity.

Object dummyEntity ( D2WContext  c  ) 

Returns a fake entity that can be used for tasks such as error/confirm.

Parameters:
c current D2W context
Returns:
dummy entity.

EOEntity dummyEntity (  )  [protected]

Utility to create a fake entity that can be used for tasks such as error/confirm.

Object entity ( D2WContext  c  ) 

Returns a fake entity that can be used for tasks such as error/confirm.

Parameters:
c current D2W context
Returns:
dummy entity.

Object entityForControllerName ( D2WContext  c  ) 

Returns the default value for the entity based on the controllerName.

Parameters:
c current D2W context
Returns:
the entity.

Object entityForKey ( D2WContext  c,
String  key 
) [protected]

Object entityForPageConfiguration ( D2WContext  c  ) 

Returns the default value for the entity based on the pageConfiguration.

Parameters:
c current D2W context
Returns:
the entity.

boolean isTaskWithoutEntity ( String  task  )  [protected]

Object smartAttribute ( D2WContext  c  ) 

Resolves the EOAttribute in a smarter manner using the current object from the context as well as the propertyKey to determine the current attribute. Works even with inheirtance. Works around the following problem: An entity A has a relationship b to an entity B, which has a subentity B1. B1 has an attribute k, which B does not have. If in an inspect page for entity A, you use b.k as a display key, then the D2W rules which are based on d2wContext.attribute will not fire properly. This is because attribute is null, instead of containing <EOAttribute entity="B1" name="k">. The reason D2W does not find it is that it uses the Model to find out the EOAttribute and starts from A. Following the relationship b, gives a B, and asking B for an attribute named k returns nil and you lose.

Parameters:
c current D2W context
Returns:
attribute for the current propertyKey object combination.

Object smartDefaultAttributeWidth ( D2WContext  c  ) 

int smartDefaultAttributeWidthAsInt ( D2WContext  c  )  [protected]

Object smartDefaultRows ( D2WContext  c  ) 

Object smartRelationship ( D2WContext  c  ) 

Resolves the EORelationship in a smarter manner using the current object from the context as well as the propertyKey to determine the current relationship. Works even with inheritance. Works around the following problem: An entity A has a relationship b to an entity B, which has a subentity B1. B1 has a relationship k, which B does not have. If in an inspect page for entity A, you use b.k as a display key, then the D2W rules which are based on d2wContext.relationship will not fire properly. This is because relationship is null, instead of containing <EORelationship entity="B1" name="k">. The reason D2W does not find it is that it uses the Model to find out the EORelationship and starts from A. Following the relationship b, gives a B, and asking B for a relationship named k returns null and you lose.

Parameters:
c current D2W context
Returns:
relationship for the current propertyKey object combination.

Object sortKeyForList ( D2WContext  context  ) 

Called when firing this assignment with the key-path: sortKeyForList.

Returns:
the current propertyKey + "." + the current value for keyWhenRelationship.


Member Data Documentation

EOEntity _dummyEntity [private]

final NSDictionary keys [static, protected]

Initial value:

 ERXDictionaryUtilities.dictionaryWithObjectsAndKeys( new Object [] {
        new NSArray(new Object[] {"propertyKey", "object.entityName", "entity.name"}), "smartAttribute",
        new NSArray(new Object[] {"propertyKey", "object.entityName", "entity.name"}), "smartRelationship",
        new NSArray(new Object[] {"smartAttribute"}), "attributeConstants",
        new NSArray(new Object[] {"smartAttribute"}), "smartDefaultRows",
        new NSArray(new Object[] {"smartAttribute"}), "smartDefaultAttributeWidth",
        new NSArray(new Object[] {"smartRelationship"}), "destinationEntity",
        new NSArray(new Object[] {"propertyKey", "keyWhenRelationship"}), "sortKeyForList",
        new NSArray(new Object[] {"controllerName"}), "entityForControllerName",
        new NSArray(new Object[] {"pageConfiguration"}), "entityForPageConfiguration",
        new NSArray(new Object[] {"pageConfiguration"}), "defaultSortOrdering",
        NSArray.EmptyArray, "entity",
        NSArray.EmptyArray, "dummyEntity"
    })
holds the array of keys this assignment depends upon

final Logger log = Logger.getLogger(ERDDefaultModelAssignment.class) [static]

logging support

Reimplemented from ERDAssignment.


The documentation for this class was generated from the following file:

Generated on Sat May 26 06:42:50 2012 for Project Wonder by  doxygen 1.5.8