Server-side ID generation and project attribute validation
You can set up a template to use custom routines to generate ID values automatically, and to validate values entered on the Summary tab of an object. The ID values that you can set up for automated generation include the identifiers for a project, plan, or program.
To define a custom ID generator, you must write a Java class that implements the com.unicacorp.uap.project.helper.PidGenerate interface. Within the template definition, you can then specify your Java class name as the value for pidGenClass attribute, and use the pidprefix attribute to include an optional prefix.
In a similar manner, you can also define custom routines to validate attribute values of a project, plan, or program. To define a custom validation routine, you must write a Java class that implements the following interface: com.unicacorp.uap.common.template.IdValidate.
Within the project template definition, you can then specify your Java class name as the value for validateClass attribute.
Example server-side ID generation
Assume that you have a custom marketing object type for offers. You want its template to generate a custom code for each offer instance that is created. The codes must have the following characteristics:
*
*
*
To set up automated ID generation, you use the IdGenerate interface and follow these steps.
1.
Create a custom Java implementation named CustomComponentPidGenerateImpl.java. See Sample Java interface.
*
This implementation uses a file, IDRange.properties, to hold the minimum and maximum values for the custom IDs.
*
2.
Compile the class. The compiled class is named CustomComponentPidGenerateImpl.class.
3.
<MarketingOperations_Home>\unwar\WEB-INF\classes\com\unica\uap\component\helper
4.
Create a file named IDRange.properties, and add the following text to this file:
mktOBJId.min=900001
mktOBJId.max=999999
5.
Copy this file to the <MarketingOperations_Home>\unwar\WEB-INF directory.
6.
*
*
7.
8.
9.
In the ID Generation Class field, use the fully qualified class name or canonical name to specify the custom class, as shown here:
CustomComponentPidGenerateImpl
When you create the first offer from this template, note that its ID is 900001.