The example demonstrates how to set and retrieve item attribute values.
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.//The code snippet below shows the value of the character attribute
//"book_title" for the item represented by the DDO ddoDocument is set to
//the value "Effective C++"
ddoDocument->setData(ddoDocument->dataId(DK_CM_NAMESPACE_ATTR,
DKString("book_title")),DKString("Effective C++"));
//The code snippet below shows the value of the integer attribute
//"book_num_pages" for the item represented
//by the DDO ddoDocument is set to the value "250"
ddoDocument->setData(ddoDocument->dataId(DK_CM_NAMESPACE_ATTR,
DKString("book_num_pages")),(long)250);
//This code snippet shows how the value of the "book_title" attribute of the
//item represented by the DDO ddoDocument is retrieved into the "title"
//string variable.
DKString title =(DKString) ddoDocument->getData(ddoDocument->
dataId(DK_CM_NAMESPACE_ATTR,DKString("book_title")));
