CentraSite Developer's Guide : Customizing CentraSite : Implementation of Computed Attributes and Profiles : Implementing Computed Attributes
Implementing Computed Attributes
The computed attribute is defined as an implementation of the ComputedAttribute interface. The following sections describe how to define a computed attribute for CentraSite.
Implementation Guidelines for Java-Based Computed Attributes
This section describes the Java interfaces and methods that you need to implement for a computed attribute.
Interfaces
Description
ComputedAttribute
This interface declares basic rendering methods for the user interface. It extends the ProfileAttribute interface.
boolean: isUsed(): returns true if this attribute is used by at least one instance of the corresponding asset type.
Collection: setValue(Collection): sets the value of this attribute.
AttributeDescriptor: getAttributeDescriptor(): returns the definition of this attribute.
String: getName(): returns the JAXR-based name of this attribute.
Collection: getValue(): returns the value of this attribute.
init(): adds the required parameters to the objects argument for attribute initialization.
Collection<Concept>: getTargetObjectTypes(): returns the appropriate target registry object of this attribute. This method is used when the attribute is of the relationship data type.
Concept: getAssociationType(): returns the appropriate association type of this attribute. This method is used when the attribute is of the relationship data type.
ClassificationScheme: getTaxonomy(): returns the appropriate classification scheme of this attribute. This method is used when the attribute is of the classification data type.
ProfileAttribute
void: init(Collection<CentraSiteRegistryObject>, Locale)
Collection: getValue();
String: getAttributeKey();
AttributeDescriptor: getAttributeDescriptor();
AttributeDescriptor
This interface deals with the standard properties (isReadOnly(), is Required()...) for an attribute.
String: getDataType(): returns the data type of this attribute. This can be one of the supported standard types (xs:...), or one of the special types: File, RichText, Image (allows the specification of the image type).
Object: getDefaultValue(): returns the default value of this attribute.
String[]: getEnumValues():
int: getMaxLength(): returns the maximum length of this attribute.
String: getMaxOccurs(): returns whether the attribute can have multiple occurrences.
String: getMinOccurs(): returns whether the attribute is optional or required.
Object: getNativeAtribute(): returns the native attribute instance if the data type is not primitive, otherwise returns null.
int: getPrecision(): gets the precision for a number attribute.
String: getUnitLabel(): returns the slot's unit label.
boolean: hasDefaultValue(): returns whether this attribute has a default value.
boolean: isPrefix(): Returns true if the slot's unit label is a prefix, and false if it is a suffix.
boolean: isReadOnly(): returns whether this attribute is read-only.
boolean: isRequired(): returns whether this attribute is required.
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.attr.impl.class=
com.sample.StringAttrImpl
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 a sample Java code for implementing a computed attribute (in the demos folder) that you can use to create an archive file for the computed attribute. The sample code is available in the files:
*ComputedAttribute.java
*ProfileAttribute.java
*AttributeDescriptor.java
Loading a Computed Attribute into an Asset Type Definition
After you have created an archive file that contains the attribute 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 existing asset type, or the Add Asset Type wizard for a new custom asset type and specifying in the wizard that you are defining a new computed attribute.
For procedures on how to load an archive file of a computed attribute into an asset type definition, see CentraSite User’s Guide.
When you have loaded the archive file, the new attribute is displayed in the list of attributes that can be assigned to an asset type profile.
Copyright © 2015- 2017 Software AG, Darmstadt, Germany. (Innovation Release)

Product LogoContact Support   |   Community   |   Feedback