Whenever an object is published to the Registry, and whenever it is modified in any way, the JAXR provider creates another object, called an AuditableEvent. The JAXR provider adds the AuditableEvent object to the audit trail for the published object. The audit trail contains a list of all the events for that object. To retrieve the audit trail, call RegistryObject.getAuditTrail. You can also retrieve the individual events in the audit trail and find out their event types. JAXR supports the event types listed in Retrieving the Audit Trail of an Object.
Table 3–4 AuditableEvent Types
Event Type |
Description |
---|---|
EVENT_TYPE_CREATED |
Object was created and was published to the registry. |
EVENT_TYPE_DELETED |
Object was deleted using one of the LifeCycleManager or BusinessLifeCycleManager deletion methods. |
EVENT_TYPE_DEPRECATED |
Object was deprecated using the LifeCycleManager.deprecateObjects method. |
EVENT_TYPE_UNDEPRECATED |
Object was undeprecated using the LifeCycleManager.unDeprecateObjects method. |
EVENT_TYPE_VERSIONED |
A new version of the object was created. This event typically happens when any of the object’s attributes changes. |
EVENT_TYPE_UPDATED |
Object was updated. |
EVENT_TYPE_APPROVED |
Object was approved using the LifeCycleManagerImpl.approveObjects method (implementation-specific). |
EVENT_TYPE_DOWNLOADED |
Object was downloaded (implementation-specific). |
EVENT_TYPE_RELOCATED |
Object was relocated (implementation-specific). |
The following code fragment retrieves the audit trail for a registry object, displaying the type and timestamp of each event:
Collection events = obj.getAuditTrail(); String objName = obj.getName().getValue(); Iterator eventIter = events.iterator(); while (eventIter.hasNext()) { AuditableEventImpl ae = (AuditableEventImpl) eventIter.next(); int eType = ae.getEventType(); if (eType == AuditableEvent.EVENT_TYPE_CREATED) { System.out.print(objName + " created "); } else if (eType == AuditableEvent.EVENT_TYPE_DELETED) { System.out.print(objName + " deleted "); } else if (eType == AuditableEvent.EVENT_TYPE_DEPRECATED) { System.out.print(objName + " deprecated "); } else if (eType == AuditableEvent.EVENT_TYPE_UNDEPRECATED) { System.out.print(objName + " undeprecated "); } else if (eType == AuditableEvent.EVENT_TYPE_UPDATED) { System.out.print(objName + " updated "); } else if (eType == AuditableEvent.EVENT_TYPE_VERSIONED) { System.out.print(objName + " versioned "); } else if (eType == AuditableEventImpl.EVENT_TYPE_APPROVED) { System.out.print(objName + " approved "); } else if (eType == AuditableEventImpl.EVENT_TYPE_DOWNLOADED) { System.out.print(objName + " downloaded "); } else if (eType == AuditableEventImpl.EVENT_TYPE_RELOCATED) { System.out.print(objName + " relocated "); } else { System.out.print("Unknown event for " + objName + " "); }System.out.println(ae.getTimestamp().toString()); }
Some of the examples have a showAuditTrail method that uses code similar to this. See, for example, JAXRSearchByName.java in the directory <INSTALL>/registry/samples/search-name/src.
See Changing the State of Objects in the Registry for information on how to change the state of registry objects.