4.6. Identifiers and Equality

Every CapObject and CapType is equipped with a stable string ID that can be persistently stored and converted back into an object reference as needed. To this end, CapObject has got a method getId() for retrieving the ID. Methods for converting IDs into object references are typically provided by the repository objects.

It is recommended that you treat the IDs as opaque strings, because the exact format of the strings might change in future releases of CoreMedia CMS. Still, CoreMedia provides detail information about the IDs for the purposes of debugging and for interfacing the Unified API with legacy clients which might insist on using numeric IDs.

The class com.coremedia.cap.common.IdHelper is provided for formatting and parsing all sorts of ID strings. Note that all methods in that class may be redefined arbitrarily in the next CoreMedia CMS release.

The following table summarizes the various ID formats for CapObjects.

ID string Interface Description

coremedia:///cap/content/<int>

Content

document or folder

coremedia:///cap/version/<int>/<int>

Version

version of document

parameters: numeric content ID/version number

coremedia:///cap/process/<int>

Process

process

coremedia:///cap/task/<int>/<int>

Task

task

parameters: numeric process ID/numeric task ID

coremedia:///cap/initialview/<int>

WorkflowView

initial process view

parameter: numeric process ID

coremedia:///cap/processview/<int>

WorkflowView

ordinary process view

parameter: numeric process ID

coremedia:///cap/taskview/<int>/<int>

WorkflowView task view parameters: numeric process ID/numeric task ID

coremedia:///cap/user/<int>

User user

coremedia:///cap/group/<int>

Group group

Table 4.3. ID formats for CapObject


The CapTypes are also identified by an ID.

ID string Interface Description

coremedia:///cap/contenttype/<string>

ContentType content type

coremedia:///cap/grammar/<string>

XmlGrammar XML grammar

coremedia:///cap/processdefinition/<int>

ProcessDefinition process definition parameter: numeric process definition ID

coremedia:///cap/taskdefinition/<int>/<int>

TaskDefinition

task definition

parameters: numeric process definition ID/numeric task definition ID

coremedia:///cap/initialviewdefinition/<int>

WorkflowViewDefinition

initial process view definition

parameter: numeric process definition ID

coremedia:///cap/processviewdefinition/<int>

WorkflowViewDefinition ordinary process view definition parameter: numeric process definition ID

coremedia:///cap/taskviewdefinition/<int>/<int>

WorkflowViewDefinition task view definition parameters: numeric process definition ID/numeric task definition ID

Table 4.4. ID formats for CapType


There are some other objects that are also assigned an ID, but that do not implement CapObject or CapType. Such objects implement the method getId(), but they do not provide getters and setters for properties.

ID string Interface Description

coremedia://cap/publication/<int>

Publication a publication that has been enqueued

coremedia://cap/publicationtarget/<string>

PublicationTarget a publication target

coremedia://cap/session/<int>

CapSessionInfo a session that has been opened on the Content Server

coremedia://cap/service/<int>

CapServiceInfo a service of the Content Server for which logins are possible

Table 4.5. ID formats for other objects


Unified API objects that define an ID are equal in the sense of Object.equals(Object), if and only if their IDs are equal and if they belong to the same Unified API connection.

Class Diagram: Repositories and Identified Objects

Figure 4.4. Class Diagram: Repositories and Identified Objects


It is recommended to use the IDs for external storage only. The identified objects of the Unified API are lightweight, so that it makes no sense to store IDs in main memory for a long time. IDs are more difficult to handle and often larger than their object counterparts. But for storage in a database or a file, IDs come in handy.

IDs are also used by some of the administrative command line tools and for generating debugging output.