ERDAssignment Class Reference

Inherits com::webobjects::directtoweb::Assignment, and er::directtoweb::assignments::ERDComputingAssignmentInterface.

Inherited by ERDDefaultActionAssignment, ERDDefaultCancelCreationMessageAssignment, ERDDefaultClassStringAssignment, ERDDefaultConfigurationNameAssignment, ERDDefaultDisplayNameAssignment, ERDDefaultEntityNameAssignment, ERDDefaultFormControlNameAssignment, ERDDefaultIDAssignment, ERDDefaultModelAssignment, ERDDefaultPropertyNameAssignment, ERDDefaultsEmbeddedAssignment, ERDImageNameAssignment, ERDLocalizedAssignment, ERDRelationshipSortAssignment, ERDSmartAttributeAssignment, ERDSmartRelationshipAssignment, ERDSortedManyToManyAssignment, ERDTabSectionsContentsAssignment, and ERMDDefaultCSSAssignment.

Collaboration diagram for ERDAssignment:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 ERDAssignment (String key, Object value)
 ERDAssignment (EOKeyValueUnarchiver u)
Object fire (D2WContext c)
String keyForMethodLookup (D2WContext c)
Object localizedTemplateStringForKeyInContext (String key, D2WContext c)
Object localizedValueForKeyInContext (String key, D2WContext c)
Object localizedValueForKeyWithDefaultInContext (String key, D2WContext c)
ERXLocalizer localizerForContext (D2WContext c)

Static Public Attributes

static final Class[] D2WContextClassArray = new Class[] { D2WContext.class }
static final Logger log = Logger.getLogger("er.directtoweb.rules.ERDAssignment")

Protected Member Functions

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

Static Protected Member Functions

static void logDeprecatedMessage (Class oldClass, Class newClass)


Detailed Description

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.

Constructor & Destructor Documentation

ERDAssignment ( EOKeyValueUnarchiver  u  ) 

Public constructor

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

ERDAssignment ( String  key,
Object  value 
)

Public constructor

Parameters:
key context key
value of the assignment


Member Function Documentation

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

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.

Reimplemented in ERDLocalizedAssignment.

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.

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

Reimplemented in ERDDefaultsEmbeddedAssignment.

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. 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
c current context
Returns:
localized version of the given key if localization .

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
c current context
Returns:
localized version of the given key returning the key as the default if a localized version isn't found.

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.

Reimplemented in ERDDefaultsEmbeddedAssignment.

static void logDeprecatedMessage ( Class  oldClass,
Class  newClass 
) [static, protected]


Member Data Documentation

final Class [] D2WContextClassArray = new Class[] { D2WContext.class } [static]

Cached context class array

final Logger log = Logger.getLogger("er.directtoweb.rules.ERDAssignment") [static]


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

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