Project Wonder 2.0

er.directtoweb
Class ERDDefaultModelAssignment

java.lang.Object
  extended bycom.webobjects.directtoweb.Assignment
      extended byer.directtoweb.ERDAssignment
          extended byer.directtoweb.ERDDefaultModelAssignment
All Implemented Interfaces:
EOKeyValueArchiving, ERDComputingAssignmentInterface, Serializable
Direct Known Subclasses:
ERDDefaultsAssignment

public class ERDDefaultModelAssignment
extends ERDAssignment

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

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class com.webobjects.eocontrol.EOKeyValueArchiving
EOKeyValueArchiving._NullValueSupport, EOKeyValueArchiving._NumberSupport, EOKeyValueArchiving._TimestampSupport, EOKeyValueArchiving.Awaking, EOKeyValueArchiving.FinishInitialization, EOKeyValueArchiving.Support
 
Field Summary
protected static NSDictionary keys
          holds the array of keys this assignment depends upon
static ERXLogger log
          logging support
 
Fields inherited from class er.directtoweb.ERDAssignment
D2WContextClassArray
 
Fields inherited from class com.webobjects.directtoweb.Assignment
KeyPathKey, ValueKey
 
Fields inherited from interface com.webobjects.eocontrol.EOKeyValueArchiving
_CLASS
 
Constructor Summary
ERDDefaultModelAssignment(EOKeyValueUnarchiver u)
          Public constructor
ERDDefaultModelAssignment(String key, Object value)
          Public constructor
 
Method Summary
protected  int attributeWidthAsInt(D2WContext c)
           
static Object decodeWithKeyValueUnarchiver(EOKeyValueUnarchiver eokeyvalueunarchiver)
          Static constructor required by the EOKeyValueUnarchiver interface.
 NSArray dependentKeys(String keyPath)
          Implementation of the ERDComputingAssignmentInterface.
 Object destinationEntity(D2WContext c)
          Returns the default value for the destination entity.
protected  EOEntity dummyEntity()
          Utility to create a fake entity that can be used for tasks such as error/confirm.
 Object dummyEntity(D2WContext c)
          Returns 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.
 Object entityForControllerName(D2WContext c)
          Returns the default value for the entity based on the controllerName.
protected  Object entityForKey(D2WContext c, String key)
           
 Object entityForPageConfiguration(D2WContext c)
          Returns the default value for the entity based on the pageConfiguration.
protected  boolean isTaskWithoutEntity(String task)
           
 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.
 Object smartDefaultAttributeWidth(D2WContext c)
           
protected  int smartDefaultAttributeWidthAsInt(D2WContext c)
           
 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.
 Object sortKeyForList(D2WContext context)
          Called when firing this assignment with the key-path: sortKeyForList.
 
Methods inherited from class er.directtoweb.ERDAssignment
booleanContextValueForKey, fire, keyForMethodLookup, localizedTemplateStringForKeyInContext, localizedValueForKeyInContext, localizedValueForKeyWithDefaultInContext, localizerForContext, logDeprecatedMessage
 
Methods inherited from class com.webobjects.directtoweb.Assignment
encodeWithKeyValueArchiver, keyPath, toString, value, value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

public static final ERXLogger log
logging support


keys

protected static final NSDictionary keys
holds the array of keys this assignment depends upon

Constructor Detail

ERDDefaultModelAssignment

public ERDDefaultModelAssignment(EOKeyValueUnarchiver u)
Public constructor

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

ERDDefaultModelAssignment

public ERDDefaultModelAssignment(String key,
                                 Object value)
Public constructor

Parameters:
key - context key
value - of the assignment
Method Detail

dependentKeys

public 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.

decodeWithKeyValueUnarchiver

public static Object decodeWithKeyValueUnarchiver(EOKeyValueUnarchiver eokeyvalueunarchiver)
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

attributeWidthAsInt

protected int attributeWidthAsInt(D2WContext c)

smartDefaultAttributeWidthAsInt

protected int smartDefaultAttributeWidthAsInt(D2WContext c)

smartDefaultAttributeWidth

public Object smartDefaultAttributeWidth(D2WContext c)

smartDefaultRows

public Object smartDefaultRows(D2WContext c)

smartAttribute

public 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 . 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.

smartRelationship

public 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 . 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.

dummyEntity

protected EOEntity dummyEntity()
Utility to create a fake entity that can be used for tasks such as error/confirm.


dummyEntity

public 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.

entity

public 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.

isTaskWithoutEntity

protected boolean isTaskWithoutEntity(String task)

entityForKey

protected Object entityForKey(D2WContext c,
                              String key)

entityForControllerName

public Object entityForControllerName(D2WContext c)
Returns the default value for the entity based on the controllerName.

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

entityForPageConfiguration

public Object entityForPageConfiguration(D2WContext c)
Returns the default value for the entity based on the pageConfiguration.

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

destinationEntity

public 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.

sortKeyForList

public Object sortKeyForList(D2WContext context)
Called when firing this assignment with the key-path: sortKeyForList.

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

Last updated: Do, Dez 9, 2004 • 12:46 PM CET

Copyright © 2002 – 2004 Project Wonder.