Setting and retrieving item attribute values

The example demonstrates how to set and retrieve item attribute values.

Example: Java™

Attribute values are stored and retrieved as java.lang.Objects. To set or retrieve attribute values, use the DDO setData and the getData() methods respectively. Set the value by using an object with the type corresponds to the attribute type. Example:
ddo.setData(ddo.dataId(DKConstant.DK_CM_NAMESPACE_ATTR,
     nameOfAttrStr),valueObj);
Object obj = ddo.getData(ddo.dataId(DK_CM_NAMESPACE_ATTR,nameOfAttrStr));
The preceding statement sets the attribute value to the value that is passed in as a java.lang.Object valueObj. The nameOfAttrStr is the string name of the attribute. This attribute was defined and specified in the item type when the item type of this DDO was defined. valueObj is the value you must set and it must be of the correct type for this attribute.