Checking which fault is set for an activity

Steps for this task

  1. List the task activities that are in a failed or stopped state.
    QueryResultSet result = 
         process.query("ACTIVITY.AIID", 
                       "(ACTIVITY.STATE = ACTIVITY.STATE.STATE_FAILED OR 
                         ACTIVITY.STATE = ACTIVITY.STATE.STATE_STOPPED) AND 
                         ACTIVITY.KIND=ACTIVITY.KIND.KIND_STAFF",
                         (String)null, (Integer)null, (TimeZone)null); 
    This action returns a query result set that contains failed or stopped activities.
  2. Read the name of the fault.
    if (result.size() > 0)
    {
      result.first();
      AIID aiid = (AIID) result.getOID(1);
      ClientObjectWrapper faultMessage = process.getFaultMessage(aiid);
      DataObject fault = null ;
      if ( faultMessage.getObject() != null && faultMessage.getObject() 
           instanceof DataObject )
      {
        fault = (DataObject)faultMessage.getObject();
        Type type = fault.getType();
        String name = type.getName();
        String uri = type.getURI();
      }
    }

    This returns the fault name. You can also analyze the unhandled exception for a stopped activity instead of retrieving the fault name.


Copyright IBM Corporation 2005, 2006.
This information center is powered by Eclipse technology (http://www.eclipse.org)