# Package com.documentum.fc.lifecycle

package com.documentum.fc.lifecycle

Provides interfaces for defining logic on lifecycles. This logic falls into two primary categories. The first category pertains to state changes that occur on documents attached to lifecycles, the second is validation of the lifecycle prior to its use.

The following interfaces pertain to state changes:

- IDfLifecycleUserEntryCriteria allows for checking whether a document satisfies the pending state change. An exception or return value of false prevents the state change from occurring.
- IDfLifecycleUserAction provides for changing the document as it undergoes the state change. An exception causes the state change to fail.
- IDfLifecycleAction also provides for changing the document as it undergoes the state change. This interface is different from IDfLifecycleUserAction in that it is used for predefined actions accessible through a lifecycle definition tool such as Composer. An exception causes the state change to fail.
- IDfLifecycleUserPostProcessing defines actions to be taken after the state change has complete. An exception does not have an impact on the state change.

The interface IDfLifecycleValidate is used to verify the lifecycle definition is valid prior to installing it.

The following example code demonstrates how to establish a session and create a document:

    public class PublishedState

      implements IDfLifecycleUserEntryCriteria,
                 IDfLifecycleUserAction,
                 IDfLifecycleUserPostProcessing,
                 IDfModule
    {

      private boolean isReviewSignedOff (IDfSysObject obj)
        throws DfException
      {
        IDfQuery query = new DfQuery();
        query.setDQL ("select user_name from dm_audittrail " +
                      "where event_name = 'dm_signoff' and " +
                      "audited_obj_id = '" + obj.getObjectId().toString() + "' and " +
                      "string_2 = 'REVIEWED'");

        IDfCollection collection = query.execute (obj.getSession(), DfQuery.DF_READ_QUERY);
        boolean result = collection.next();
        collection.close();
        return result;
      }

      private void publishSignOff (IDfSysObject obj, String userName)
        throws DfException
      {
        obj.signoff (userName, "", "PUBLISHED");
      }

      public boolean userEntryCriteria(IDfSysObject obj,
                                       String userName,
                                       String targetState)
        throws DfException
      {
        return isReviewSignedOff (obj);
      }

      public void userAction(IDfSysObject obj,
                             String userName,
                             String targetState)
        throws DfException
      {
        obj.mark ("PUBLISHED");
      }

      public void userPostProcessing (IDfSysObject obj,
                                      String userName,
                                      String targetState)
        throws DfException
      {
        publishSignOff (obj, userName);
      }
    }

- Interfaces
  Class
  Description
  IDfLifecycleAction
  Interface for a Java method implementing a system-defined action to be taken on entering a lifecycle state.
  IDfLifecycleUserAction
  Interface for a Java method implementing user defined actions to be taken on entering a Lifecycle state.
  IDfLifecycleUserEntryCriteria
  Interface for a Java method implementing user defined entry criteria for a Lifecycle.
  IDfLifecycleUserPostProcessing
  Interface for a Java method implementing user defined actions to be taken after an object has changed Lifecycle state.
  IDfLifecycleValidate
  Interface for a Java method implementing user defined validation on a Lifecycle before it can be installed.