Collections
Several DevOps CM API methods return collections of resources. The resource collections can be returned as a ResourceList or as a ResourceList.ResponseIterator.
The value of many properties is a list of references to resources. The value of such properties is represented by a ResourceList object, which is a collection of proxy objects with a number of additional methods for performing specific operations on the members of the list. If the value of a property is a ResourceList, a NestedPropertyNames object can be used to request properties from each of the resources in the list. The same set of properties will be requested from each resource.
The ResourceList provides a number of methods for performing specific operations on the members of the list. A ResourceList can contain proxies of any Resource subclass. All proxies in a collection can be the same proxy class or different classes depending on the generator of the list. A new ResourceList is created by the Provider.resourceList() method. ResourceList can be parameterized with the type of resource proxy it is meant to contain.
The ResponseIterator represents a stream of
proxy information coming from the server, one proxy at a time, as
the client moves through the items of the ResponseIterator.
Until it is explicitly released (using ResourceList.ResponseIterator().release()
)
or its end is reached, the ResponseIterator holds
open a communication channel with the server. For optimal performance,
clients should examine the items in the iterator as quickly as possible
and release the iterator as soon as it is no longer needed.
PropertyRequest wantedProps = new PropertyRequest(
CcDirectory.CHILD_LIST.nest(
CcFile.DISPLAY_NAME,
));
myDir = (CcDirectory) myDir.doReadProperties(wantedProps);
ResourceList<Resource> children = myDir.getChildList();
for (Resource current : children ) {
System.out.println(current.getDisplayName());
}
For details, see the Javadoc for the API.