WebObjects 5.2.3

com.webobjects.directtoweb
Class D2WContext

java.lang.Object
  extended bycom.webobjects.directtoweb.D2WContext
All Implemented Interfaces:
EOKeyValueCoding, EOKeyValueCodingAdditions, NSKeyValueCoding, NSKeyValueCoding.ErrorHandling, NSKeyValueCodingAdditions

public class D2WContext
extends Object
implements EOKeyValueCodingAdditions

Direct to Web contexts are objects of the D2WContext class. When a Direct to Web template renders, it does so with the help of a Direct to Web context which provides values for bindings in the template and maintains state information about the rendering process. See the "Direct to Web Architecture" chapter of Developing WebObjects Applications With Direct to Web for more information about the Direct to Web context.

The primary function of the Direct to Web context is to implement the EOKeyValueCoding interface (defined in the EOControl framework) by implementing valueForKey and takeValueForKey. 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.


Nested Class Summary
 
Nested classes inherited from class com.webobjects.eocontrol.EOKeyValueCodingAdditions
EOKeyValueCodingAdditions.DefaultImplementation, EOKeyValueCodingAdditions.Utility
 
Nested classes inherited from class com.webobjects.foundation.NSKeyValueCoding
NSKeyValueCoding.ErrorHandling, NSKeyValueCoding.Null, NSKeyValueCoding.UnknownKeyException, NSKeyValueCoding.ValueAccessor
 
Field Summary
static Object NULL_VALUE
          This constant is intentionally undocumented.
static Object VALUE_TO_BE_DERIVED
          This constant is intentionally undocumented.
 
Fields inherited from interface com.webobjects.foundation.NSKeyValueCodingAdditions
KeyPathSeparator
 
Fields inherited from interface com.webobjects.foundation.NSKeyValueCoding
NullValue
 
Constructor Summary
D2WContext()
          Standard no-argument constructions.
D2WContext(D2WContext parentContext)
          Creates a new instance with the values of parentContext.
D2WContext(WOSession session)
          Creates a new instance of a context.
 
Method Summary
 EOAttribute attribute()
          Returns the EOAttribute object for the current property
protected  EOAttribute attribute(String propertyKey)
          This is an intentionally undocumented private use method.
protected  EOAttribute attributeForProperty(String propertyKey)
          This is an intentionally undocumented private use method.
 void clearDerivedValues()
          This is an intentionally undocumented private use method.
 boolean componentClassPresentInRuntime(String componentClassName)
          This is an intentionally undocumented private use method.
 String componentName()
          Returns the name of the property-level component to display based on the current property..
 Vector componentsAvailable()
          This is an intentionally undocumented private use method.
 void computeDerivedValues()
          This is an intentionally undocumented private use method.
 String displayNameForProperty()
          Returns a String containing a user-presentable name for the current property.
 EOAttribute distantAttribute(String propertyKey, EOEntity entity)
          This is an intentionally undocumented private use method.
 EORelationship distantRelationship(String propertyKey, EOEntity entity)
          This is an intentionally undocumented private use method.
 String dynamicPage()
          Returns the value of the current named configuration
 EOEntity entity()
          Returns the setting for the current entity.
 boolean frame()
          This is an intentionally undocumented private use method.
 Object handleQueryWithUnboundKey(String key)
          This is an intentionally undocumented private use method.
 void handleTakeValueForUnboundKey(Object value, String key)
          This is an intentionally undocumented private use method.
 Vector inferAllPossibleValuesForKey(String key)
          This is an intentionally undocumented private use method.
 Object inferSystemValueForKey(String key)
          This is an intentionally undocumented private use method.
 Object inferValueForKey(String key)
          Forces the use of the Rule System to get the value of key.
 boolean isGenerating()
          This is an intentionally undocumented private use method.
 String keyWhenRelationship()
          When the current property is a relationship, returns the key for a property of the destination entity that identifies the entity.
 D2WModel model()
          Returns model being used by context to derive values.
 void nullOutDerivedValues()
          This is an intentionally undocumented private use method.
 String pageName()
          Returns the name of the Direct to Web template based on the current task and entity.
 Vector pagesAvailable()
          This is an intentionally undocumented private use method.
 String propertyKey()
          Returns the value of the current property.
 boolean propertyKeyIsKeyPath()
          Returns true if the current property key is a key path.
 int propertyType()
          This is an intentionally undocumented private use method.
static String propertyTypeForUnknownKeyPath(String keyPath, EOEntity entity)
          This is an intentionally undocumented private use method.
 String rawPageName()
          This is an intentionally undocumented private use method.
 String rawSystemPageName()
          This is an intentionally undocumented private use method.
 EORelationship relationship()
          Returns the relationship object for the current property.
protected  EORelationship relationship(String propertyKey)
          This is an intentionally undocumented private use method.
protected  EORelationship relationshipForProperty(String propertyKey)
          This is an intentionally undocumented private use method.
 void sessionDidTimeOut(NSNotification notification)
          This is an intentionally undocumented private use method.
 void setDynamicPage(String newValue)
          Sets the value of the current named configuration
 void setEntity(EOEntity newValue)
          Sets the value of the current entity.
 void setPropertyKey(String newValue)
          Sets the value of the current property.
 void setTask(String newValue)
          Sets the value of the current task.
 String startupEntityName()
          This is an intentionally undocumented private use method.
 String startupTask()
          Returns the setting for the start up task.
 Object storedValueForKey(String key)
          This is an intentionally undocumented private use method.
 void takeStoredValueForKey(Object value, String key)
          This is an intentionally undocumented private use method.
 void takeValueForInferrableKey(Object newValue, String key)
          This is an intentionally undocumented private use method.
 void takeValueForKey(Object newValue, String key)
          Sets the value of key to newValue in the local cache.
 void takeValueForKeyPath(Object value, String keyPath)
          Sets the value of key path to value in the local cache.
 void takeValuesFromDictionary(NSDictionary dict)
          This is an intentionally undocumented private use method.
 void takeValuesFromDictionaryWithMapping(NSDictionary dictionary, NSDictionary mapping)
          This is an intentionally undocumented private use method.
 String task()
          Returns the setting for the current task.
 String toString()
          This is an intentionally undocumented private use method.
 void unableToSetNullForKey(String key)
          This is an intentionally undocumented private use method.
 Object valueForKey(String key)
          Returns the value of 'key' using the Rule System.
 Object valueForKeyNoInference(String key)
          Returns the value of 'key' without using the Rule System.
 Object valueForKeyPath(String keyPath)
          Returns the inferred value of keyPath.
 Object valueForKeyPathNoInference(String keyPath)
          Returns the value of 'keyPath' using the Rule System.
 NSDictionary valuesForKeys(NSArray keys)
          This is an intentionally undocumented private use method.
 NSDictionary valuesForKeysWithMapping(NSDictionary mapping)
          This is an intentionally undocumented private use method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

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.

Constructor Detail

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.
Method Detail

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.


attributeForProperty

protected EOAttribute attributeForProperty(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
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.
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
Parameters:
value - the new value which could not be set
key - the name of the property which generated this error
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.


relationshipForProperty

protected EORelationship relationshipForProperty(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
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
Parameters:
value - the value to store in the receiver
key - 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 stored
newValue - value of key
See Also:
NSKeyValueCoding.NullValue, NSKeyValueCoding.valueForKey(java.lang.String), NSKeyValueCoding.DefaultImplementation, NSKeyValueCoding.ErrorHandling, NSKeyValueCoding.ErrorHandling.handleTakeValueForUnboundKey(java.lang.Object, java.lang.String)

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 stored
value - value of key
See Also:
NSKeyValueCoding.takeValueForKey(java.lang.Object, java.lang.String), NSKeyValueCodingAdditions.valueForKeyPath(java.lang.String), NSKeyValueCodingAdditions.DefaultImplementation

takeValuesFromDictionary

public void takeValuesFromDictionary(NSDictionary dict)
This is an intentionally undocumented private use method.

Specified by:
takeValuesFromDictionary in interface EOKeyValueCodingAdditions
Parameters:
dict - the key-value pairs to be set
See Also:
NSKeyValueCoding.takeValueForKey(Object, String)

takeValuesFromDictionaryWithMapping

public void takeValuesFromDictionaryWithMapping(NSDictionary dictionary,
                                                NSDictionary mapping)
This is an intentionally undocumented private use method.

Specified by:
takeValuesFromDictionaryWithMapping in interface EOKeyValueCodingAdditions
Parameters:
dictionary - the key-value pairs to be set
mapping - the dictionary that maps arbitrary external names to internal property names
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.


unableToSetNullForKey

public void unableToSetNullForKey(String key)
This is an intentionally undocumented private use method.

Specified by:
unableToSetNullForKey in interface NSKeyValueCoding.ErrorHandling
Parameters:
key - the name of the property which generated this error
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
See Also:
NSKeyValueCoding.NullValue, NSKeyValueCoding.takeValueForKey(java.lang.Object, java.lang.String), NSKeyValueCoding.DefaultImplementation, NSKeyValueCoding.ErrorHandling, NSKeyValueCoding.ErrorHandling.handleQueryWithUnboundKey(java.lang.String)

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
See Also:
NSKeyValueCoding.valueForKey(java.lang.String), NSKeyValueCodingAdditions.takeValueForKeyPath(java.lang.Object, java.lang.String), NSKeyValueCodingAdditions.DefaultImplementation

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
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)

valuesForKeysWithMapping

public NSDictionary valuesForKeysWithMapping(NSDictionary mapping)
This is an intentionally undocumented private use method.

Specified by:
valuesForKeysWithMapping in interface EOKeyValueCodingAdditions
Parameters:
mapping - the dictionary that maps arbitrary external names to internal property names
Returns:
a dictionary containing the property values identified by each of keys
See Also:
NSKeyValueCoding.valueForKey(String)

Last updated Thu Oct 21 15:04:16 PDT 2004.

Copyright © 2004 Apple Computer, Inc.