com.ibm.j2ca.base
Class AdapterBOUtil

java.lang.Object
  extended bycom.ibm.j2ca.base.AdapterBOUtil

public class AdapterBOUtil
extends java.lang.Object

This class provides a set of utility methods whose functionality is generally common to all adapters. This centralization helps reduce redundant code across adapters, improve uniformity for adapter behavior and, perhaps most importantly, isolate adapters from changes in the underlying WBI libraries upon which the adapter model is built (for example, the WBI BO model).


Method Summary
static commonj.sdo.DataObject copyBusinessObject(commonj.sdo.DataObject busObj)
          Performs a deep copy of a given business object.
static commonj.sdo.DataObject copyBusinessObjectShallow(commonj.sdo.DataObject busObj)
          Performs a shallow copy of a given business object.
static commonj.sdo.DataObject createBusinessObject(java.lang.String namespace, java.lang.String complexTypeName)
          Creates a new instance of a business object.
static commonj.sdo.DataObject createDataObject(java.lang.String namespace, java.lang.String complexTypeName)
          Creates a new instance of a data object.
static commonj.sdo.DataObject createDataObject(commonj.sdo.Type type)
          Creates a new instance of a data object by type.
static commonj.sdo.Property[] getChangedProperties(commonj.sdo.DataObject busObj)
          Provides a list of all properties that have been changed in a business object.
static commonj.sdo.ChangeSummary getChangeSummary(commonj.sdo.DataObject busObj)
          Returns the ChangeSummary for a given business object.
static commonj.sdo.Property[] getKeyProperties(commonj.sdo.DataObject busObj)
          Provides a list of all key properties defined for a given business object
static int getMaxLength(commonj.sdo.Property p)
          Returns the maximum length for a property as specified by 'MaxLength' for the property type definition.
static commonj.sdo.DataObject getMetadataForObject(commonj.sdo.DataObject busObj)
          Extracts the metadata embedded in the annotation of the business object complex type.
static commonj.sdo.DataObject getMetadataForOperation(commonj.sdo.DataObject busObj, java.lang.String operationName)
          Extracts the metadata embedded in the annotation of the business object operation definition.
static commonj.sdo.DataObject getMetadataForProperty(commonj.sdo.Property prop)
          Extracts the metadata embedded in the annotation of the business object property definition.
static commonj.sdo.Property getRootBusinessObjectProperty(commonj.sdo.Type businessGraphType)
          Returns the top-level business object type for a given business object graph.
static java.lang.String getTopLevelVerb(commonj.sdo.DataObject busObj)
          Returns the top-level verb for an after-image business object.
static boolean isAfterImageObject(commonj.sdo.DataObject busObj)
          Checks whether busObj is an after-image business object.
static boolean isBusinessGraph(commonj.sdo.DataObject dataObj)
           
static boolean isChildContained(commonj.sdo.Property childObjProperty)
          Checks whether a child object is contained by its parent.
static boolean isDeltaObject(commonj.sdo.DataObject busObj)
          Checks whether busObj is a delta business object.
static boolean isKeyProperty(commonj.sdo.Property p)
          Checks whether a given property is defined as a key in the business object definition.
static boolean isPropertyMarkedBlank(commonj.sdo.DataObject busObj, commonj.sdo.Property prop)
          Checks whether a property should be cleared (or was cleared) in the EIS during processing.
static boolean isPropertyMarkedIgnore(commonj.sdo.DataObject busObj, commonj.sdo.Property prop)
          Checks whether a property should be ignored during processing.
static void markAsAfterImageObject(commonj.sdo.DataObject busObj, java.lang.String verbName)
          Designates busObj as an after-image business object with a top-level verb of verbName
static void markAsDeltaObject(commonj.sdo.DataObject busObj)
          Designates busObj as a delta business object.
static java.lang.String serializeDataObject(commonj.sdo.DataObject busObj)
          Uses the BOXMLSerializer service to serialize the BO contents.
static void setTopLevelVerb(commonj.sdo.DataObject busObj, java.lang.String verbName)
          Sets the top-level verb for an after-image business object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createBusinessObject

public static commonj.sdo.DataObject createBusinessObject(java.lang.String namespace,
                                                          java.lang.String complexTypeName)
                                                   throws BusinessObjectDefinitionNotFoundException,
                                                          InvalidObjectDefinitionException
Creates a new instance of a business object. If a business graph name is passed for complexTypeName, this method will instantiate the business graph specified as well as its contained child business object; the business object instance (rather than the business graph) will be returned. If a business object name is passed, this method will instantiate a "bare" business object--a business object without any accompanying business graph. This method should be used when a component wants to isolate itself from having to determine whether a user-provided complex type (e.g. the object type specified in an EIS event table) identifies a business graph, a business object or some other structure. Regardless of the type passed, this method will return a business object that the component can then use.

Returns:
a new business object instance
Throws:
BusinessObjectDefinitionNotFoundException - if definition cannot be located and/or instantiated
InvalidObjectDefinitionException

createDataObject

public static commonj.sdo.DataObject createDataObject(java.lang.String namespace,
                                                      java.lang.String complexTypeName)
                                               throws BusinessObjectDefinitionNotFoundException
Creates a new instance of a data object. This method is intended specifically for the creation of bare business graphs and objects. To create business objects complete with accompanying graphs, see createBusinessObject(java.lang.String, java.lang.String).

Throws:
BusinessObjectDefinitionNotFoundException - if definition cannot be located and/or instantiated

createDataObject

public static commonj.sdo.DataObject createDataObject(commonj.sdo.Type type)
                                               throws BusinessObjectDefinitionNotFoundException,
                                                      InvalidObjectDefinitionException
Creates a new instance of a data object by type. See createDataObject(String, String) for details.

Throws:
BusinessObjectDefinitionNotFoundException
InvalidObjectDefinitionException

copyBusinessObject

public static commonj.sdo.DataObject copyBusinessObject(commonj.sdo.DataObject busObj)
Performs a deep copy of a given business object.


copyBusinessObjectShallow

public static commonj.sdo.DataObject copyBusinessObjectShallow(commonj.sdo.DataObject busObj)
Performs a shallow copy of a given business object.


getMetadataForObject

public static commonj.sdo.DataObject getMetadataForObject(commonj.sdo.DataObject busObj)
                                                   throws InvalidObjectDefinitionException
Extracts the metadata embedded in the annotation of the business object complex type.

Returns:
A data object representing the metadata or null if metadata is not defined for this business object
Throws:
InvalidObjectDefinitionException

getMetadataForProperty

public static commonj.sdo.DataObject getMetadataForProperty(commonj.sdo.Property prop)
                                                     throws InvalidPropertyDefinitionException
Extracts the metadata embedded in the annotation of the business object property definition.

Returns:
A data object representing the metadata or null if metadata is not defined for this property
Throws:
InvalidPropertyDefinitionException

getMetadataForOperation

public static commonj.sdo.DataObject getMetadataForOperation(commonj.sdo.DataObject busObj,
                                                             java.lang.String operationName)
                                                      throws InvalidObjectDefinitionException
Extracts the metadata embedded in the annotation of the business object operation definition.

Returns:
A data object representing the metadata or null if metadata is not defined for the given operation
Throws:
InvalidObjectDefinitionException

isKeyProperty

public static boolean isKeyProperty(commonj.sdo.Property p)
                             throws InvalidPropertyDefinitionException
Checks whether a given property is defined as a key in the business object definition.

Returns:
true if the property is defined as a key for the data object or false otherwise.
Throws:
InvalidPropertyDefinitionException

getKeyProperties

public static commonj.sdo.Property[] getKeyProperties(commonj.sdo.DataObject busObj)
                                               throws InvalidPropertyDefinitionException
Provides a list of all key properties defined for a given business object

Returns:
An array of the key properties
Throws:
InvalidPropertyDefinitionException
See Also:
isKeyProperty(commonj.sdo.Property)

markAsDeltaObject

public static void markAsDeltaObject(commonj.sdo.DataObject busObj)
                              throws InvalidObjectDefinitionException
Designates busObj as a delta business object.

Throws:
InvalidObjectDefinitionException

isDeltaObject

public static boolean isDeltaObject(commonj.sdo.DataObject busObj)
Checks whether busObj is a delta business object.

Returns:
true if busObj is a delta or false otherwise.

markAsAfterImageObject

public static void markAsAfterImageObject(commonj.sdo.DataObject busObj,
                                          java.lang.String verbName)
                                   throws InvalidObjectDefinitionException
Designates busObj as an after-image business object with a top-level verb of verbName

Throws:
InvalidObjectDefinitionException

isAfterImageObject

public static boolean isAfterImageObject(commonj.sdo.DataObject busObj)
Checks whether busObj is an after-image business object.

Returns:
true if busObj is an after-image or false otherwise.

getTopLevelVerb

public static java.lang.String getTopLevelVerb(commonj.sdo.DataObject busObj)
                                        throws InvalidObjectDefinitionException
Returns the top-level verb for an after-image business object.

Returns:
Top-level verb for an after-image BO
Throws:
InvalidObjectDefinitionException

setTopLevelVerb

public static void setTopLevelVerb(commonj.sdo.DataObject busObj,
                                   java.lang.String verbName)
                            throws InvalidObjectDefinitionException
Sets the top-level verb for an after-image business object. Note: to designate a business object as after-image, use markAsAfterImageObject(commonj.sdo.DataObject, java.lang.String)

Throws:
InvalidObjectDefinitionException

getChangeSummary

public static commonj.sdo.ChangeSummary getChangeSummary(commonj.sdo.DataObject busObj)
Returns the ChangeSummary for a given business object.


getChangedProperties

public static commonj.sdo.Property[] getChangedProperties(commonj.sdo.DataObject busObj)
Provides a list of all properties that have been changed in a business object.

Returns:
List of changed properties

isPropertyMarkedIgnore

public static boolean isPropertyMarkedIgnore(commonj.sdo.DataObject busObj,
                                             commonj.sdo.Property prop)
Checks whether a property should be ignored during processing.

Returns:
Boolean indicating whether property should be ignored

isPropertyMarkedBlank

public static boolean isPropertyMarkedBlank(commonj.sdo.DataObject busObj,
                                            commonj.sdo.Property prop)
Checks whether a property should be cleared (or was cleared) in the EIS during processing.

Returns:
Boolean indicating whether property should be cleared

isChildContained

public static boolean isChildContained(commonj.sdo.Property childObjProperty)
Checks whether a child object is contained by its parent.


getMaxLength

public static int getMaxLength(commonj.sdo.Property p)
                        throws java.lang.Exception
Returns the maximum length for a property as specified by 'MaxLength' for the property type definition.

Returns:
maximum length for property
Throws:
java.lang.Exception

getRootBusinessObjectProperty

public static commonj.sdo.Property getRootBusinessObjectProperty(commonj.sdo.Type businessGraphType)
Returns the top-level business object type for a given business object graph. This method distinguishes between the business object defined in the graph type and those properties defined in parents of the graph class.

This method allows a component that only has access to the business graph type to determine which property it should consider as the actual business object of interest (for example, if it needs to instantiate an instance of the business object).

Returns:
Property for top-level busines object

isBusinessGraph

public static boolean isBusinessGraph(commonj.sdo.DataObject dataObj)

serializeDataObject

public static java.lang.String serializeDataObject(commonj.sdo.DataObject busObj)
                                            throws java.lang.Exception
Uses the BOXMLSerializer service to serialize the BO contents.

Returns:
A string representing the data object.
Throws:
java.lang.Exception