The auto naming feature of RM API enables custom applications
to customize the name that is generated for a record. This makes it
possible for you to define a record-naming pattern that is consistent
with your business processes. The RM Java™ API defines the
RMAutoName interface that specifies the
getName method. The following line of code shows the method signature
of this method:
public String getName(String name, int liRMEntityType);
A custom application using the auto naming feature
must provide an implementation class for the RMAutoName interface,
include this implementation in the classpath, then register this implementation
with RM using the
RMDriverManager class.
For example, if you create CustomAutoNameImpl class as the implementation
class of RMAutoName interface and include it in the classpath, you
can register it using the following code snippet:
//registers auto-naming for the object store
public void registerAutoName()
{
RMDriverManager loDriverManager = new RMDriverManager();
RMAutoName loAutoName = new CustomAutoNameImpl();
loDriverManager.registerAutoName(loAutoName);
}
After the class is registered,
records can be declared passing the abAutoName parameter
(as true) in the
declare method. To retrieve the auto name of the
record from the implementation class, the RM Java API will instantiate
the registered implementation, passing the record name and the RMEntityType of
the record. The name that is obtained will be the name of the record.
Note: If you have created more than one implementation of the RMAutoName interface,
the RM Java API will always invoke the last registered implementation.
This means that you can execute only one registered implementation
of the RMAutoName interface.