. It resolves the keys with the help of the rule system.
Many of the keys mentioned in the class are defined as constants in the D2WModel class.
D2WContext also provides two methods for accessing key paths such as entity.name.
These are valueForKeyPath
and takeValueForKeyPath
. When you use the d2wContext
key
in a Direct to Web template's bindings (.wod) file, you indirectly use one of these methods.
For a list of the keys implemented by the D2WContext, see Direct To Web Context Keys.
The D2WContext class also provides convenience methods to access keys in Java.
NULL_VALUE
public static final Object NULL_VALUE
- This constant is intentionally undocumented.
VALUE_TO_BE_DERIVED
public static final Object VALUE_TO_BE_DERIVED
- This constant is intentionally undocumented.
D2WContext
public D2WContext()
- Standard no-argument constructions. Invokes the session argument constructor with a null session.
D2WContext
public D2WContext(WOSession session)
- Creates a new instance of a context.
The following keys are given null values: D2WModel.TaskKey, D2WModel.EntityKey,
and D2WModel.PropertyKeyKey. Also, sets the key D2WModel.SessionKey to the session passed as the argument.
- Parameters:
session
- object set as the value to the key D2WModel.SessionKey. This way you can access the current session.
D2WContext
public D2WContext(D2WContext parentContext)
- Creates a new instance with the values of
parentContext
.
The new instance is initialized with the key-value pairs in parentContext
.
- Parameters:
parentContext
- a context to copy initial values from.
attribute
public EOAttribute attribute()
- Returns the EOAttribute object for the current property
- Returns:
- an EOAttribute for the current property and entity
attribute
protected EOAttribute attribute(String propertyKey)
- This is an intentionally undocumented private use method.
clearDerivedValues
public void clearDerivedValues()
- This is an intentionally undocumented private use method.
componentClassPresentInRuntime
public boolean componentClassPresentInRuntime(String componentClassName)
- This is an intentionally undocumented private use method.
componentName
public String componentName()
- Returns the name of the property-level component to display based on the current property..
This value is resolved using the rule system.
- Returns:
- component name to be used given current settings in context
componentsAvailable
public Vector componentsAvailable()
- This is an intentionally undocumented private use method.
computeDerivedValues
public void computeDerivedValues()
- This is an intentionally undocumented private use method.
displayNameForProperty
public String displayNameForProperty()
- Returns a String containing a user-presentable name for the current property.
This value is resolved using the rule system.
- Returns:
- the value for the key D2WModel.DisplayNameForPropertyKey
distantAttribute
public EOAttribute distantAttribute(String propertyKey,
EOEntity entity)
- This is an intentionally undocumented private use method.
distantRelationship
public EORelationship distantRelationship(String propertyKey,
EOEntity entity)
- This is an intentionally undocumented private use method.
dynamicPage
public String dynamicPage()
- Returns the value of the current named configuration
entity
public EOEntity entity()
- Returns the setting for the current entity.
- Returns:
- the current value for the key D2WModel.EntityKey
frame
public boolean frame()
- This is an intentionally undocumented private use method.
handleQueryWithUnboundKey
public Object handleQueryWithUnboundKey(String key)
- This is an intentionally undocumented private use method.
- Specified by:
handleQueryWithUnboundKey
in interface NSKeyValueCoding.ErrorHandling
- Following copied from interface:
com.webobjects.foundation.NSKeyValueCoding.ErrorHandling
- Parameters:
key
- the property name which generated this error- Returns:
- any Object or
null
that the custom implementation desires. The default implementation throws an exception instead. - Throws:
NSKeyValueCoding.UnknownKeyException
- when it finds no
property binding for key- See Also:
NSKeyValueCoding.valueForKey(java.lang.String)
,
NSKeyValueCoding.UnknownKeyException
,
NSKeyValueCoding.DefaultImplementation
handleTakeValueForUnboundKey
public void handleTakeValueForUnboundKey(Object value,
String key)
- This is an intentionally undocumented private use method.
- Specified by:
handleTakeValueForUnboundKey
in interface NSKeyValueCoding.ErrorHandling
- Following copied from interface:
com.webobjects.foundation.NSKeyValueCoding.ErrorHandling
- Parameters:
value
- the new value which could not be setkey
- the name of the property which generated this error- Throws:
NSKeyValueCoding.UnknownKeyException
- when it finds
no property binding for key- See Also:
NSKeyValueCoding.takeValueForKey(java.lang.Object, java.lang.String)
,
NSKeyValueCoding.UnknownKeyException
,
NSKeyValueCoding.DefaultImplementation
inferAllPossibleValuesForKey
public Vector inferAllPossibleValuesForKey(String key)
- This is an intentionally undocumented private use method.
inferSystemValueForKey
public Object inferSystemValueForKey(String key)
- This is an intentionally undocumented private use method.
inferValueForKey
public Object inferValueForKey(String key)
- Forces the use of the Rule System to get the value of
key
.
- Parameters:
key
- key to get value of- Returns:
- Object value of key derived using rules
isGenerating
public boolean isGenerating()
- This is an intentionally undocumented private use method.
keyWhenRelationship
public String keyWhenRelationship()
- When the current property is a relationship, returns the key for a
property of the destination entity that identifies the entity. For example,
if the receiver's current entity is Movie and the current property is the
toStudio
relationship (and thus the destination entity is Studio), an appropriate value for
keyWhenRelationship
is name since the name property identifies the studio.
model
public D2WModel model()
- Returns model being used by context to derive values.
This is normally the default model.
- Returns:
- the model used by this context
nullOutDerivedValues
public void nullOutDerivedValues()
- This is an intentionally undocumented private use method.
pageName
public String pageName()
- Returns the name of the Direct to Web template based on the current task and entity.
This value is resolved using the rule system.
- Returns:
- page name to be used given current settings in context
pagesAvailable
public Vector pagesAvailable()
- This is an intentionally undocumented private use method.
propertyKey
public String propertyKey()
- Returns the value of the current property.
- Returns:
- the value of the key D2WModel.PropertyKeyKey
propertyKeyIsKeyPath
public boolean propertyKeyIsKeyPath()
- Returns true if the current property key is a key path.
Calls propertyKey() and if its a keypath (includes a dot) returns true.
- Returns:
- true if propertyKey is a keypath (ex. department.name)
propertyType
public int propertyType()
- This is an intentionally undocumented private use method.
propertyTypeForUnknownKeyPath
public static String propertyTypeForUnknownKeyPath(String keyPath,
EOEntity entity)
- This is an intentionally undocumented private use method.
rawPageName
public String rawPageName()
- This is an intentionally undocumented private use method.
rawSystemPageName
public String rawSystemPageName()
- This is an intentionally undocumented private use method.
relationship
public EORelationship relationship()
- Returns the relationship object for the current property.
- Returns:
- the EORelationship object for the current property, or null if current property is not a relationship
relationship
protected EORelationship relationship(String propertyKey)
- This is an intentionally undocumented private use method.
sessionDidTimeOut
public void sessionDidTimeOut(NSNotification notification)
- This is an intentionally undocumented private use method.
setDynamicPage
public void setDynamicPage(String newValue)
- Sets the value of the current named configuration
- Parameters:
newValue
- name for the named Configuration
setEntity
public void setEntity(EOEntity newValue)
- Sets the value of the current entity.
Stores newValue under the key D2WModel.EntityKey.
- Parameters:
newValue
- value of the current entity.
setPropertyKey
public void setPropertyKey(String newValue)
- Sets the value of the current property.
Stores newValue under the key D2WModel.PropertyKeyKey.
- Parameters:
newValue
- string name of the current property.
setTask
public void setTask(String newValue)
- Sets the value of the current task.
Stores
newValue
under the key D2WModel.TaskKey.
- Parameters:
newValue
- string value of the current task.
startupEntityName
public String startupEntityName()
- This is an intentionally undocumented private use method.
startupTask
public String startupTask()
- Returns the setting for the start up task.
Returns a String containing the name of the application's startup page
task ("queryAll" by default). The startup page is the page created by D2W
defaultPage
method and is the first page displayed after the
user logs into an application. A user can change this start up page by adding
a rule that overrides the default value of startupTask
.
- Returns:
- value for the key D2WModel.StartupTaskKey
storedValueForKey
public Object storedValueForKey(String key)
- This is an intentionally undocumented private use method.
- Specified by:
storedValueForKey
in interface EOKeyValueCoding
- Following copied from interface:
com.webobjects.eocontrol.EOKeyValueCoding
- Parameters:
key
- the property of the object- Returns:
- the stored property identified by
key
- See Also:
NSKeyValueCoding
,
NSKeyValueCoding.ErrorHandling
,
NSKeyValueCoding.valueForKey(String)
,
NSKeyValueCoding.ErrorHandling.handleQueryWithUnboundKey(String)
takeStoredValueForKey
public void takeStoredValueForKey(Object value,
String key)
- This is an intentionally undocumented private use method.
- Specified by:
takeStoredValueForKey
in interface EOKeyValueCoding
- Following copied from interface:
com.webobjects.eocontrol.EOKeyValueCoding
- Parameters:
value
- the value to store in the receiverkey
- the property of the object- See Also:
NSKeyValueCoding
,
NSKeyValueCoding.ErrorHandling
,
NSKeyValueCoding.takeValueForKey(Object, String)
,
NSKeyValueCoding.ErrorHandling.handleTakeValueForUnboundKey(Object, String)
takeValueForInferrableKey
public void takeValueForInferrableKey(Object newValue,
String key)
- This is an intentionally undocumented private use method.
takeValueForKey
public void takeValueForKey(Object newValue,
String key)
- Sets the value of key to
newValue
in the local cache.
- Specified by:
takeValueForKey
in interface NSKeyValueCoding
- Parameters:
key
- key under which newValue
is storednewValue
- value of key
takeValueForKeyPath
public void takeValueForKeyPath(Object value,
String keyPath)
- Sets the value of key path to value in the local cache.
- Specified by:
takeValueForKeyPath
in interface NSKeyValueCodingAdditions
- Parameters:
keyPath
- key path under which value is storedvalue
- value of key
takeValuesFromDictionary
public void takeValuesFromDictionary(NSDictionary dict)
- This is an intentionally undocumented private use method.
- Specified by:
takeValuesFromDictionary
in interface EOKeyValueCodingAdditions
- Following copied from interface:
com.webobjects.eocontrol.EOKeyValueCodingAdditions
- Parameters:
dictionary
- the key-value pairs to be set- See Also:
NSKeyValueCoding.takeValueForKey(Object, String)
task
public String task()
- Returns the setting for the current task.
- Returns:
- the current value for the key D2WModel.TaskKey
toString
public String toString()
- This is an intentionally undocumented private use method.
- Overrides:
toString
in class Object
unableToSetNullForKey
public void unableToSetNullForKey(String key)
- This is an intentionally undocumented private use method.
- Specified by:
unableToSetNullForKey
in interface NSKeyValueCoding.ErrorHandling
- Following copied from interface:
com.webobjects.foundation.NSKeyValueCoding.ErrorHandling
- Parameters:
key
- the name of the property which generated this error- Throws:
IllegalArgumentException
- when it is given a null value
for a scalar property- See Also:
NSKeyValueCoding.takeValueForKey(Object value, String key)
,
NSKeyValueCoding.DefaultImplementation
valueForKey
public Object valueForKey(String key)
- Returns the value of 'key' using the Rule System.
Returns the receiver's value (an Object) for key. This method may resolve
the key using the rule system.
- Specified by:
valueForKey
in interface NSKeyValueCoding
- Parameters:
key
- key the user is requesting a value for- Returns:
- the value of key in the local cache
valueForKeyNoInference
public Object valueForKeyNoInference(String key)
- Returns the value of 'key' without using the Rule System.
Looks up the value for 'key' in the context's local cache.
If the value isn't there, null is returned. The Rule System does
not play a role in deriving the value.
- Returns:
- the local value for key
valueForKeyPath
public Object valueForKeyPath(String keyPath)
- Returns the inferred value of
keyPath
.
This method works similarly to valueForKey
except that you can pass a key path such as entity.name.
- Specified by:
valueForKeyPath
in interface NSKeyValueCodingAdditions
- Parameters:
keyPath
- key path to resolve- Returns:
- value of keyPath in context, possibly using Rule System to resolve
valueForKeyPathNoInference
public Object valueForKeyPathNoInference(String keyPath)
- Returns the value of 'keyPath' using the Rule System.
Returns the receiver's value (an Object) for
keyPath
.
This method may resolve the key path using the rule system.
- Parameters:
keyPath
- key path the user is requesting a value for- Returns:
- the value of keyPath in the local cache
valuesForKeys
public NSDictionary valuesForKeys(NSArray keys)
- This is an intentionally undocumented private use method.
- Specified by:
valuesForKeys
in interface EOKeyValueCodingAdditions
- Following copied from interface:
com.webobjects.eocontrol.EOKeyValueCodingAdditions
- Parameters:
keys
- the array of keys whose values are to be retrieved- Returns:
- a dictionary containing the property values identified by each of keys
- See Also:
NSKeyValueCoding.valueForKey(String)
Copyright © 2002 Apple Computer, Inc.