Show TOC

Background documentationChecking the Change Recording State of a PCM Object Locate this document in the navigation structure

 

The following example shows how to check the change recording state of a PCM object:

Syntax Syntax

  1. //Get the IAdminBase representation of an object
    	IAdminBase objAdminBase = getAdminBase(objectPath);
    
    	//Get the IChangeRecordingInfo implementation for the object
    	IChangeRecordingInfo crInfo = (IChangeRecordingInfo) objAdminBase.getImplementation(IAdminBase.CHANGE_RECORDING_INFO);
    
    	//Get all change recording information for the object
    	//Check if changes to the object are recorded
    	boolean isRecorded = crInfo.isRecorded();
    
    	if (isRecorded){
    		//If the object is recorded, get the ID of the changelist containing it
    		String changeListId = crInfo.getChangeListId();
    
    		//If the changelist ID is not null, the object is checked out
    		if (changeListId != null){
    		//In this case, the object has an owner (the owner of the containing changelist)
    		String ownerId = crInfo.getOwnerId();
    
    		//Check whether the object was created, deleted or modified  
    		ChangeRecordingState changeRecordingState = crInfo.getChangeRecordingState();
    		switch (changeRecordingState) {
    		case ADDED:
    			//Object was created 
    			break;
    		case DELETED:
    			//Object was deleted 
    			break;
    		case MODIFIED:
    			//Object was modified 
    			break;
    		case NOT_CHANGED:
    			//This should not happen, because the object is checked out in a changelist
    			throw new IllegalStateException();
    		}
    	}
    }
    
End of the code.