CentraSite 10.7 | CentraSite Developer's Guide | Customizing CentraSite | Implementation of Computed Attributes and Profiles | Implementing Computed Profiles for CentraSite Control
 
Implementing Computed Profiles for CentraSite Control
The following sections describe how to define a computed profile for the CentraSite Control UI.
Definition of Java-Based Computed Profile
A Java based computed profile has the following rendering mechanism:
*WithUiRendering: This dictates the user-defined rendering of the profile's attributes.
*WithoutUiRendering: This dictates the CentraSite's default rendering of the profile’s attributes. This default rendering is based on the attribute’s data type.
Implementation Guidelines for Java-Based Computed Profiles
This section describes the Java interfaces and methods that you need to implement for a computed profile.
Interfaces
Description
ComputedProfile
This interface declares basic rendering methods for the user interface.
void: init(java.lang.Object, Locale): with CentraSiteRegistryObject as a parameter where the necessary implementation is done and updateAsset() which would return a collection of registry object serves as a save hook.
boolean: canRenderUI(): This determines whether the rendering is based on the UI (true) or on the triples associated with the profile (false).
Collection: getAttributes(): returns a collection of ProfileAttribute and would be called only when canRenderUI() returns true.
Collection: updateAsset(): returns a collection of CentraSiteRegistryObject and would be called only when canRenderUI() returns true.
WebUIProfile
This interface is specific to the rendering for CentraSite Control.
java.lang.Object: createProfileContent(): create the profile contents with XML content (in compliance with Application Designer).
EclipseProfile
This interface is specific to the rendering for Eclipse Designer.
createFormContent(): create the profile contents on the supplied IManagedForm (in compliance with Eclipse Designer SWT/JFace library).
BUIProfile
This interface is specific to the rendering for CentraSite Business UI.
getEditPageURL(): returns URL of the edit page of computed profile and would be called only when canRenderUI() returns true.
getViewPageURL(): returns URL of the view page of computed profile and would be called only when canRenderUI() returns true.
getProfileDataAsJson(): returns a collection of profile data as JSON-formatted string.
Collection computeProfileData (String userInputsAsJSON): sets a collection of profile data as JSON-formatted string.
ProfileAttribute
This interface deals with the standard UI rendering of the profile's attributes and allows defining the attributes as key value pairs. The rendering of each attribute is the standard rendering for the corresponding datatype of the attribute.
AttributeDescriptor: getAttributeDescriptor(): returns the descriptor of the attribute.
String: getAttributeKey(): returns the key of the attribute.
String: getName(): returns the name of the attribute.
Collection: getValue(): returns the value of the attribute.
ComputedAttributeLine
This interface deals with the user-defined UI rendering of the profile's attributes. The UI rendering of the attributes is determined by the coding of this interface.
void: buildUI(StringBuilder layout): This method is responsible for rendering the layout definition.
void: passivate(): This method is responsible for storing the values back to the object.
void: revert(): This method is to revert the changes.
AttributeDescriptor
This interface deals with the standard properties (isReadOnly(), is Required()...) for an attribute.
String: getMinOccurs(): returns the minimum allowed occurrences of this attribute.
String: getMaxOccurs(): returns the maximum allowed occurrences of this attribute.
boolean: isRequired(): returns whether this attribute is required.
boolean: isReadOnly(): returns whether this attribute is read-only.
boolean: hasDefaultValue(): returns whether this attribute has a default value.
Object: getDefaultValue(): returns the default value of this attribute.
int: getMaxLength(): returns the maximum length of this attribute.
String: getDataType(): returns the data type of this attribute.
Object: getNativeAtribute(): returns the native attribute instance if the data type is not primitive, otherwise returns null.
String[]: getEnumValues():
boolean: isPrefix(): returns whether this slot's unit label is a prefix or suffix value. Return true if the unit label is a prefix, false for suffix.
int getPrecision(): returns the precision for a number attribute.
String: getUnitLabel(): returns this slot's unit label. The label may be null.
Structure of Archive File
The plug-in uses the policy engine infrastructure, so it uses the structure of a Java policy (zip file structure and classloader). The archive file must contain the following folders and files:
Zip folder
Description
META-INF
This folder contains the config.properties file, which is the build file for the plug-in. This properties file contains an entry of the following format:
com.softwareag.centrasite.computed.
profile.webui.impl.class=
com.sample.MyProfileImpl
lib
This folder contains the archive file with the source code examples, the plug-in's executor class and the external libraries.
Sample Code
Your CentraSite installation contains two sample computed profiles (which is contained in demos folder) that you can use to create an archive file for the computed profile specific to CentraSite Control.
*NonPrimitiveDataTypeSamples
*SampleComputedProfile
Load a Computed Profile into an Asset Type Definition
After you have created an archive file that contains the profile definition, you need to load the archive file into the asset type definition. You do this by starting the Edit Asset Type wizard for the appropriate asset type and specifying in the wizard that you are defining a new computed profile.
For details about how to load the archive file of a computed profile into an asset type definition, see CentraSite User’s Guide.
When you have loaded the archive file, the new profile is displayed in the detail page of all assets of the asset type.