Arbortext Command Language > Repository API > Customizing Entity Names for Objects
  
Customizing Entity Names for Objects
When you create a new entity object by inserting an object from the browser, a function in the Repository API automatically assigns that entity a unique name (for example, E1340). If you wish, you can write your own function for creating entity names, and substitute it in place of the default function.
To substitute your own entity naming function:
Create an ACL function that creates your desired unique entity names. Observe the following guidelines when creating this function.
Your function should accept the following arguments:
sesshdl — ACL session handle for the current Arbortext Editor/adapter connection.
poid — Persistent Object ID for the entity to be created.
is_graphic — Boolean value indicating whether the new entity object is a graphic. One (1) indicates a graphic entity; zero (0) indicates a non-graphic entity.
doc — ACL document ID for the top level document object.
Your function should return a unique entity name in the form &entname where entname is the name for the entity, and the & is a required prefix character. If a given document contains two different entities that possess the same entity name, the first of the two entities declared will appear in place of both entity references. If you are unsure if your function will always return unique names, you should implement the entitydeclconflicthook and create a function to handle the case when duplicate names are created.
The ACL package that contains your entity naming function must be loaded before a user can connect to the repository. Since it is common for documents of different document type definitions (DTDs) to reside in unique document databases, it is typical that the entity naming function be added to the doctype.acl file, where doctype is the file system name for the document type you are using. This would guarantee that the entity naming function would be loaded whenever a file of that document type is loaded/created.
In the file where you create your entity naming function, set the global variable that defines the name of the entity naming function. Add the following line to the file containing your function:
$dms::entity_naming_function = "my_function_name
"
In the example above, my_function_name is the name of your desired entity naming function. Make sure that the function name is surrounded by double-quotation marks (").