Home > DOCUMENTUM > How to Use the savelock() and checkInEx(…) methods in TBO ?

How to Use the savelock() and checkInEx(…) methods in TBO ?

May 11, 2010

1.saveLock (…) Method:

saveLock method can be overridden when not using a template for creation of document as discussed in my earlier post.

Also the method can be overridden in following scenario:

For modifying a document’s metadata, one doesn’t have to checkout a document in WebTop. Any validations which need to be done if metadata for a document is changed can be incorporated in this method.

Code snippet:

public void saveLock() throws DfException{
IDfSession session = null ;
IDfPersistentObject docObject = null ;
try{
session = getSession() ;
docObject = session.getObject(getObjectId()) ;

}catch( Exception e ) {

// failed to create

if( e instanceof DfException )
throw (DfException)e;
throw new DfException( DfException.DM_NOTDFC_E_JAVA,
e.toString() );
}

// CREATING FOLDER STRUCTURE WHEN NO TEMPLATE

if(docObject.getString(“subject”).equals(“false”)){
// create folder structure
docObject.setString(“subject” ,”true”);
}

// CAN DO ANY VALIDATIONS IF META DATA IS MODIFIED.

super.saveLock() ;
}

2.checkInEx(…) Method:

The method will be invoked before the document which is checked out gets checked in. The operations which can be done in this method can be like applying life cycle to the document, maintaining relationships between different types of documents.

Code snippet:

public IDfId checkinEx( boolean fRetainLock, String strVersionLabels,
String strOldCompoundArchValue, String strOldSpecialAppValue,
String strNewCompoundArchValue, String strNewSpecialAppValue)
throws DfException {

//applying lifecycle

//applyLifeCycle(docId, “”) ;

// CAN DO OTHER OPERATIONS BEFORE CALLING SUPERCLASS’S METHOD.

IDfId docId = super.checkinEx( fRetainLock, strVersionLabels,
strOldCompoundArchValue,strOldSpecialAppValue,
strNewCompoundArchValue, strNewSpecialAppValue );
return docId ;
}

Categories: DOCUMENTUM Tags: , ,
%d bloggers like this: