All IBM® Enterprise
Records objects
extend the ReadableMetadataObject interface of the
Content Java™ API, and as a result you can retrieve properties just
as you would for properties defined in the Content Java Compatibility
Layer API.
You can use the
getProperties method.
For more information, see "Retrieving Properties" in the
Help
for Content Java API. This method takes a string array that
identifies the properties to return. If you pass in an empty array
or a null, all readily available properties of that object are returned.
To view the collection of properties as an XML string, use the
getPropertiesXML method,
as shown in the following code snippet.
// Retrieves the properties for a ObjectStore named
// SampleObjectStore as a String value in XML format.
String getDateCreatePropertyAsXML(Session aoSession)
{
ObjectStore loStore =
ObjectFactory.getObjectStore("SampleObjectStore", aoSession);
RMUtil loUtil = new RMUtil();
RMObjectStore loRMObjectStore = loUtil.getRMObjectStore(loStore);
String lsPropertiesXML =
loRMRMObjectStore.getPropertiesXML(new String[]{RMProperty.DATE_CREATED});
return lsPropertiesXML;
}
You can set properties for objects
that extend the
WriteableMetadataObject interface
of the Content Java Compatibility Layer API (see "Setting Properties"
in the
Help for Content Java API for more information).
All the RM Java API objects except
RMObjectStore extend
the
WriteableMetadataObject interface. As a result,
you can set properties of all objects (except
RMObjectStore)
using the
setProperties method. This method sets
the properties of an entity and persists the changes to the object
store. This method takes a
Properties collection
that contains the
Property objects to be persisted.
// Sets the name for an electronic record folder
// whose ID is passed to the function
void setNameForFolder(RMObjectStore aoRMStore, String asFolderId)
{
RecordFolder loRMObj =
(RecordFolder)aoRMStore.getObject(RMType.RM_TYPE_ELECTRONICRECORDFOLDER, asFolderId);
Properties loProperties = ObjectFactory.getProperties();
Property loName = ObjectFactory.getProperty(RMProperty.FOLDER_NAME);
loName.setValue("NewRMFolder");
loProperties.add(loName);
loRMObj.setProperties(loProperties);
}
Note: When you assign an RM object as
the value of an object-valued property, you need to assign its underlying
Content Java Compatibility Layer API object. This object is obtained
using the
thisBaseObject() method. See
Associating a RecordType object with a RecordInfo object for a code snippet that sets an object-valued
property.