CentraSite Documentation : CentraSite Developer's Guide : Application Framework : Association Types : Usage Sample for Association Type Management
Usage Sample for Association Type Management
//Get a sessionContext instance
SessionContext sessionContext = initSessionContext();
 
// Get a TypeManager instance from sessionContext
TypeManager tm = sessionContext.getTypeManager();
 
AssociationType at = tm.createAssociationType(
"MyAssociationType", "MyDisplayName", "MyForwardLabel",
"MyBackwardLabel", Locale.EN);
tm.saveAssociationType(at);
 
// find an association type by its value
AssociationType myAssociationType = tm.getAssociationType("MyAssociationType");
 
// find an association type by its display name
myAssociationType = tm.getAssociationTypeByName("MyDisplayName");
 
// add a display name with a different locale
myAssociationType.setName("MonNom", Locale.FRENCH);
tm.saveAssociationType(myAssociationType);
 
// delete an association type
tm.deleteAsssociationType(myAssociationType);
Copyright © 2005-2016 Software AG, Darmstadt, Germany.

Product LogoContact Support   |   Community   |   Feedback