wt.adapter
Class BasicWebjectDelegate

java.lang.Object
  extended bywt.adapter.WebjectConstants
      extended bywt.adapter.BasicWebjectDelegate
All Implemented Interfaces:
Externalizable, Serializable, WebjectDelegate
Direct Known Subclasses:
AddContentItemsWebjectDelegate, AttributeDisplayNameWebjectDelegate, BasicPrincipalWebjectDelegate, CheckInWTObjectsWebjectDelegate, CheckOutWTObjectsWebjectDelegate, CopyLinkWebjectDelegate, CreateLinksWebjectDelegate, CreatePrincipalsWebjectDelegate, CreateWTObjectsWebjectDelegate, DeleteObjectsWebjectDelegate, DeletePrincipalsWebjectDelegate, DescribeAttributesWebjectDelegate, EmitEventWebjectDelegate, EnumeratedTypeValueSet, GenerateReportWebjectDelegate, GetContentItemsWebjectDelegate, GetProperties, ListContentItemsWebjectDelegate, ListFolderContentsWebjectDelegate, PurgeCache, QueryLinksWebjectDelegate, QueryMaster, QueryObjects, QueryPrincipalsWebjectDelegate, RelatedObjects, StartWorkflowWebjectDelegate, SubscribeObjectsWebjectDelegate, UnsubscribeObjectsWebjectDelegate, UpdatePrincipalsWebjectDelegate, UpdateWTObjectsWebjectDelegate, ValidateUser, WebjectDelegateTemplate

public abstract class BasicWebjectDelegate
extends WebjectConstants
implements WebjectDelegate, Externalizable

A repository for convenience methods which are useful in many webjects. This class is abstract because it does not implement the required invoke method. It is intended that concrete WebjectDelegates extend this class and implement the invoke method, making use of the convenience methods contained in this class.

Supported API: false

Extendable: false

See Also:
Serialized Form

Field Summary
static String ATTRIBUTE
           
private static AttributeHelper attributeHelper
           
static String CLASS
           
static String CLASS_ID
           
private static String CLASSNAME
           
private static boolean ENCODE_ATTRIBUTE_NAMES
           
static long EXTERNALIZATION_VERSION_UID
           
static String FIELD
           
static String GROUP_OUT
           
private static String IBARESOURCE
           
static String IDENTITY
           
private static String LOCAL_DOMAIN
           
private static String LOCAL_GUID
           
static String OBJECT_ID
           
protected static long OLD_FORMAT_VERSION_UID
           
private static ReferenceFactory referenceFactory
           
private static String RESOURCE
           
(package private) static long serialVersionUID
           
private static boolean VERBOSE
           
static String WHERE
           
 
Fields inherited from class wt.adapter.WebjectConstants
FAILURE, MESSAGE, OBJECT, OUTPUT, STATUS, SUCCESS
 
Constructor Summary
BasicWebjectDelegate()
           
 
Method Summary
protected  void addAttributeToNode(Element node, String attributeName, int value)
          Add the specified name/value pair as an attribute to a node.
 void addAttributeToNode(Element node, String attributeName, String value)
          Add the specified name/value pair as an attribute to the node.
protected  Object assignValues(Object object, Hashtable values, Locale locale)
          Assign the values contained in the Hashtable to the object.
protected  Object assignValues(Object object, Hashtable values, Locale locale, Properties props)
          Assign the values contained in the Hashtable to the object.
protected  Enumeration checkInObjects(Enumeration objects)
          This method will checkin each object in the set which is checked out.
protected  Enumeration checkOutObjects(Enumeration objects)
          This method will checkout each object in the set requiring checkout to be updated.
protected  Group createGroup(Enumeration results, String[] outputAttributeNames, Locale locale)
          Create a Group containing all the incoming objects.
protected  Group createGroup(Enumeration results, String[] outputAttributeNames, Locale locale, Properties props)
          Create a Group containing all the incoming objects.
protected  Group createGroup(Object object, String[] outputAttributeNames, Locale locale)
          Create a Group for one object.
protected  Group createGroup(Object object, String[] outputAttributeNames, Locale locale, Properties props)
          Create a Group for one object.
protected  Element createNode(Object obj, String[] outputAttributeNames, Locale locale)
          Create a node for the specified object containing the requested attributes.
protected  Element createNode(Object obj, String[] outputAttributeNames, Locale locale, Properties props)
          Create a node for the specified object containing the requested attributes.
protected  Element createNode(Object obj, String[] outputAttributeNames, Locale locale, Properties props, boolean fresh)
          Create a node for the specified object containing the requested attributes.
protected  Object createObject(String className, Hashtable values, Locale locale)
          Create an instance of the specified class, using the values in the Hashtable to initialize the attributes for the instance.
protected  Object createObject(String className, Hashtable values, Locale locale, Properties props)
          Create an instance of the specified class, using the values in the Hashtable to initialize the attributes for the instance.
protected  Group createOutputGroup()
          

Supported API: false
protected  void debug(String message)
          Output the specified message to the system console if the system property in wt..properties wt.adapter.verboseWebject=true.
protected  String[] getAllAttributeNames(String className)
          

Supported API: false
protected  AttributeHelper getAttributeHelper()
          

Supported API: false
static String getLocalDomain()
          

Supported API: false
protected  Locale getLocale(Webject webject)
          Return an appropriate Locale object, using the information in the ACCEPT-LANGUAGE parameter in the incoming webject.
static String getLocalGuid()
          

Supported API: false
private static void getLocalRepository()
           
protected  Persistable getObject(String obid)
          Use the specified object reference string to instantiate a wt.fc.Persistable object.
static Persistable getObjectByUfid(String obid)
          

Supported API: false
 String getObjectPropertyValueString(Object object, String attributeName, Locale locale)
          Return a string representation of the value for the specified attribute for the object.
 String getObjectPropertyValueString(Object object, String attributeName, Locale locale, Properties props)
          Return a string representation of the value for the specified attribute for the object.
static WTReference getObjectRefByUfid(String obid)
          

Supported API: false
protected  Enumeration getObjects(String className, String whereClause, Locale locale)
          Return all the objects matching the specified critieria in the whereClause parameter.
 String[] getProperties(Webject webject, String attributeName)
          Return an array of String values for the specified parameter from the webject.
 String getProperty(Webject webject, String attributeName)
          Return the String value of the specified parameter from the webject.
protected  ReferenceFactory getReferenceFactory()
          Return an instance of a wt.fc.ReferenceFactory.
static String getUfid(Persistable obj)
          

Supported API: false
static String getUfid(WTReference ref)
          

Supported API: false
static boolean isObjectLocal(String obid)
          

Supported API: false
protected  Hashtable parseFields(Webject webject)
          Parse an incoming "Field' parameter for a Webject, returning a Hashtable containing the name/value pairs.
 Hashtable parseWhere(String whereClause)
          Parse the string into a Hashtable containing name/value pairs.
 void readExternal(ObjectInput input)
          Reads the non-transient fields of this class from an external source.
private  boolean readOldVersion(ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source, which is not the current version.
protected  boolean readVersion(BasicWebjectDelegate thisObject, ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source.
protected static String removeQuotes(String s)
           
 void writeExternal(ObjectOutput output)
          Writes the non-transient fields of this class to an external source.
 
Methods inherited from class wt.adapter.WebjectConstants
readVersion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface wt.adapter.WebjectDelegate
invoke
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

EXTERNALIZATION_VERSION_UID

public static final long EXTERNALIZATION_VERSION_UID
See Also:
Constant Field Values

OLD_FORMAT_VERSION_UID

protected static final long OLD_FORMAT_VERSION_UID
See Also:
Constant Field Values

IBARESOURCE

private static final String IBARESOURCE
See Also:
Constant Field Values

VERBOSE

private static boolean VERBOSE

ENCODE_ATTRIBUTE_NAMES

private static boolean ENCODE_ATTRIBUTE_NAMES

LOCAL_DOMAIN

private static String LOCAL_DOMAIN

LOCAL_GUID

private static String LOCAL_GUID

referenceFactory

private static ReferenceFactory referenceFactory

attributeHelper

private static AttributeHelper attributeHelper

CLASS_ID

public static final String CLASS_ID
See Also:
Constant Field Values

IDENTITY

public static final String IDENTITY
See Also:
Constant Field Values

OBJECT_ID

public static final String OBJECT_ID
See Also:
Constant Field Values

ATTRIBUTE

public static final String ATTRIBUTE
See Also:
Constant Field Values

CLASS

public static final String CLASS
See Also:
Constant Field Values

FIELD

public static final String FIELD
See Also:
Constant Field Values

GROUP_OUT

public static final String GROUP_OUT
See Also:
Constant Field Values

WHERE

public static final String WHERE
See Also:
Constant Field Values
Constructor Detail

BasicWebjectDelegate

public BasicWebjectDelegate()
Method Detail

writeExternal

public void writeExternal(ObjectOutput output)
                   throws IOException
Writes the non-transient fields of this class to an external source.

Supported API: false

Specified by:
writeExternal in interface Externalizable
Overrides:
writeExternal in class WebjectConstants
Parameters:
output -
Throws:
IOException

readExternal

public void readExternal(ObjectInput input)
                  throws IOException,
                         ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Specified by:
readExternal in interface Externalizable
Overrides:
readExternal in class WebjectConstants
Parameters:
input -
Throws:
IOException
ClassNotFoundException

readVersion

protected boolean readVersion(BasicWebjectDelegate thisObject,
                              ObjectInput input,
                              long readSerialVersionUID,
                              boolean passThrough,
                              boolean superDone)
                       throws IOException,
                              ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Parameters:
thisObject -
input -
readSerialVersionUID -
passThrough -
superDone -
Returns:
boolean
Throws:
IOException
ClassNotFoundException

readOldVersion

private boolean readOldVersion(ObjectInput input,
                               long readSerialVersionUID,
                               boolean passThrough,
                               boolean superDone)
                        throws IOException,
                               ClassNotFoundException
Reads the non-transient fields of this class from an external source, which is not the current version.

Parameters:
input -
readSerialVersionUID -
passThrough -
superDone -
Returns:
boolean
Throws:
IOException
ClassNotFoundException

getProperty

public String getProperty(Webject webject,
                          String attributeName)
Return the String value of the specified parameter from the webject.

Supported API: false

Parameters:
webject -
attributeName -
Returns:
String

getProperties

public String[] getProperties(Webject webject,
                              String attributeName)
Return an array of String values for the specified parameter from the webject.

Supported API: false

Parameters:
webject -
attributeName -
Returns:
String[]

addAttributeToNode

public void addAttributeToNode(Element node,
                               String attributeName,
                               String value)
Add the specified name/value pair as an attribute to the node.

Supported API: false

Parameters:
node -
attributeName -
value -

getObjectPropertyValueString

public String getObjectPropertyValueString(Object object,
                                           String attributeName,
                                           Locale locale)
                                    throws WTException,
                                           WTIntrospectionException
Return a string representation of the value for the specified attribute for the object. This method makes use of the wt.adapter.attribute.AttributeHelper class and other classes in the wt.adapter.attribute package.

Supported API: false

Parameters:
object -
attributeName -
locale -
Returns:
String
Throws:
WTException
WTIntrospectionException
See Also:
AttributeHelper

getObjectPropertyValueString

public String getObjectPropertyValueString(Object object,
                                           String attributeName,
                                           Locale locale,
                                           Properties props)
                                    throws WTException,
                                           WTIntrospectionException
Return a string representation of the value for the specified attribute for the object. This method makes use of the wt.adapter.attribute.AttributeHelper class and other classes in the wt.adapter.attribute package.

Supported API: false

Parameters:
object -
attributeName -
locale -
props -
Returns:
String
Throws:
WTException
WTIntrospectionException
See Also:
AttributeHelper

parseWhere

public Hashtable parseWhere(String whereClause)
                     throws WebjectServiceException
Parse the string into a Hashtable containing name/value pairs. Useful for parsing incoming "where" clauses.

Supported API: false

Parameters:
whereClause -
Returns:
Hashtable
Throws:
WebjectServiceException

createNode

protected Element createNode(Object obj,
                             String[] outputAttributeNames,
                             Locale locale)
                      throws WTException
Create a node for the specified object containing the requested attributes.

Supported API: false

Parameters:
obj -
outputAttributeNames -
locale -
Returns:
Element
Throws:
WTException

createNode

protected Element createNode(Object obj,
                             String[] outputAttributeNames,
                             Locale locale,
                             Properties props)
                      throws WTException
Create a node for the specified object containing the requested attributes.

Supported API: false

Parameters:
obj -
outputAttributeNames -
locale -
props -
Returns:
Element
Throws:
WTException

createGroup

protected Group createGroup(Enumeration results,
                            String[] outputAttributeNames,
                            Locale locale)
                     throws WTException
Create a Group containing all the incoming objects. There will be one node in each group, each node will contain values for all request attributes.

Supported API: false

Parameters:
results -
outputAttributeNames -
locale -
Returns:
Group
Throws:
WTException

createGroup

protected Group createGroup(Enumeration results,
                            String[] outputAttributeNames,
                            Locale locale,
                            Properties props)
                     throws WTException
Create a Group containing all the incoming objects. There will be one node in each group, each node will contain values for all request attributes.

Supported API: false

Parameters:
results -
outputAttributeNames -
locale -
props -
Returns:
Group
Throws:
WTException

createGroup

protected Group createGroup(Object object,
                            String[] outputAttributeNames,
                            Locale locale)
                     throws WTException
Create a Group for one object. The Group will contain one node with all the specified attributes for the object.

Supported API: false

Parameters:
object -
outputAttributeNames -
locale -
Returns:
Group
Throws:
WTException

createGroup

protected Group createGroup(Object object,
                            String[] outputAttributeNames,
                            Locale locale,
                            Properties props)
                     throws WTException
Create a Group for one object. The Group will contain one node with all the specified attributes for the object.

Supported API: false

Parameters:
object -
outputAttributeNames -
locale -
props -
Returns:
Group
Throws:
WTException

getReferenceFactory

protected ReferenceFactory getReferenceFactory()
Return an instance of a wt.fc.ReferenceFactory. The ReferenceFactory is used to obtain object reference strings for a wt.fc.Persistable object.

Supported API: false

Returns:
ReferenceFactory

parseFields

protected Hashtable parseFields(Webject webject)
Parse an incoming "Field' parameter for a Webject, returning a Hashtable containing the name/value pairs.

Supported API: false

Parameters:
webject -
Returns:
Hashtable

addAttributeToNode

protected void addAttributeToNode(Element node,
                                  String attributeName,
                                  int value)
Add the specified name/value pair as an attribute to a node.

Supported API: false

Parameters:
node -
attributeName -
value -

getObject

protected Persistable getObject(String obid)
                         throws WTException
Use the specified object reference string to instantiate a wt.fc.Persistable object.

Supported API: false

Parameters:
obid -
Returns:
Persistable
Throws:
WTException

getObjects

protected Enumeration getObjects(String className,
                                 String whereClause,
                                 Locale locale)
                          throws ClassNotFoundException,
                                 WTPropertyVetoException,
                                 WebjectServiceException,
                                 WTException
Return all the objects matching the specified critieria in the whereClause parameter.

Supported API: false

Parameters:
className -
whereClause -
locale -
Returns:
Enumeration
Throws:
ClassNotFoundException
WTPropertyVetoException
WebjectServiceException
WTException

checkOutObjects

protected Enumeration checkOutObjects(Enumeration objects)
                               throws WTException
This method will checkout each object in the set requiring checkout to be updated.

Supported API: false

Parameters:
objects -
Returns:
Enumeration
Throws:
WTException

checkInObjects

protected Enumeration checkInObjects(Enumeration objects)
                              throws WTException
This method will checkin each object in the set which is checked out.

Supported API: false

Parameters:
objects -
Returns:
Enumeration
Throws:
WTException

debug

protected void debug(String message)
Output the specified message to the system console if the system property in wt..properties wt.adapter.verboseWebject=true.

Supported API: false

Parameters:
message -

assignValues

protected Object assignValues(Object object,
                              Hashtable values,
                              Locale locale)
                       throws WTException
Assign the values contained in the Hashtable to the object. The key for each entry in the Hashtable should be the name of the attribute. This method uses the wt.adapter.attribute.AttributeHelper to perform the operation.

Supported API: false

Parameters:
object -
values -
locale -
Returns:
Object
Throws:
WTException
See Also:
AttributeHelper

assignValues

protected Object assignValues(Object object,
                              Hashtable values,
                              Locale locale,
                              Properties props)
                       throws WTException
Assign the values contained in the Hashtable to the object. The key for each entry in the Hashtable should be the name of the attribute. This method uses the wt.adapter.attribute.AttributeHelper to perform the operation.

Supported API: false

Parameters:
object -
values -
locale -
props -
Returns:
Object
Throws:
WTException
See Also:
AttributeHelper

createObject

protected Object createObject(String className,
                              Hashtable values,
                              Locale locale)
                       throws WTException
Create an instance of the specified class, using the values in the Hashtable to initialize the attributes for the instance.

Supported API: false

Parameters:
className -
values -
locale -
Returns:
Object
Throws:
WTException

createObject

protected Object createObject(String className,
                              Hashtable values,
                              Locale locale,
                              Properties props)
                       throws WTException
Create an instance of the specified class, using the values in the Hashtable to initialize the attributes for the instance.

Supported API: false

Parameters:
className -
values -
locale -
props -
Returns:
Object
Throws:
WTException

getLocale

protected Locale getLocale(Webject webject)
Return an appropriate Locale object, using the information in the ACCEPT-LANGUAGE parameter in the incoming webject.

Supported API: false

Parameters:
webject -
Returns:
Locale

getAttributeHelper

protected AttributeHelper getAttributeHelper()


Supported API: false

Returns:
AttributeHelper

getAllAttributeNames

protected String[] getAllAttributeNames(String className)
                                 throws WTException


Supported API: false

Parameters:
className -
Returns:
String[]
Throws:
WTException

createOutputGroup

protected Group createOutputGroup()


Supported API: false

Returns:
Group

getObjectRefByUfid

public static WTReference getObjectRefByUfid(String obid)
                                      throws WTException


Supported API: false

Parameters:
obid -
Returns:
WTReference
Throws:
WTException

getObjectByUfid

public static Persistable getObjectByUfid(String obid)
                                   throws WTException


Supported API: false

Parameters:
obid -
Returns:
Persistable
Throws:
WTException

isObjectLocal

public static boolean isObjectLocal(String obid)
                             throws WTException


Supported API: false

Parameters:
obid -
Returns:
boolean
Throws:
WTException

getUfid

public static String getUfid(Persistable obj)
                      throws WTException


Supported API: false

Parameters:
obj -
Returns:
String
Throws:
WTException

getUfid

public static String getUfid(WTReference ref)
                      throws WTException


Supported API: false

Parameters:
ref -
Returns:
String
Throws:
WTException

getLocalDomain

public static String getLocalDomain()
                             throws WTException


Supported API: false

Returns:
String
Throws:
WTException

getLocalGuid

public static String getLocalGuid()
                           throws WTException


Supported API: false

Returns:
String
Throws:
WTException

removeQuotes

protected static String removeQuotes(String s)

getLocalRepository

private static void getLocalRepository()
                                throws WTException
Throws:
WTException

createNode

protected Element createNode(Object obj,
                             String[] outputAttributeNames,
                             Locale locale,
                             Properties props,
                             boolean fresh)
                      throws WTException
Create a node for the specified object containing the requested attributes.

Supported API: false

Parameters:
obj - The object from which to create the I*E node.
outputAttributeNames - The names of the attributes to copy from the object to the I*E node.
locale - The caller's locale.
props - Properties affecting attribute value rendering.
fresh - true if the object is an IBAHolder and its attribute container has been refreshed already by the caller.
Returns:
The I*E node
Throws:
WTException