Project Wonder 2.0

er.directtoweb
Class ERDAssignment

java.lang.Object
  extended bycom.webobjects.directtoweb.Assignment
      extended byer.directtoweb.ERDAssignment
All Implemented Interfaces:
EOKeyValueArchiving, ERDComputingAssignmentInterface, Serializable
Direct Known Subclasses:
ERDDefaultActionAssignment, ERDDefaultCancelCreationMessageAssignment, ERDDefaultConfigurationNameAssignment, ERDDefaultDisplayNameAssignment, ERDDefaultEntityNameAssignment, ERDDefaultModelAssignment, ERDDefaultPropertyNameAssignment, ERDDefaultsEmbeddedAssignment, ERDImageNameAssignment, ERDLocalizedAssignment, ERDRelationshipSortAssignment, ERDSmartAttributeAssignment, ERDSmartRelationshipAssignment, ERDSortedManyToManyAssignment, ERDTabSectionsContentsAssignment

public abstract class ERDAssignment
extends Assignment
implements ERDComputingAssignmentInterface

Abstact super class of most assignments found in the ERDirectToWeb framework. This class provides default implementations for localization support and dynamic method lookup for firing rules.

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
static Class[] D2WContextClassArray
          Cached context class array
static ERXLogger log
          logging supprt
 
Fields inherited from class com.webobjects.directtoweb.Assignment
KeyPathKey, ValueKey
 
Fields inherited from interface com.webobjects.eocontrol.EOKeyValueArchiving
_CLASS
 
Constructor Summary
ERDAssignment(EOKeyValueUnarchiver u)
          Public constructor
ERDAssignment(String key, Object value)
          Public constructor
 
Method Summary
protected  boolean booleanContextValueForKey(D2WContext c, String key, boolean defaultValue)
           
 Object fire(D2WContext c)
          Method called to fire an assignment.
 String keyForMethodLookup(D2WContext c)
          There are basically two choices to lookup the method to be called when an assignment is fired.
 Object localizedTemplateStringForKeyInContext(String key, D2WContext c)
           
 Object localizedValueForKeyInContext(String key, D2WContext c)
          Returns a localized value for a given key in a given context if localization is enabled.
 Object localizedValueForKeyWithDefaultInContext(String key, D2WContext c)
          Returns a localized value for a given key in a given context if localization is enabled.
 ERXLocalizer localizerForContext(D2WContext c)
          Gets the localizer for a given context.
protected static void logDeprecatedMessage(Class oldClass, Class newClass)
           
 
Methods inherited from class com.webobjects.directtoweb.Assignment
decodeWithKeyValueUnarchiver, encodeWithKeyValueArchiver, keyPath, toString, value, value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface er.directtoweb.ERDComputingAssignmentInterface
dependentKeys
 

Field Detail

log

public static final ERXLogger log
logging supprt


D2WContextClassArray

public static final Class[] D2WContextClassArray
Cached context class array

Constructor Detail

ERDAssignment

public ERDAssignment(EOKeyValueUnarchiver u)
Public constructor

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

ERDAssignment

public ERDAssignment(String key,
                     Object value)
Public constructor

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

booleanContextValueForKey

protected boolean booleanContextValueForKey(D2WContext c,
                                            String key,
                                            boolean defaultValue)

logDeprecatedMessage

protected static void logDeprecatedMessage(Class oldClass,
                                           Class newClass)

localizerForContext

public ERXLocalizer localizerForContext(D2WContext c)
Gets the localizer for a given context. The default implementation just returns the localizer for the current session of the given context. This method belongs to ERDLocaizableInterface.

Parameters:
c - current context
Returns:
localizer for the preferred language of the session.

localizedValueForKeyWithDefaultInContext

public Object localizedValueForKeyWithDefaultInContext(String key,
                                                       D2WContext c)
Returns a localized value for a given key in a given context if localization is enabled. This implementation calls localizedStringForKeyWithDefault on the localizer for the given context. This method belongs to ERDLocalizableInterface.

Parameters:
key - to be looked up on the context
Returns:
localized version of the given key returning the key as the default if a localized version isn't found.

localizedValueForKeyInContext

public Object localizedValueForKeyInContext(String key,
                                            D2WContext c)
Returns a localized value for a given key in a given context if localization is enabled. This implementation calls valueForKeyPath on the localizer for the given context. This method belongs to ERDLocaizableInterface.

Parameters:
key - to be looked up on the context
Returns:
localized version of the given key if localization .

localizedTemplateStringForKeyInContext

public Object localizedTemplateStringForKeyInContext(String key,
                                                     D2WContext c)

keyForMethodLookup

public String keyForMethodLookup(D2WContext c)
There are basically two choices to lookup the method to be called when an assignment is fired. The first is to use the keypath that is being requested to lookup the method, i.e. if the context is being asked for the key: displayNameForProperty then that method will be called on the particular assignment. The second method is to use the value of the assignment as the method to be called. Using the value of the assignment allows the passing of a parameter to your assignment method, this gives the flexibility to have several methods for the same key path.

Returns:
the name of the method to be called, by default the key path of the assignmnet is returned.

fire

public Object fire(D2WContext c)
Method called to fire an assignment. This method has been enhanced to dynamicly lookup the real method to call based on the return value of keyForMethodLookup. The default implementation will lookup the method based on the key path of the assignment. If you are building a generic assignment like a BooleanAssignment you should override this method seeing as you wouldn't care what the key path of the assignment is. If you would like to provide a different methodology for the method to be fired override the method keyForMethodLookup.

Parameters:
c - current D2W context
Returns:
result of firing the assignment.

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

Copyright © 2002 – 2004 Project Wonder.