Enterprise Information Portal APIs

com.ibm.mm.sdk.common
Class DKDDOBase

java.lang.Object
  |
  +--com.ibm.mm.sdk.common.dkAbstractDataObjectBase
        |
        +--com.ibm.mm.sdk.common.dkDataObject
              |
              +--com.ibm.mm.sdk.common.DKDDOBase
All Implemented Interfaces:
DKConstant, dkDataObjectBase, DKMessageId, java.io.Serializable
Direct Known Subclasses:
DKDDO

public class DKDDOBase
extends dkDataObject
implements DKConstant, DKMessageId, java.io.Serializable

DKDDOBase is the base class to represents Dynamic Data Object (DDO).

Dynamic Data Object is the main class for transferring data in and out of persistent store. It is a self describing data object flexible enough for representing data originated from heterogenous stores. Currently, DDO has been used for representing data objects from about a dozen or more disparate data sources.

A DDO is essentially a container for data-items, such as EmployeeNo, Name, Address, VideoClip, myPicture, etc. Sometimes data-items are also called attributes. A data-item has a name, properties, and a value(s). The name is usually a string, like "EmployeeNo", "myPicutre", etc. Properties describe the characteristics of this data-item, for example, its basic type, like integer, string, decimal, etc. Non basic types are also supported, such as referce to other data objects, reference to a collection of strings, shorts, and other types. Other useful properties are nullablility: nullable or non-nullable, persistency: transient or persistent, updatabiliy: read-write or read-only, and other application dependent properties. Depending on the underlying back-end datastore support, properties can be persistent, that is, saved in the persistent store, or transient, only represented in memory. In addition to properties of a data-item, the DDO itself can have properties appicable to the whole DDO, like DDO type. The DDO class provides methods for adding data-items and properties, getting and setting properties, and more importantly, getting and setting data-item values.

Data-items are quite flexible for representing data from different groups or domains. To avoid naming collision between these groups. The DDO class supports namespace for data-item names. Content Manager supports DK_CM_NAMESPACE_ATTR, DK_CM_NAMESPACE_LINK, and DK_CM_NAMESPACE_CHILD namespaces, for organizing attribue, link and child data-item names.

Note: Names are case sensitive, and data-items and property position starts from 1 not from 0.

A DDO has a persistent identifier (PID), which is used for locating the data object in the persistent store during retrieve, update nad delete operations. A PID contains information on datastore name, datastore type or entity name, and the address of the data object itself according to the underlying persistent store. See the class DKPid for details.

The DDO implementation is based on OMG Persistent Object Services (POS) specification available at http://cgi.omg.org/docs/formatl/97-12-12.pdf

See Also:
Serialized Form

Fields inherited from interface com.ibm.mm.sdk.common.DKConstant
    For details, see the class or interface
 
Fields inherited from interface com.ibm.mm.sdk.common.DKMessageId
    For details, see the class or interface
 
Constructor Summary
DKDDOBase()
          Constructs a DDO Base object.
DKDDOBase(DKDDOBase ddo)
          Constructs a DDO Base object from an existing DDO Base (copy contructor).
DKDDOBase(DKPid pid)
          Constructs a DDO Base object with a given Pid.
DKDDOBase(DKPid pid, short initialSize)
          Constructs a DDO Base object with a given Pid and an initial number of data-items.
DKDDOBase(short initialSize)
          Constructs a DDO Base object which has enough space for the given initial number of data-items.
DKDDOBase(java.lang.String objectType)
          Constructs a DDO Base object for a given object type.
DKDDOBase(java.lang.String objectType, short initialSize)
          Constructs a DDO Base object for a given object type, with an initial number of data-items.
 
Method Summary
 short addData()
          Adds a new data-item to this data-object and returns the new data-item number (data-id).
 short addData(java.lang.String data_name)
          Adds a new data-item with the given name to this data-object and returns the new data-item number (data-id).
 short addData(java.lang.String name_space, java.lang.String data_name)
          Adds a new data-item with the given namespace and name to this data-object and returns the new data-item number (data-id).
 short addDataProperty(short data_id)
          Adds a new property to a given data-item and returns the new property number (property-id).
 short addDataProperty(short data_id, java.lang.String property_name)
          Adds a new property with the given name to the data-item and returns the new property number (property-id).
 short addDataProperty(short data_id, java.lang.String property_name, java.lang.Object property_value)
          Adds a new property with the given name and value to the data-item and returns the new property number (property-id).
 short addProperty()
          Adds a new property to this DDO and returns the new property number (property-id).
 short addProperty(java.lang.String property_name)
          Adds a new property with a given name to this DDO and returns the new property number (property-id).
 short addProperty(java.lang.String property_name, java.lang.Object property_value)
          Adds a new property with a given name and value to this DDO.
 short dataCount()
          Gets the number of data-items in this data-object.
 short dataId(java.lang.String data_name)
          Gets the data-id of a given data-item name.
 short dataId(java.lang.String name_space, java.lang.String data_name)
          Gets the data-id of a given data-item namespace and data-item name.
 short[] dataIdsByNameSpace(java.lang.String name_space)
          Gets an array of data-ids defined in the given namespace.
 short dataNameSpaceCount()
          Returns the namespace count
 short dataPropertyCount(short data_id)
          Gets the number of properties associated with this data-item.
 short dataPropertyId(short data_id, java.lang.String data_property_name)
          Gets the property-id of a given property-name in a data-item.
 java.lang.Object getData(short data_id)
          Gets the value of a given data-item.
 java.lang.Object getDataByName(java.lang.String data_name)
          Gets the value of a data-item given its name.
 java.lang.Object getDataByName(java.lang.String name_space, java.lang.String data_name)
          Gets the value of a data-item given its namespace and name.
 java.lang.String getDataName(short data_id)
          Gets the name of a given data-item.
 java.lang.String getDataNameSpace(short data_id)
          Gets the namespace of a given data-item.
 java.lang.Object getDataProperty(short data_id, short property_id)
          Gets the value of a given property in a data-item.
 java.lang.Object getDataPropertyByName(short data_id, java.lang.String data_property_name)
          Gets the value of a given property-name of a data-item id.
 java.lang.Object getDataPropertyByName(java.lang.String data_name, java.lang.String data_property_name)
          Gets the value of a given property-name of a data-item name.
 java.lang.Object getDataPropertyByName(java.lang.String name_space, java.lang.String data_name, java.lang.String data_property_name)
          Gets the value of a given property-name of a data-item name in data-item namespace.
 java.lang.String getDataPropertyName(short data_id, short property_id)
          Gets the name of a given property in a data-item.
 java.lang.String getObjectType()
          Gets the type of this data-object.
 java.lang.Object getProperty(short property_id)
          Gets the value of a given property in this DDO.
 java.lang.Object getPropertyByName(java.lang.String property_name)
          Gets the value of a given property-name in this DDO.
 java.lang.String getPropertyName(short property_id)
          Gets the name of a given property in this DDO.
 boolean isDataPropertySet(short data_id, short property_id)
          Returns true if a given property of a data-item is set.
 boolean isDataSet(short data_id)
          Returns true if this data-item has been set to a value.
 boolean isNull(short data_id)
          Returns true if the value of this data-item is null.
 boolean isPropertySet(short property_id)
          Returns true if the given property in this DDO has been set to a value.
 short propertyCount()
          Gets the number of properties associated with this DDO.
 short propertyId(java.lang.String property_name)
          Gets the property-id of a given property-name in this DDO.
 short protocol()
          Returns the protocol type supported by this data-object.
 void setData(short data_id, java.lang.Object data_value)
          Sets the value of a given data-item.
 void setDataName(short data_id, java.lang.String data_name)
          Sets the name of a given data-item.
 void setDataName(short data_id, java.lang.String name_space, java.lang.String data_name)
          Sets the namespace and the name of a given data-item.
 void setDataNameSpace(short data_id, java.lang.String name_space)
          Sets the namespace of a given data-item.
 void setDataProperty(short data_id, short property_id, java.lang.Object property_value)
          Sets the value of a given property in a data-item.
 void setDataPropertyName(short data_id, short property_id, java.lang.String property_name)
          Sets the name of a given property in a data-item.
 void setNull(short data_id)
          Sets the value of a data-item to a null value.
 void setObjectType(java.lang.String toObjectType)
          Sets the type of this data-object and synchronizes it with the object type of its Pid.
 void setProperty(short property_id, java.lang.Object property_value)
          Sets the value of a given property in this DDO.
 void setPropertyName(short property_id, java.lang.String property_name)
          Sets the name of a given property in this DDO.
 boolean updatable()
          Returns true if this data object is updatable.
 
Methods inherited from class com.ibm.mm.sdk.common.dkDataObject
getPid, getPidObject, setPid, setPidObject
 
Methods inherited from class com.ibm.mm.sdk.common.dkAbstractDataObjectBase
getParent, getRootObject, setParent, setRootObject
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DKDDOBase

public DKDDOBase()
Constructs a DDO Base object.

DKDDOBase

public DKDDOBase(short initialSize)
Constructs a DDO Base object which has enough space for the given initial number of data-items.
Parameters:
initialSize - initial number of data items.

DKDDOBase

public DKDDOBase(DKDDOBase ddo)
Constructs a DDO Base object from an existing DDO Base (copy contructor).
Parameters:
ddo - a DDO Base object.

DKDDOBase

public DKDDOBase(java.lang.String objectType)
Constructs a DDO Base object for a given object type.
Parameters:
objectType - the object type which usually corresponds to an entity name.

DKDDOBase

public DKDDOBase(java.lang.String objectType,
                 short initialSize)
Constructs a DDO Base object for a given object type, with an initial number of data-items.
Parameters:
objectType - the object type.
initialSize - initial number of data items.

DKDDOBase

public DKDDOBase(DKPid pid)
Constructs a DDO Base object with a given Pid.
Parameters:
pid - the Pid object.

DKDDOBase

public DKDDOBase(DKPid pid,
                 short initialSize)
Constructs a DDO Base object with a given Pid and an initial number of data-items.
Parameters:
pid - the Pid object.
initialSize - initial number of data items.
Method Detail

protocol

public short protocol()
Returns the protocol type supported by this data-object. In this case, it is DK_CM_DDO, which essentially means that this data-object can be made persistent with the help of an associated datastore object. The DK_CM_DDO protocol consists of get/setData, get/setDataProperty, and other methods in this object, which support the representation of a self describing data-object.
Overrides:
protocol in class dkAbstractDataObjectBase
Returns:
the protocol.

getObjectType

public java.lang.String getObjectType()
Gets the type of this data-object.
Overrides:
getObjectType in class dkAbstractDataObjectBase
Returns:
the object type which usually corresponds to an entity name

setObjectType

public void setObjectType(java.lang.String toObjectType)
Sets the type of this data-object and synchronizes it with the object type of its Pid.
Parameters:
toObjectType - the object type.
See Also:
getObjectType()

updatable

public boolean updatable()
Returns true if this data object is updatable.
Returns:
true if updatable.

addData

public short addData()
              throws DKUsageError
Adds a new data-item to this data-object and returns the new data-item number (data-id).
Returns:
the data-item number (data-id).

addData

public short addData(java.lang.String data_name)
              throws DKUsageError
Adds a new data-item with the given name to this data-object and returns the new data-item number (data-id).
Parameters:
data_name - data-item name.
Returns:
data-item number (data-id).
Throws:
DKUsageError - if the data-item name already exist.

addDataProperty

public short addDataProperty(short data_id)
                      throws DKUsageError
Adds a new property to a given data-item and returns the new property number (property-id).
Parameters:
data_id - data-id.
Returns:
data-property number (property-id).
Throws:
DKUsageError - if the data-id is invalid.

addDataProperty

public short addDataProperty(short data_id,
                             java.lang.String property_name)
                      throws DKUsageError
Adds a new property with the given name to the data-item and returns the new property number (property-id).
Parameters:
data_id - data id.
property_name - property name.
Returns:
data property number (property-id).
Throws:
DKUsageError - if the data-id is invalid, or property name already exists or invalid.

addDataProperty

public short addDataProperty(short data_id,
                             java.lang.String property_name,
                             java.lang.Object property_value)
                      throws DKUsageError
Adds a new property with the given name and value to the data-item and returns the new property number (property-id).
Parameters:
data_id - the data-id.
property_name - property name.
property_value - property value.
Returns:
data property number (property-id).
Throws:
DKUsageError - if the data-id is invalid, or property name already exists or invalid.

dataCount

public short dataCount()
Gets the number of data-items in this data-object.
Returns:
number of data-items.

dataPropertyCount

public short dataPropertyCount(short data_id)
                        throws DKUsageError
Gets the number of properties associated with this data-item.
Parameters:
data_id - the data-id.
Returns:
the number of properties.
Throws:
DKUsageError - if the data-id is invalid.

setDataProperty

public void setDataProperty(short data_id,
                            short property_id,
                            java.lang.Object property_value)
                     throws DKUsageError
Sets the value of a given property in a data-item.
Parameters:
data_id - data-id.
property_id - property-id.
property_value - the property value.
Throws:
DKUsageError - if the data-id is invalid, or property id is invalid.

getDataProperty

public java.lang.Object getDataProperty(short data_id,
                                        short property_id)
                                 throws DKUsageError
Gets the value of a given property in a data-item.
Parameters:
data_id - data-id.
property_id - property-id.
Returns:
property value.
Throws:
DKUsageError - if the data-id is invalid, or property id is invalid.

setDataPropertyName

public void setDataPropertyName(short data_id,
                                short property_id,
                                java.lang.String property_name)
                         throws DKUsageError
Sets the name of a given property in a data-item.
Parameters:
data_id - data-id.
property_id - property-id.
property_name - property name.
Throws:
DKUsageError - if the data-id is invalid, or property id is invalid.

getDataPropertyName

public java.lang.String getDataPropertyName(short data_id,
                                            short property_id)
                                     throws DKUsageError
Gets the name of a given property in a data-item.
Parameters:
data_id - data-id.
property_id - property-id.
Returns:
property name.
Throws:
DKUsageError - if the data-id is invalid, or property id is invalid.

setData

public void setData(short data_id,
                    java.lang.Object data_value)
             throws DKUsageError
Sets the value of a given data-item.
Parameters:
data_id - data-id.
data_value - data value.
Throws:
DKUsageError - if the data-id is invalid.

getData

public java.lang.Object getData(short data_id)
                         throws DKUsageError
Gets the value of a given data-item.
Parameters:
data_id - data-id.
Returns:
data value.
Throws:
DKUsageError - if the data-id is invalid.

setDataName

public void setDataName(short data_id,
                        java.lang.String data_name)
                 throws DKUsageError
Sets the name of a given data-item.
Parameters:
data_id - data-id.
data_name - data name.
Throws:
DKUsageError - if the data-id is invalid.

getDataName

public java.lang.String getDataName(short data_id)
                             throws DKUsageError
Gets the name of a given data-item.
Parameters:
data_id - data id.
Returns:
data name.
Throws:
DKUsageError - if the data-id is invalid.

dataId

public short dataId(java.lang.String data_name)
             throws DKUsageError
Gets the data-id of a given data-item name.
Parameters:
data_name - data name.
Returns:
the data-id.
Throws:
DKUsageError - if the data-item name is not found.

dataPropertyId

public short dataPropertyId(short data_id,
                            java.lang.String data_property_name)
                     throws DKUsageError
Gets the property-id of a given property-name in a data-item.
Parameters:
data_id - data-id.
data_property_name - data-property name.
Returns:
the property-id.
Throws:
DKUsageError - if the data-id is invalid, or property name is invalid.

getDataByName

public java.lang.Object getDataByName(java.lang.String data_name)
                               throws DKUsageError
Gets the value of a data-item given its name.
Parameters:
data_name - data-item name.
Returns:
data value.
Throws:
DKUsageError - if the data-item name is not found.

getDataPropertyByName

public java.lang.Object getDataPropertyByName(short data_id,
                                              java.lang.String data_property_name)
                                       throws DKUsageError
Gets the value of a given property-name of a data-item id.
Parameters:
data_id - data-id.
data_property_name - data-property name.
Returns:
property value.
Throws:
DKUsageError - if the data-id is invalid, or property name is not found.

getDataPropertyByName

public java.lang.Object getDataPropertyByName(java.lang.String data_name,
                                              java.lang.String data_property_name)
                                       throws DKUsageError
Gets the value of a given property-name of a data-item name.
Parameters:
data_name - data-item name.
data_property_name - data-property name.
Returns:
property value.
Throws:
DKUsageError - if the data-item name is not found or property name is not found.

setNull

public void setNull(short data_id)
             throws DKUsageError
Sets the value of a data-item to a null value. The data-item must be nullable, and the data-object must be updatable.
Parameters:
data_id - data-id.
Throws:
DKUsageError - if the data-id is invalid

isNull

public boolean isNull(short data_id)
               throws DKUsageError
Returns true if the value of this data-item is null.
Parameters:
data_id - data-id.
Returns:
true if data-item value is null.
Throws:
DKUsageError - if the data-id is invalid

isDataSet

public boolean isDataSet(short data_id)
                  throws DKUsageError
Returns true if this data-item has been set to a value.
Parameters:
data_id - data-id.
Returns:
true if data item value is set.
Throws:
DKUsageError - if the data-id is invalid

isDataPropertySet

public boolean isDataPropertySet(short data_id,
                                 short property_id)
                          throws DKUsageError
Returns true if a given property of a data-item is set.
Parameters:
data_id - data-id.
property_id - property-id.
Returns:
true if data item property value is set.
Throws:
DKUsageError - if the data-id is invalid or property-id is invalid.

addProperty

public short addProperty()
                  throws DKUsageError
Adds a new property to this DDO and returns the new property number (property-id).
Returns:
the new property number (property id).

addProperty

public short addProperty(java.lang.String property_name)
                  throws DKUsageError
Adds a new property with a given name to this DDO and returns the new property number (property-id).
Parameters:
property_name - property name.
Returns:
property number (property-id).
Throws:
DKUsageError - if the property name already exists

addProperty

public short addProperty(java.lang.String property_name,
                         java.lang.Object property_value)
                  throws DKUsageError
Adds a new property with a given name and value to this DDO. and returns the new property number (property-id).
Parameters:
property_name - property-name.
property_value - property value.
Returns:
the property number (property-id).
Throws:
DKUsageError - if the property name already exists

propertyCount

public short propertyCount()
                    throws DKUsageError
Gets the number of properties associated with this DDO.
Returns:
the number of properties.

setProperty

public void setProperty(short property_id,
                        java.lang.Object property_value)
                 throws DKUsageError
Sets the value of a given property in this DDO.
Parameters:
property_id - property-id.
property_value - property value.
Throws:
DKUsageError - if the property-id is not found

getProperty

public java.lang.Object getProperty(short property_id)
                             throws DKUsageError
Gets the value of a given property in this DDO.
Parameters:
property_id - property-id.
Returns:
property value.
Throws:
DKUsageError - if the property-id is not found

setPropertyName

public void setPropertyName(short property_id,
                            java.lang.String property_name)
                     throws DKUsageError
Sets the name of a given property in this DDO.
Parameters:
property_id - property-id.
property_name - property name.
Throws:
DKUsageError - if the property-id is not found

getPropertyName

public java.lang.String getPropertyName(short property_id)
                                 throws DKUsageError
Gets the name of a given property in this DDO.
Parameters:
property_id - property-id.
Returns:
the property name.
Throws:
DKUsageError - if the property-id is not found

propertyId

public short propertyId(java.lang.String property_name)
                 throws DKUsageError
Gets the property-id of a given property-name in this DDO.
Parameters:
property_name - property-name.
Returns:
the property-id.
Throws:
DKUsageError - if the property-name is not found

getPropertyByName

public java.lang.Object getPropertyByName(java.lang.String property_name)
                                   throws DKUsageError
Gets the value of a given property-name in this DDO.
Parameters:
property_name - property-name.
Returns:
the property value.
Throws:
DKUsageError - if the property-name is not found

isPropertySet

public boolean isPropertySet(short property_id)
                      throws DKUsageError
Returns true if the given property in this DDO has been set to a value.
Parameters:
property_id - property-id.
Returns:
true if the property is set.
Throws:
DKUsageError - if the property-id is not found

dataNameSpaceCount

public short dataNameSpaceCount()
Returns the namespace count
Returns:
namespace count

dataIdsByNameSpace

public short[] dataIdsByNameSpace(java.lang.String name_space)
                           throws DKUsageError
Gets an array of data-ids defined in the given namespace.
Parameters:
name_space - data namespace. See description at the header of this class for valid namespaces
Returns:
array of data-ids for given namespace.

dataId

public short dataId(java.lang.String name_space,
                    java.lang.String data_name)
             throws DKUsageError
Gets the data-id of a given data-item namespace and data-item name.
Parameters:
name_space - data namespace.
data_name - data name.
Returns:
the data-id.
Throws:
DKUsageError - if the namespace or data-item name is not found

getDataByName

public java.lang.Object getDataByName(java.lang.String name_space,
                                      java.lang.String data_name)
                               throws DKUsageError
Gets the value of a data-item given its namespace and name.
Parameters:
name_space - data namespace.
data_name - data-item name.
Returns:
data value.
Throws:
DKUsageError - if the namespace or data-item name is not found

getDataPropertyByName

public java.lang.Object getDataPropertyByName(java.lang.String name_space,
                                              java.lang.String data_name,
                                              java.lang.String data_property_name)
                                       throws DKUsageError
Gets the value of a given property-name of a data-item name in data-item namespace.
Parameters:
name_space - data namespace.
data_name - data-item name.
data_property_name - data-property name.
Returns:
property value.
Throws:
DKUsageError - if the namespace, data-item name or data-property name is not found

setDataName

public void setDataName(short data_id,
                        java.lang.String name_space,
                        java.lang.String data_name)
                 throws DKUsageError
Sets the namespace and the name of a given data-item.
Parameters:
data_id - data-id.
name_space - data namespace.
data_name - data name.
Throws:
DKUsageError - if the data-id is invalid, or the data-item name already exists

setDataNameSpace

public void setDataNameSpace(short data_id,
                             java.lang.String name_space)
                      throws DKUsageError
Sets the namespace of a given data-item.
Parameters:
data_id - data-id.
name_space - data namespace.
Throws:
DKUsageError - if the data-id is invalid

getDataNameSpace

public java.lang.String getDataNameSpace(short data_id)
                                  throws DKUsageError
Gets the namespace of a given data-item.
Parameters:
data_id - data id.
Returns:
data namespace.
Throws:
DKUsageError - if the data-id is invalid

addData

public short addData(java.lang.String name_space,
                     java.lang.String data_name)
              throws DKUsageError
Adds a new data-item with the given namespace and name to this data-object and returns the new data-item number (data-id).
Parameters:
name_space - data-item namespace.
data_name - data-item name.
Returns:
data-item number (data-id).
Throws:
DKUsageError - if the data-item name already exists

EIP Java APIs

(c) Copyright International Business Machines Corporation 1996, 2002. IBM Corp. All rights reserved.