Server-side ID generation and project attribute validation
You can set up a template to use custom routines to generate project IDs and validate values on the Summary tab including the generated ID when the project, plan, or program is saved.
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 any desired prefix to append to that generated ID using the pidprefix attribute. 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
For example, assume that you have an offer marketing object template, and you need to generate custom codes for all the offers created from this template. The codes must have the following characteristics:
*
*
*
To do this, perform the following steps:
1.
Create a custom Java implementation named CustomComponentPidGenerateImpl.java.
Note the following:
*
This implementation uses a file, IDRange.properties, to hold the minimum and maximum values for the custom IDs.
*
It uses a database table, CUST_GENIDS, to hold the current value of the custom ID for each object type that uses the class to generate custom IDs.
2.
Compile the class. The compiled class is named CustomComponentPidGenerateImpl.class.
3.
Copy the class file into the following folder under your Operações de Marketing installation:
\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 \unwar\WEB-INF folder under your Operações de Marketing installation.
6.
*
*
7.
8.
9.
In the ID Generation Class field, specify the custom class using the fully qualified class name or the canonical name, as shown here:
CustomComponentPidGenerateImpl
When you create the first customIDs marketing object, note that its ID is 900001.