com.ibm.websphere.wim.util
Class SDOHelper
- java.lang.Object
-
- com.ibm.websphere.wim.util.SDOHelper
-
public class SDOHelper extends java.lang.ObjectA helper class for construt virtual member manager SDO data graph and data object.
-
-
Constructor Summary
Constructors Constructor and Description SDOHelper()
-
Method Summary
Methods Modifier and Type Method and Description static DataObjectcloneDataObject(DataObject dataObject)Clones the input DataObject.static EObjectcloneEObject(EObject obj)Clones an EObject.static DataObjectcloneRootDataObject(DataObject root)Clones the input root DataObject.static DataObjectcreateChangeCtrlFromChangeRespCtrl(DataObject newRoot, DataObject prevRoot)Creates ChangeControl DataObject using the ChangeResponseControl DataObject.static DataObjectcreateConfigDataObject(DataObject parentDO, java.lang.String uri, java.lang.String configType)Creates a config type data object under the specified parent data ojbect, with specified virtual member manager configuration uri.static DataObjectcreateConfigProviderDataObject()Creates an empty data object that contains virtual member manager configuration name space URI in the document root.static DataObjectcreateConfigRepositoryDataObject(DataObject configProvider, java.lang.String repositoryTypeName)Creates an entity data object under the specified root data object with specified eitity type URI.static DataObjectcreateContextDataObject(DataGraph dataGraph, java.lang.String uri, java.lang.String contextTypeName)Creates a context data object under the specified data graph with specified context type uri.static DataObjectcreateContextDataObject(DataObject root, java.lang.String uri, java.lang.String contextTypeName)Creates a context data object under the specified root data object with specified context type URI.static DataObjectcreateControlDataObject(DataGraph dataGraph, java.lang.String uri, java.lang.String controlTypeName)Creates a control data object under the specified data graph with specified control type URI.static DataObjectcreateControlDataObject(DataObject root, java.lang.String uri, java.lang.String controlTypeName)Creates a control data object under the specified root data object with specified control type URI.static DataGraphcreateDataGraph(java.lang.String uri)Creates an empty data graph that has the document root under the specified URI.static DataObjectcreateDataObject(java.lang.String uri, java.lang.String typeName)Creates a type data object with specified uri.static DataObjectcreateEntityDataObject(DataGraph dataGraph, java.lang.String uri, java.lang.String entityTypeName)Creates an entity data object under the specified data graph with specified entity type URI.static DataObjectcreateEntityDataObject(DataObject root, java.lang.String uri, java.lang.String entityTypeName)Creates an entity data object under the specified root data object with specified eitity type URI.static DataObjectcreateRootDataObject()Creates an empty data object that contains virtual member manager name space URI in the document root.static DataObjectdeepCloneRootDataObject(DataObject root)Returns a deep clone of root DataObject once ChangeSummary is not null, otherwise, normal cloneRootDataObject will be returned.static java.lang.ObjectdeepCopyObject(java.lang.Object root)Returns a deep copy of an object, return null if the object to be cloned is null.static java.util.DategetDateFromString(java.lang.String dateStr)Returns a Date from the specified String.static java.lang.StringgetDateString(java.util.Date date)Returns a date String from the specified Date object.
-
-
-
Method Detail
-
createRootDataObject
public static DataObject createRootDataObject() throws WIMExceptionCreates an empty data object that contains virtual member manager name space URI in the document root.- Throws:
WIMException- Return:
- An empty data object that contains virtual member manager name space URI in the document root.
-
createConfigDataObject
public static DataObject createConfigDataObject(DataObject parentDO, java.lang.String uri, java.lang.String configType) throws WIMExceptionCreates a config type data object under the specified parent data ojbect, with specified virtual member manager configuration uri.- Parameters:
parentDO- The parent data object to create the new data object under.uri- The virtual member manager configuration namespace uri.configType- The configuration type.- Throws:
WIMException- Return:
- A data object under the specified parent data ojbect, with specified virtual member manager configuration uri using specified configuration type.
-
createConfigProviderDataObject
public static DataObject createConfigProviderDataObject()
Creates an empty data object that contains virtual member manager configuration name space URI in the document root.- Throws:
WIMException- Return:
- An empty data object that contains virtual member manager configuration name space URI in the document root.
-
createConfigRepositoryDataObject
public static DataObject createConfigRepositoryDataObject(DataObject configProvider, java.lang.String repositoryTypeName)Creates an entity data object under the specified root data object with specified eitity type URI. For example:SDOHelper.createConfigRepositoryDataObject(configProvider, ConfigConstants.CONFIG_DO_LDAP_REPOSITORY_TYPE);- Parameters:
configProvider- The configuration provider data object that the repository data object to create under.repositoryTypeName- A repository type name.- Return:
- A data object.
-
createDataGraph
public static DataGraph createDataGraph(java.lang.String uri)
Creates an empty data graph that has the document root under the specified URI.- Parameters:
uri- The document root URI.- Return:
- An empty data graph containing the specified document root data object.
-
createEntityDataObject
public static DataObject createEntityDataObject(DataGraph dataGraph, java.lang.String uri, java.lang.String entityTypeName)Creates an entity data object under the specified data graph with specified entity type URI. For example:SDOHelper.createEntityDataObject(datagraph, null, SchemaConstants.DO_PERSON_ACCOUNT);- Parameters:
dataGraph- A data graph that the entity data object to create under.uri- The name space URI of the entity. If not specified, virtual member manager name space URI will be used ("http://www.ibm.com/websphere/wim").entityTypeName- An entity type name.- Return:
- A data object.
-
createEntityDataObject
public static DataObject createEntityDataObject(DataObject root, java.lang.String uri, java.lang.String entityTypeName)Creates an entity data object under the specified root data object with specified eitity type URI. For example:SDOHelper.createEntityDataObject(root, null, SchemaConstants.DO_PERSON_ACCOUNT);- Parameters:
root- The root data object that the entity data object to create under.uri- The name space URI of the entity. If not specified, virtual member manager name space URI will be used ("http://www.ibm.com/websphere/wim").entityTypeName- An entity type name.- Return:
- A data object.
-
createControlDataObject
public static DataObject createControlDataObject(DataGraph dataGraph, java.lang.String uri, java.lang.String controlTypeName)Creates a control data object under the specified data graph with specified control type URI. * For example:SDOHelper.createControlDataObject(datagraph, null, SchemaConstants.DO_PROPERTY_CONTROL);- Parameters:
dataGraph- The data graph that the control data object to create under.uri- The name space URI of the control. If not specified, virtual member manager name space URI will be used ("http://www.ibm.com/websphere/wim").controlTypeName- A control type name.- Return:
- A data object.
-
createControlDataObject
public static DataObject createControlDataObject(DataObject root, java.lang.String uri, java.lang.String controlTypeName)Creates a control data object under the specified root data object with specified control type URI. For example:SDOHelper.createControlDataObject(root, null, SchemaConstants.DO_PROPERTY_CONTROL);- Parameters:
root- The root data object that the control data object to create under.uri- The name space URI of the control. If not specified, virtual member manager name space URI will be used ("http://www.ibm.com/websphere/wim").controlTypeName- A control type name.- Return:
- A data object.
-
createContextDataObject
public static DataObject createContextDataObject(DataGraph dataGraph, java.lang.String uri, java.lang.String contextTypeName)Creates a context data object under the specified data graph with specified context type uri. For example:SDOHelper.createContextDataObject(datagraph, null, SchemaConstants.TYPE_CONTEXT)- Parameters:
dataGraph- The data graph that the context data object to create under.uri- The name space URI of the context. If not specified, virtual member manager name space URI will be used ("http://www.ibm.com/websphere/wim").contextTypeName- A context type name.- Return:
- A data object.
-
createContextDataObject
public static DataObject createContextDataObject(DataObject root, java.lang.String uri, java.lang.String contextTypeName)Creates a context data object under the specified root data object with specified context type URI. For example:SDOHelper.createContextDataObject(root, null, SchemaConstants.TYPE_CONTEXT)- Parameters:
root- The root data object that the context data object to create under.uri- The name space URI of the context. If not specified, virtual member manager name space URI will be used ("http://www.ibm.com/websphere/wim").contextTypeName- A context type name.- Return:
- A data object.
-
createDataObject
public static DataObject createDataObject(java.lang.String uri, java.lang.String typeName)Creates a type data object with specified uri. For example: To create a Group data objectSDOHelper.createDataObject(SchemaContants.WIM_NS_URI, SchemaConstants.DO_GROUP)- Parameters:
uri- the name space URI of the type. If it is null or empty, default is virtual member manager name space URI ("http://www.ibm.com/websphere/wim").typeName- The name of the type.- Return:
- A type data object with specified URI.
-
getDateString
public static java.lang.String getDateString(java.util.Date date)
Returns a date String from the specified Date object. It is expected to be called before passing the date to SDO set method. For example: date = new Date(); entity.set("registerDate", SDOHelper.getDateString(date)); Input: 2005-05-04T09:34:18.444-0400 Output: 2005-05-04T09:34:18.444-04:00- Parameters:
date- The Date object.- Return:
- A date String that converted from Date object.
-
getDateFromString
public static java.util.Date getDateFromString(java.lang.String dateStr) throws WIMExceptionReturns a Date from the specified String. It is expected to be called on the date string returned in the datagraph. For example: String dateStr = entity.get("registerDate").toString(); Date date = SDOHelper.getDateFromString(dateStr); Input: 2005-05-04T09:34:18.444Z OR 2005-05-04T09:34:18Z- Parameters:
date- Date string.- Throws:
WIMException- if a parsing error occurs.- Return:
- Date object.
-
cloneDataObject
public static DataObject cloneDataObject(DataObject dataObject)
Clones the input DataObject.- Parameters:
dataObject- the DataObject to be cloned.- Return:
- the cloned DataObject
-
cloneRootDataObject
public static DataObject cloneRootDataObject(DataObject root)
Clones the input root DataObject.- Parameters:
root- root DataObject to be cloned.- Return:
- the cloned DataObject
-
cloneEObject
public static EObject cloneEObject(EObject obj)
Clones an EObject.- Parameters:
obj- EOObject to be cloned.- Return:
- the cloned EObject
-
deepCloneRootDataObject
public static final DataObject deepCloneRootDataObject(DataObject root)
Returns a deep clone of root DataObject once ChangeSummary is not null, otherwise, normal cloneRootDataObject will be returned.- Parameters:
root- DataObject to be copied- Return:
- new copy of original root DataObject.
-
deepCopyObject
public static final java.lang.Object deepCopyObject(java.lang.Object root)
Returns a deep copy of an object, return null if the object to be cloned is null. If serialization fails, this will return null.- Parameters:
source- Object to be copied (must be Serializable)- Return:
- new copy of original source parameter.
-
createChangeCtrlFromChangeRespCtrl
public static DataObject createChangeCtrlFromChangeRespCtrl(DataObject newRoot, DataObject prevRoot)Creates ChangeControl DataObject using the ChangeResponseControl DataObject. CheckPoint dataobject is copied from the ChangeResponseControl in the prevRoot to the ChangeControl in the newRoot- Parameters:
newRoot- It has/will have the ChangeControlprevRoot- It has the ChangeResponseControl from which the checkpoint list is to be copied to the ChangeControl in the newRoot- Return:
- The updated newRoot which has the checkpoint list
-
-