Project Wonder 2.0

er.extensions
Class ERXDirectActionHyperlink

java.lang.Object
  extended bycom.webobjects.appserver.WOElement
      extended bycom.webobjects.appserver.WOComponent
          extended byer.extensions.ERXNonSynchronizingComponent
              extended byer.extensions.ERXStatelessComponent
                  extended byer.extensions.ERXDirectActionHyperlink
All Implemented Interfaces:
Cloneable, NSKeyValueCoding, NSKeyValueCoding.ErrorHandling, NSKeyValueCodingAdditions, NSValidation, Serializable, WOActionResults
Direct Known Subclasses:
ERXDirectActionImage

public class ERXDirectActionHyperlink
extends ERXStatelessComponent

This component can be used for two things:
1) Generating direct action urls for use in components that are being e-mailed to people. 2) Support for encoding enterprise objects in the form values of generated urls. At the moment this component still contains some custy code that needs to be cleaned up before it can really be used, like adding the .wo and .api files ;0.

Synopsis:
[actionClass=anActionClass];directActionName=aDirectActionName;[entityNameSeparator=aSeparator;] [relative=aBoolean;][shouldEncryptObjectFormValues=aBoolean;][objectsForFormValues=anArray;] [bindingDictionary=aDictionary;][unencryptedBindingDictionary=aDictionary;]

See Also:
Serialized Form
Bindings
actionClass direct action class to be used
           
directActionName direct action name
           
entityNameSeparator separator used when constructiong urls with encoded enterprise objects
           
relative generates relative or absolute url
           
shouldEncryptObjectFormValues boolean flag that tells if the primary keys of the enterprise objects should be encrypted using blowfish
           
objectForFormValue an enterprise object to be encoded in the url
           
objectsForFormValues array of enterprise objects to be encoded in the url
           
bindingDictionary adds the key-value pairs to generated url as form values, encrypting the values with blowfish.
           
unencryptedBindingDictionary adds the key-value pairs to generated url as form values
           

Nested Class Summary
 
Nested classes inherited from class com.webobjects.appserver.WOComponent
WOComponent._EventLoggingEnabler, WOComponent.Event
 
Nested classes inherited from class com.webobjects.foundation.NSKeyValueCoding
NSKeyValueCoding._BooleanFieldBinding, NSKeyValueCoding._BooleanMethodBinding, NSKeyValueCoding._FieldBinding, NSKeyValueCoding._ForwardingBinding, NSKeyValueCoding._KeyBinding, NSKeyValueCoding._KeyBindingCreation, NSKeyValueCoding._MethodBinding, NSKeyValueCoding._NumberFieldBinding, NSKeyValueCoding._NumberMethodBinding, NSKeyValueCoding._ReflectionKeyBindingCreation, NSKeyValueCoding.DefaultImplementation, NSKeyValueCoding.ErrorHandling, NSKeyValueCoding.Null, NSKeyValueCoding.UnknownKeyException, NSKeyValueCoding.Utility, NSKeyValueCoding.ValueAccessor
 
Nested classes inherited from class com.webobjects.foundation.NSKeyValueCodingAdditions
NSKeyValueCodingAdditions.DefaultImplementation, NSKeyValueCodingAdditions.Utility
 
Nested classes inherited from class com.webobjects.foundation.NSValidation
NSValidation._MethodBinding, NSValidation._ValidationBinding, NSValidation.DefaultImplementation, NSValidation.Utility, NSValidation.ValidationException
 
Field Summary
static String ADAPTOR_PREFIX_MARKER
          Key used to denote an adaptor prefix for a generated url string
static ERXLogger log
          logging support
static String SUFFIX_MARKER
          Key used to denote a suffix for a generated url string
 
Fields inherited from class er.extensions.ERXNonSynchronizingComponent
_dynamicBindings
 
Fields inherited from class com.webobjects.appserver.WOComponent
_Extension, _IsEventLoggingEnabled, _keyAssociations
 
Fields inherited from interface com.webobjects.foundation.NSKeyValueCoding
_CLASS, NullValue
 
Fields inherited from interface com.webobjects.foundation.NSKeyValueCoding.ErrorHandling
_CLASS
 
Fields inherited from interface com.webobjects.foundation.NSKeyValueCodingAdditions
_CLASS, _KeyPathSeparatorChar, KeyPathSeparator
 
Fields inherited from interface com.webobjects.foundation.NSValidation
_CLASS
 
Constructor Summary
ERXDirectActionHyperlink(WOContext aContext)
          Public constructor
 
Method Summary
 NSArray allObjectsForFormValues()
          Returns all of the objects to be encoded in the form values.
static String applicationHostUrl()
          This returns the value stored in the system properties: ERApplicationHostURL if this isn't set then a runtime exception is thrown.
static String completeURLFromString(String s, WOContext c, String applicationName, boolean relative, String suffix)
          This method is useful for completing urls that are being generated in components that are going to be e-mailed to users.
static String directActionHyperlink(WOContext context, boolean encryptEos, NSArray eos, String entityNameSeparator, NSDictionary encryptedDict, NSDictionary unencryptedDict, String appName, String daName, boolean relative, String suffix)
           
 String entityNameSeparator()
          Cover method to return the binding: entityNameSeparator The entity name separator is used when constructing URLs with enterprise objects encoded in the url.
 String href()
          Generates an href for the given direct action based on all of the bindings.
 EOEnterpriseObject objectForFormValue()
          Cover method to return the binding: objectsForFormValue This is an enterprise object to be encoded as form values.
 NSArray objectsForFormValues()
          Cover method to return the binding: objectsForFormValues This is an array of objects to be encoded as form values.
 boolean relative()
          Cover method to return the boolean value of the binding: relative Defaults to true.
 boolean shouldEncryptObjectFormValues()
          Cover method to return the boolean value of the binding: shouldEncryptObjectFormValues Defaults to false.
 
Methods inherited from class er.extensions.ERXStatelessComponent
isStateless, reset, valueForBooleanBinding, valueForBooleanBinding, valueForBooleanBinding, valueForIntBinding, valueForObjectBinding, valueForObjectBinding
 
Methods inherited from class er.extensions.ERXNonSynchronizingComponent
booleanValueForBinding, booleanValueForBinding, booleanValueForBinding, dynamicBindings, intValueForBinding, localizer, objectValueForBinding, objectValueForBinding, stringValueForBinding, stringValueForBinding, synchronizesVariablesWithBindings
 
Methods inherited from class com.webobjects.appserver.WOComponent
_associationWithName, _awakeInContext, _childTemplate, _componentDefinition, _componentUnroll, _isPage, _setContext, _setIsPage, _setParent, _setSubcomponent, _sleepInContext, _subcomponentForElementWithID, _templateNameForClass, _unroll, appendToResponse, application, awake, baseURL, bindingKeys, canAccessFieldsDirectly, canGetValueForBinding, canSetValueForBinding, clone, context, debugString, descriptionForResponse, ensureAwakeInContext, frameworkName, generateResponse, handleQueryWithUnboundKey, handleTakeValueForUnboundKey, hasBinding, hasSession, invokeAction, isCachingEnabled, isEventLoggingEnabled, logString, name, pageWithName, parent, path, pathURL, performParentAction, pullValuesFromParent, pushValuesToParent, session, set_componentUnroll, set_unroll, setCachingEnabled, setValueForBinding, sleep, takeValueForKey, takeValueForKeyPath, takeValuesFromRequest, template, templateWithHTMLString, templateWithName, toString, unableToSetNullForKey, validateTakeValueForKeyPath, validateValueForKey, validationFailedWithException, valueForBinding, valueForKey, valueForKeyPath
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

ADAPTOR_PREFIX_MARKER

public static final String ADAPTOR_PREFIX_MARKER
Key used to denote an adaptor prefix for a generated url string

See Also:
Constant Field Values

SUFFIX_MARKER

public static final String SUFFIX_MARKER
Key used to denote a suffix for a generated url string

See Also:
Constant Field Values

log

public static final ERXLogger log
logging support

Constructor Detail

ERXDirectActionHyperlink

public ERXDirectActionHyperlink(WOContext aContext)
Public constructor

Parameters:
aContext - a context
Method Detail

entityNameSeparator

public String entityNameSeparator()
Cover method to return the binding: entityNameSeparator The entity name separator is used when constructing URLs with enterprise objects encoded in the url. This value default to the value defined in the system property er.extensions.ERXDirectActionHyperlink.EntityNameSeparator which defaults as well to the character '
_
'.

Returns:
returns the value for binding: entityNameSeparator

relative

public boolean relative()
Cover method to return the boolean value of the binding: relative Defaults to true.

Returns:
returns if the generated url should be relative or not(absolute).

shouldEncryptObjectFormValues

public boolean shouldEncryptObjectFormValues()
Cover method to return the boolean value of the binding: shouldEncryptObjectFormValues Defaults to false.

Returns:
returns if the encoded objects' primary keys should be encrypted or not.

objectsForFormValues

public NSArray objectsForFormValues()
Cover method to return the binding: objectsForFormValues This is an array of objects to be encoded as form values.

Returns:
returns bound array of objects to be encoded

objectForFormValue

public EOEnterpriseObject objectForFormValue()
Cover method to return the binding: objectsForFormValue This is an enterprise object to be encoded as form values.

Returns:
returns bound enterprise object to be encoded

allObjectsForFormValues

public NSArray allObjectsForFormValues()
Returns all of the objects to be encoded in the form values. Collects those bound to both 'objectsForFormValues' and 'objectForFormValue' into a single array.

Returns:
complete collection of objects to be encoded in form values.

href

public String href()
Generates an href for the given direct action based on all of the bindings. Currently it generates an absolute url starting with the key: ADAPTOR_PREFIX_MARKER. Before this href can be really useful it needs to be cleaned up.

Returns:
href containing all of the specification from the bindings.

applicationHostUrl

public static String applicationHostUrl()
This returns the value stored in the system properties: ERApplicationHostURL if this isn't set then a runtime exception is thrown. This property should be of the form: http://mymachine.com

Returns:
the application host url that should be used when complete urls are generated.

directActionHyperlink

public static String directActionHyperlink(WOContext context,
                                           boolean encryptEos,
                                           NSArray eos,
                                           String entityNameSeparator,
                                           NSDictionary encryptedDict,
                                           NSDictionary unencryptedDict,
                                           String appName,
                                           String daName,
                                           boolean relative,
                                           String suffix)

completeURLFromString

public static String completeURLFromString(String s,
                                           WOContext c,
                                           String applicationName,
                                           boolean relative,
                                           String suffix)
This method is useful for completing urls that are being generated in components that are going to be e-mailed to users. This method has the ability to substitute different application names which can be helpful if one application is generating the component, but the action of the url points to a different application on the same host.

Parameters:
s - href string to be completed
c - current context
applicationName - to be substituted if ADAPTOR_PREFIX_MARKER is present
relative - flag to indicate if the generated url should be relative or absolute in which case the applicationHostUrl will be used
suffix - string to be substitued if the SUFFIX_MARKER string is present
Returns:
complete url after substitutions have been made

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

Copyright © 2002 – 2004 Project Wonder.