IBM Enterprise Records, Version 5.1.2    

Collection objects

A number of the RM Java™ API methods can accept a collection, empty or populated with elements, as an argument.

RMObjects is the super object for all IBM® Enterprise Records collection objects, and extends from the Content Java Compatibility Layer API BaseObjects and ReadableMetadataObjects interfaces.

To determine the object type of an element of the returned collection, call getRMEntityType on the RMObject object, which is extended by all non-collection RM Java API objects. All of the RM Java API collection objects are strongly-typed. As a result, these collection contain only elements whose object type is directly related to the collection object.

You can specify the particular object types in the typesReturned [] parameter of the Folder.getContainees (int[] typesReturned) method. You can also retrieve all objects in a folder without specifying the particular returned object types. For example, the following code snippet returns an RMObjects collection of all objects that exist in a folder:
//Returns the containee objects of the RecordFolder object
RMObjects getContaineeForFolder(RecordFolder aoFolder)
{
   RMObjects loRMObjects = (RMObjects) aoFolder.getContainees();
   return loRMObjects;
}

You can also retrieve an empty collection of RMObjects that can contain any type of RMObject. For this, you need to call the getRMObjects method on an instance of RMObjectStore.

Note: The RMUtil.getRMObjects(RMObjectStore  aoObjectStore, java.lang.String asFrom, java.lang.String asWhereClause) method on the RMUtil class does not return an empty collection of RMObjects. Instead, it returns an RMObjects collection whose elements match the given criteria.

The RM Java API exhibits the same behavior as the Content Java Compatibility Layer API, with respect to collection objects. Similar to the Content Java Compatibility Layer API, the RM Java API methods also take empty and populated collections as arguments. With the exception of the Properties and Permissions collection objects, you can use the methods inherited from java.util.Collection and java.util.List interfaces to manipulate elements in all of the RM Java API collection objects.

To create a new empty Properties collection, see the following code snippet, in which you create a new empty properties collection; add a Property object to the collection; and save the updated properties on a previously created RecordInfo object:
Properties loProperties = ObjectFactory.getProperties();
Property loProperty = ObjectFactory.getProperty(Property.DOCUMENT_TITLE);
loProperty.setValues("abc");
loProperties.add(loproperty)

loRecord.setProperties(loProperties);
The RM Java API provides a number of methods to retrieve collections of objects, such as the RecordCategories, RMFolders, and RecordInfos collection objects. Depending upon the constituent objects, the RM Java API returns the appropriate collection. For example, you can use the RecordInfo.getRecordCategories() to retrieve a collection of all record categories in which a RecordInfo object is filed. Or you can use the RecordInfo.getRecordFolders() to retrieve a collection of all record folders in which a RecordInfo object is filed. Each record category or record folder that is present in the collection is an immediate level parent of the RecordInfo object, as shown in the following code:
RecordCategories loRecordCategory = loRecordInfo.getRecordCategories();
RecordFolders loRecordFolder = loRecordInfo.getRecordFolders(); 
Note: The RecordInfo.getRecordCategories method applies only to DoD and Base installations of IBM Enterprise Records. When called in a PRO installation, this method returns an empty collection because you cannot file a RecordInfo object into a RecordCategory in a PRO installation.
Similarly, to retrieve a collection of records that are associated with a particular record type, use the RecordType.getAssociatedRecords method to retrieve records associated with the current instance of the RecordType object.
RecordInfos loRecordInfos = loRecordType.getAssociatedRecords();


Feedback

Last updated: November 2013
ierdg046.htm

© Copyright IBM Corporation 2013