Usage Sample for Type Management
private String TYPE_LOCAL_NAME = "TypeLocalName";
private String TYPE_NAMESPACE = "http://test.namespace.test";
private String TYPE_NAME = "{" + TYPE_NAMESPACE + "}"
+ TYPE_LOCAL_NAME;
//Get a sessionContext instance
SessionContext sessionContext = initSessionContext();
// Get a TypeManager instance from sessionContext
TypeManager typeManager = sessionContext.getTypeManager();
// Create a custom object type
TypeDescription typeDescription = typeManager.createType("TypeDisplayName",
"TypeDescription", TYPE_LOCAL_NAME, TYPE_NAMESPACE);
// Create a Classification Attribute
AttributeDescription attrClass = typeManager.createClassificationAttribute(
"ClassificationAttributeName","ClassificationAttributeDescription",
Constants.CLASSIFICATION_SCHEME_PRODUCTS);
//Add attribute to custom type
typeDescription.addAttribute(attrClass);
//Create Profile
Profile profile = typeManager.createProfile("ProfileName");
// Create a File Attribute
AttributeDescription attrFile = typeManager.createFileAttribute(
"nameFileAttribute", "descriptionFileAttribute");
//Add attribute to profile
profile.addAttribute(attrFile);
//Add profile to custom type
typeDescription.addProfile(profile);
// Save custom type
typeManager.saveType(typeDescription);
//Get custom type by name
TypeDescription type = typeManager.getType(TYPE_NAME);
//Delete custom type
typeManager.deleteType(type);