User's Manual

Chapter 11. Services Tutorials 131
Figure 11-7. Category Hierarchy before and after removing parent categories
11.2.5. Retrieving all Subcategories of a given Category
// assume that we have the Category OID (call it categoryOID)
Category category = new Category(categoryOID);
// subcategories is a collection of Category objects
CategoryCollection subcategories = category.getChildren();
Example 11-5. Retrieving Subcategories of a given Category
11.2.6. Retrieving all child objects of a given Category
// assume that we have the Category OID
// (call it categoryOID)
Category category = new Category(categoryOID);
// the Collection will be a Collection of
// CategorizedObjects
Collection childObjects = category.getObjects();
// print out the toString for each object
// and its parents
Iterator childIterator = childObjects.iterator();
while (childIterator.hasNext()) {
CategorizedObject object =
(CategorizedObject) childIterator.next();