CentraSite 10.5 | CentraSite Developer's Guide | Application Framework | Revision Management
 
Revision Management
CentraSite versioning capabilities make it possible to create a new version of an object at any point in time. However, the new version is per definition a new object instance which has to go through the whole lifecycle again, firing creation policies, and so on. There is often a demand for versioning capabilities that allow a defined state of the same object to be restored and referenced. Such a defined state is referred to as a checkpoint.
The CSAF interfaces related to versioning are com.softwareag.centrasite.appl.framework.persistence.revision.RevisionManager and com.softwareag.centrasite.appl.framework.beans.RevisionBean.
The CentraSite revisioning feature can be enabled system-wide, which means that every object modification (create/update) of any instance of any type leads to the creation of a checkpoint.
A checkpoint has the following identifying attributes: a minor version number, a label, and a timestamp. The minor version number is incremented each time a checkpoint is created. The label is an optional description that can be used to add information about the change. Also a timestamp that reflects the date of the checkpoint creation is recorded with the checkpoint. The creation of a new checkpoint is recorded in the audit log.
It is possible to reference one specific checkpoint of an object directly and retrieve all of its data as it was at the point in time when the checkpoint was created. This implies that changes made to the object after the checkpoint took place are not reflected in the retrieved checkpoint. Note that the checkpoints provide read-only access to the data; any attempt to update a checkpoint raises an exception. However the current object can be updated.
Reading a bean instance from the registry using BeanPool.read() always returns the current (latest) state of an object.
Deleting an object also deletes all of its checkpoints.
It is possible to purge a set of checkpoints to reduce the amount of data consumed by keeping older states of the object.
Note that in order to use the Revision functionality, the StandaloneRegistryProvider instance must be created with the browser Behaviour flag set to false.
Usage Sample for Revision Management
package com.softwareag.centrasite.appl.framework.persistence.tests;
 
import java.util.ArrayList;
import java.util.Collection;
 
import com.softwareag.centrasite.appl.framework.SessionContext;
import com.softwareag.centrasite.appl.framework.beans.RevisionBean;
import com.softwareag.centrasite.appl.framework.beans.standard.Service;
import com.softwareag.centrasite.appl.framework.persistence.BeanPool;
import
com.softwareag.centrasite.appl.framework.persistence.revision.RevisionManager;
 
public class Revisioning {
private static String checkpointName = "MyLabel";
 
public void revisioning() throws Exception {
SessionContext sessionContext = initSessionContext();
BeanPool beanPool = sessionContext.getCurrentBeanPool();
 
RevisionManager revManager = sessionContext.getRevisionManager();
 
//enable the feature if needed
if (!revManager.isRevisioningEnabled()) {
revManager.enableRevisioning();
}
 
// create new checkpoint
Service bean = beanPool.read(Service.class, "uddikey");
revManager.setCheckpoint(bean, checkpointName);
 
// get all checkpoints including the current state object
Collection<RevisionBean> checkpoints = revManager.getRevisionBeans(bean);
 
// restore to the only checkpoint
Collection<RevisionBean> restoreObjs = new ArrayList<RevisionBean>();
for (RevisionBean rev : checkpoints) {
if (rev.isRevision()) {
restoreObjs.add(rev);
break;
}
}
 
revManager.restoreBeans(restoreObjs);
 
// delete checkpoints based on label
revManager.deleteBeans(checkpointName);
}
 
private SessionContext initSessionContext() {
//initialize CSAF
return null;
}
 
}