Type Management provides CRUD (create, read, update and delete)
operations for custom object types. CSAF provides its own classes describing
object (asset) types and their attributes. Type Management supports operations
on the following attributes: file
,
classification
,
relationship
and
slot
, where slot
can be one of the following types:
xs:boolean
xs:dateTime
xs:date
xs:time
xs:duration
xs:anySimpleType
xs:integer
xs:string
xs:anyURI
xs:double
xs:decimal
Type Management also provides CRUD operations for profiles, and functionality to associate attributes with profiles and attach profiles to types. A manager interface com.softwareag.centrasite.appl.framework.types.TypeManager is the entry point for the application that uses CSAF.
Note:
In order to use Type Management functionality, the
StandaloneRegistryProvider
instance must be created with the browserBehaviour flag set to
"true". For more information on how to do this,
please check the Introduction.
For more information about the methods and functionality supported by Type Management, please check the Javadoc of the framework.
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);