Creating User-Defined Objects
In addition to the pre-defined object types such as organizations, services and associations, CentraSite allows you to define your own object types. Once such a type has been created using the CentraSite Control, a corresponding concept exists in the ObjectType classification scheme.
To create an instance of a user-defined object type
1. Create a RegistryEntry object.
2. Classify it with the type concept.
The following code example assumes that a user-defined type “{User-Uri}UserType” exists:
RegistryEntry userTypeObject
= (RegistryEntry)lcManager.createObject(LifeCycleManager.REGISTRY_ENTRY);
// find the "{User-Uri}UserType" concept
ClassificationScheme objectType
= bqManager.findClassificationSchemeByName(null, "ObjectType");
Concept userTypeConcept
= bqManager.findConceptByPath("/" + objectType.getKey().getId()
+ "/{User-Uri}UserType");
// create classification
Classification userTypeClassification
= lcManager.createClassification(userTypeConcept);
userTypeObject.addClassification(userTypeClassification);
/*
* from now on the userTypeObject is of type "UserType", and
* userTypeObject.getObjectType() will return a concept equal to
* userTypeConcept
*/
// save object
ArrayList objectList = new ArrayList();
objectList.add(userTypeObject);
lcManager.saveObjects(objectList);