DFC DfOperations Classes – Part 3

In this post I will show you how to take the general implementation of the DfOperation class described in the last post, and turn it into a concrete implementation for the Checkout operation.

I recently discovered that DfOperation code written on a 32-bit Windows machine would not run on a 64-bit Windows machine.  The operation classes make heavy use of the Registry, and the 32-bit Registry code does not run properly on a 64-bit machine.  The simple solution was to tell the DFC to use a file-based Registry instead of the system Registry.  Add this line to your dfc.properties file and you will be fine.


Checkout Operation

The Checkout operation will lock and download content for all sysobjects passed to it. It also creates registry entries (so they can be checked in or cancelled), and will patch XML files if needed.

private void doCheckoutOp(ArrayList objList, String checkoutDir) {

try {

  // #1 - manufacture a specific operation
  IDfCheckoutOperation checkoutOpObj = cx.getCheckoutOperation();

  // #2 - add objects to the operation for processing
  for (IDfSysObject sObj : objList) {

// #3 - set operation params

  // #4 - execute the operation
  boolean result = checkoutOpObj.execute();

  // #5 - check for errors
  if (!result) {
    IDfList errors = checkoutOpObj.getErrors();
    for (int i=0; i<errors.getCount(); i++) {
      IDfOperationError err = (IDfOperationError) errors.get(i);
      System.out.println("Error in Checkout operation: " + err.getErrorCode() + " - " + err.getMessage());
  } else {

    // #6 - get new obj ids
    IDfList newObjs = checkoutOpObj.getObjects();
    for (int i=0; i<newObjs.getCount(); i++) {
      IDfSysObject sObj = (IDfSysObject) newObjs.get(i);
      System.out.println("\tchecked out " + sObj.getObjectId().toString());

    // #7 - open checked out files
    IDfList checkedOutNodes = checkoutOpObj.getRootNodes();
    for (int i=0; i<checkedOutNodes.getCount(); i++) {
      IDfCheckoutNode  nodeObj = (IDfCheckoutNode) checkedOutNodes.get(i);
      String path = nodeObj.getFilePath();
      if (path != null && path.length() > 0) {
        Runtime.getRuntime().exec("rundll32 SHELL32.DLL,ShellExec_RunDLL " + nodeObj.getFilePath());

  } catch(Exception e) {
    System.out.println("Exception in Checkout operation: " + e.getMessage());

Most of the details in this code were covered in the previous post, but there are a few areas specific to the Checkout operation I want to point out.

  • #3 – sets two operation parameters that are specific to the DfCheckout operation. The setDestinationDirectory parameter sets the location for the content files to be downloaded to, and the setDownloadContent parameter tells the operation to download the content files. It is possible to checkout files and not download the content by setting this parameter to false.
  • #6 – simply gets a list of all the objects that were checked out.
  • #7 – if you want to manipulate the objects that were checked out, use the getRootNodes() method. This method will get each checked out object as a IDfCheckoutNode object that includes information such as where the object’s content was checked out. The next few lines of code demonstrate how to automatically have Windows open the checked out files.

Next post we’ll take a look at checking these objects back in and cancelling the checkout operation.


About Scott
I have been implementing Documentum solutions since 1997. In 2005, I published a book about developing Documentum solutions for the Documentum Desktop Client (ISBN 0595339689). In 2010, I began this blog as a record of interesting and (hopefully) helpful bits of information related to Documentum, and as a creative outlet.

One Response to DFC DfOperations Classes – Part 3

  1. Pingback: DFC DfOperations Classes – Part 4 « dm_misc: Miscellaneous Documentum Tidbits and Information

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: