示例#1
0
  private void addFallBackResult(Inquiry request, IndexQuery query, IndexQueryResult result) {
    try {
      Set<String> attributes = new HashSet<>();
      for (ResultField resultField : request.getResultfields()) {
        attributes.add(resultField.getName());
      }
      Map<String, String> noData = getFallbackDataProvider().getNoResultData(attributes);
      if (noData == null || noData.isEmpty()) {
        return;
      }

      Item item = new Item();
      for (ResultField resultField : request.getResultfields()) {
        String attrName = resultField.getName();
        String value = noData.get(resultField.getName());
        RField rField = new RField().withName(attrName).withValue(value);
        item.withRfields(rField);
      }
      item.setObjectname(getAttributeMapping().getDefaultType());
      item.setMediastatus("m");

      if (request.getImages() == YNBool.Y) {
        ImageProcessor imageProcessor =
            new ImageProcessor(request, query, getFallbackDataProvider());
        imageProcessor.processNoResultImage(item);
      }

      result.withItems(item);
    } catch (DfException ex) {
      Logger.error(ex.getMessage(), ex);
      handleException(ex, result);
    }
  }
示例#2
0
  private IndexQueryResult processSearchRequest(Inquiry request, IndexQuery query) {
    IndexQueryResult result = new IndexQueryResult().withQueryname(query.getQueryname());

    try {
      int maxRows = _maxRows;
      if (request.getMaxrows() != null) {
        int requestRows = request.getMaxrows();
        if (requestRows != 0 && requestRows < maxRows) {
          maxRows = requestRows;
        }
      }

      boolean hasMore =
          invokeInSession(
              request.getSecurityToken(),
              new IndexQueryInvoker(
                  request,
                  query,
                  result,
                  getAttributeMapping(),
                  getFallbackDataProvider(),
                  maxRows));

      if (hasMore) {
        Logger.debug("Result contains more than " + maxRows + " rows, adding limit reached flag");
        result.setLimitreached(new LimitReached());
      }
    } catch (DfException ex) {
      Logger.error(ex.getMessage(), ex);
      handleException(ex, result);
    }
    return result;
  }
示例#3
0
 @Override
 protected void sqlDrop(final String tableName, final IDfSession session) {
   try {
     final String query = "select * from dm_dbo." + tableName + " enable(return_top 1) ";
     DeployUtil.execDqlVoid(query, session);
     LOGGER.info("Drop: " + tableName);
     final String qr =
         "execute exec_sql with query=" + DeployUtil.prepareForExecSQL("drop view " + tableName);
     DeployUtil.execDqlVoid(qr, session);
   } catch (final DfException e) {
     LOGGER.warn("Problem dropping view. Skipped: " + e.getMessage());
   }
 }
  private int getExecutionCountForLogs(IDfDocument idfLogObject) {
    int executionCount = 0;
    try {
      executionCount = idfLogObject.getInt(IConstants.ATTR_LOG_EXECUTION_COUNT);

      DfLogger.debug(this, "Old Execution Count : " + executionCount, null, null);

      executionCount = executionCount >= 2 ? 0 : executionCount + 1;
      DfLogger.debug(this, "New Execution Count : " + executionCount, null, null);
    } catch (DfException e) {
      DfLogger.error(this, e.getStackTraceAsString(), null, null);
      throw new RuntimeException(e.getMessage());
    }
    return executionCount;
  }
  private void setAttachmentToArticleForElf(
      IDfSession idfSession,
      IDfDocument idfAttachmentDocObj,
      String strArticleFolderPath,
      String strStageFolderName,
      String strDeliveryFolderName) {
    DfLogger.debug(
        this, utilObj.getSpaces() + "Inside method setAttachmentToArticleForElf.", null, null);
    Boolean isCheckedOut = false;
    IDfDocument docObj = null;
    String strObjectName = "";
    boolean isLogObject = false;
    boolean isImageObject = false;
    String strObjectType = "";
    String strItemType = "";
    String strLogCategory = "";
    String strLogType = "";

    StringBuilder strFolderPah = new StringBuilder(strArticleFolderPath + "/" + strStageFolderName);

    try {
      strObjectName = idfAttachmentDocObj.getObjectName();
      DfLogger.debug(null, "strObjectName-->" + strObjectName, null, null);

      if (strObjectName.toLowerCase().contains(IConstants.STR_CHECK_PDF_ONLINE)
          && strObjectName.toLowerCase().endsWith(".pdf")) {

        strItemType = IConstants.ITEM_TYPE_CHECK_PDF_ONLINE;
        strObjectType = IConstants.TYPE_WORKITEM_OBJECT;
        strFolderPah.append(IConstants.PATH_GRAPHICS_FOLDER);
      } else if (strObjectName.toLowerCase().contains(IConstants.STR_CHECK_PDF_PRINT)
          && strObjectName.toLowerCase().endsWith(".pdf")) {

        strItemType = IConstants.ITEM_TYPE_CHECK_PDF_PRINT;
        strObjectType = IConstants.TYPE_WORKITEM_OBJECT;
        strFolderPah.append(IConstants.PATH_GRAPHICS_FOLDER);
      } else if (strObjectName.toLowerCase().contains(IConstants.STR_COLOR_ON_PAGE_PRINT)
          && strObjectName.toLowerCase().endsWith(".pdf")) {

        strItemType = IConstants.ITEM_TYPE_COLOR_ON_PAGE_PRINT;
        strObjectType = IConstants.TYPE_WORKITEM_OBJECT;
        strFolderPah.append(IConstants.PATH_GRAPHICS_FOLDER);
      } else if (strObjectName.toLowerCase().contains(IConstants.ELF_FILE_PREFIX_METADATA_XML)
          && strObjectName.endsWith(".xml")) {

        strObjectType = IConstants.TYPE_LOG_OBJECT;
        strLogCategory = IConstants.ATTR_LOG_CATEGORY_ELF_METADATA;

        isLogObject = true;
        strFolderPah.append(IConstants.PATH_GRAPHICS_FOLDER + "/" + IConstants.FOLDER_NAME_LOGS);
      } else if (strObjectName.toLowerCase().contains(IConstants.IMAGE_RENDITION_HTML)
          && (strObjectName.toLowerCase().endsWith(".jpg")
              || strObjectName.toLowerCase().endsWith(".gif"))) {

        strItemType = IConstants.ITEM_TYPE_ONLINE_IMAGE;
        strObjectType = IConstants.TYPE_WORKITEM_OBJECT;
        strFolderPah.append(IConstants.PATH_GRAPHICS_FOLDER + "/" + IConstants.ONLINE_FOLDER);
        isImageObject = true;
        DfLogger.debug(this, "isImageObject : " + isImageObject, null, null);
      } else if (strObjectName.toLowerCase().contains(IConstants.ELF_FILE_PREFIX_ERROR_XML)
          && strObjectName.endsWith(".xml")) {

        strObjectType = IConstants.TYPE_LOG_OBJECT;
        strLogCategory = IConstants.ATTR_LOG_CATEGORY_ELF_MESSAGES;
        isLogObject = true;
        strFolderPah.append(IConstants.PATH_GRAPHICS_FOLDER + "/" + IConstants.FOLDER_NAME_LOGS);
      } else {

        // idfAttachmentDocObj.destroy();
        idfAttachmentDocObj.mark("DELETE");
        idfAttachmentDocObj.save();

        DfLogger.warn(
            this,
            "Unexpected file received : "
                + strObjectName
                + " | no operations required on Object.. ",
            null,
            null);
        return;
      }

      DfLogger.debug(this, "setAttachmentToArticle folder path : " + strFolderPah, null, null);

      if (!isLogObject) {
        docObj =
            (IDfDocument)
                idfSession.getObjectByQualification(
                    strObjectType
                        + " where Folder('"
                        + strFolderPah
                        + "') "
                        + " and object_name = '"
                        + idfAttachmentDocObj.getObjectName()
                        + "' and item_type='"
                        + strItemType
                        + "'");

        DfLogger.debug(
            this,
            strObjectType
                + " where Folder('"
                + strFolderPah
                + "') "
                + " and object_name = '"
                + idfAttachmentDocObj.getObjectName()
                + "' and item_type='"
                + strItemType
                + "'",
            null,
            null);
      } else {
        docObj =
            (IDfDocument)
                idfSession.getObjectByQualification(
                    strObjectType
                        + " where Folder('"
                        + strFolderPah
                        + "') "
                        + " and "
                        + IConstants.ATTR_LOG_CATEGORY
                        + " = '"
                        + strLogCategory
                        + "'");

        DfLogger.debug(
            this,
            strObjectType
                + " where Folder('"
                + strFolderPah
                + "') "
                + " and "
                + IConstants.ATTR_LOG_CATEGORY
                + " = '"
                + strLogCategory
                + "'",
            null,
            null);
      }

      if (docObj != null) {

        DfLogger.debug(
            this,
            utilObj.getSpaces()
                + "Existing version found.Creating new version inside Article Folder",
            null,
            null);
        // [TODO] see if checking of "if checked out" can be added in
        // executeCheckoutOperation
        if (docObj.isCheckedOut()) {
          docObj.cancelCheckout();
        }
        isCheckedOut = utilObj.executeCheckoutOperation(docObj);

        if (isCheckedOut) {
          IDfDocument idfNewVersion =
              utilObj.executeCheckinOperation(idfSession, docObj, idfAttachmentDocObj);
          if (idfNewVersion != null) {

            idfNewVersion.save();

            // idfAttachmentDocObj.destroy();
            // Pramod | Attachment object is no longer required on
            // creation of new version so it will be marked as
            // DELETE and will be deleted at the end of the
            // processing
            idfAttachmentDocObj.mark("DELETE");
            idfAttachmentDocObj.save();

            DfLogger.info(
                this,
                " ---------------------- "
                    + idfAttachmentDocObj.getObjectName()
                    + " Marked as to be deleted ",
                null,
                null);
          }
        }
      } else {
        DfLogger.debug(
            this,
            utilObj.getSpaces() + "New document processing. Linking to article folder",
            null,
            null);

        if (isLogObject == true) {
          DfLogger.debug(this, "Object Name of log file : " + strObjectName, null, null);
          IDfQuery qry = new DfQuery();
          String strObjId = idfAttachmentDocObj.getObjectId().getId();
          qry.setDQL(
              "change "
                  + IConstants.TYPE_WORKITEM_OBJECT
                  + " objects to dm_document where r_object_id='"
                  + strObjId
                  + "'");
          IDfCollection idfColl1 = qry.execute(idfSession, IDfQuery.DF_EXEC_QUERY);
          if (null != idfColl1 && IDfCollection.DF_CLOSED_STATE != idfColl1.getState()) {
            idfColl1.close();
          }
          qry.setDQL(
              "change dm_document objects to "
                  + IConstants.TYPE_LOG_OBJECT
                  + " where r_object_id='"
                  + strObjId
                  + "'");

          IDfCollection idfColl2 = qry.execute(idfSession, IDfQuery.DF_EXEC_QUERY);
          if (null != idfColl2 && IDfCollection.DF_CLOSED_STATE != idfColl2.getState()) {
            idfColl2.close();
          }
          idfAttachmentDocObj.fetch(null);
          idfAttachmentDocObj.setString(IConstants.ATTR_LOG_TYPE, strLogType);
          idfAttachmentDocObj.setString(IConstants.ATTR_LOG_CATEGORY, strLogCategory);
          idfAttachmentDocObj.setObjectName(strObjectName);
          idfAttachmentDocObj.save();
        }

        IDfACL folderAcl = idfSession.getFolderByPath(strFolderPah.toString()).getACL();

        if (isImageObject && strObjectName.split("_").length == 5) {
          idfAttachmentDocObj.setTitle(strObjectName.split("_")[3]);
        }

        idfAttachmentDocObj.setACL(folderAcl);
        idfAttachmentDocObj.unlink(idfAttachmentDocObj.getFolderId(0).toString());
        idfAttachmentDocObj.link(strFolderPah.toString());
        setWorkitemMetadata(idfAttachmentDocObj);

        idfAttachmentDocObj.save();
      }
      DfLogger.debug(
          this,
          utilObj.getSpaces() + "Method processAttachments completed successfully.",
          null,
          null);
    } catch (RuntimeException ex) {
      DfLogger.error(this, ex.getMessage(), null, null);
      throw ex;
    } catch (DfException e) {
      DfLogger.error(this, "Error occured in processing attachment: " + e.getMessage(), null, e);
    }
  }
  /**
   * Handles versioning for AMPP documents. Major version will be created if document of particular
   * type already exists in Article Delivery Folder.
   *
   * @param idfSession
   * @param idfAttachmentDocObj
   * @param strArticleFolderPath
   */
  private void setAttachmentToArticleForAMPP(
      IDfSession idfSession,
      IDfDocument idfAttachmentDocObj,
      String strArticleFolderPath,
      String strStageFolderName,
      String strDeliveryFolderName) {
    DfLogger.debug(this, utilObj.getSpaces() + "Inside method processAttachments.", null, null);
    Boolean isCheckedOut = false;
    IDfDocument docObj = null;
    String strObjectName = "";
    boolean isLogObject = false;
    String strObjectType = "";
    String strItemType = "";
    String strLogCategory = "";
    String strLogType = "";

    StringBuilder strFolderPah = new StringBuilder(strArticleFolderPath + "/" + strStageFolderName);

    try {
      strObjectName = idfAttachmentDocObj.getObjectName();

      if (strObjectName.toLowerCase().contains(IConstants.AMPP_FILE_SUFFIX_ARTICLE_XML)) {

        strItemType = IConstants.AMPP_WORKITEM_VALUE_XML;
        strObjectType = IConstants.TYPE_WORKITEM_OBJECT;
        strFolderPah.append(IConstants.PATH_AMPP_COPY_EDITING);
      } else if (strObjectName.toLowerCase().contains(IConstants.FILE_SUFFIX_ARTICLE_PDF)) {

        strItemType = IConstants.AMPP_WORKITEM_VALUE_ONLINE_PDF;
        strObjectType = IConstants.TYPE_WORKITEM_OBJECT;
        strFolderPah.append(IConstants.PATH_AMPP_COPY_EDITING);
      } else if (strObjectName
          .toLowerCase()
          .contains(IConstants.AMPP_FILE_SUFFIX_VALIDATION_LOGL)) {

        strObjectType = IConstants.TYPE_LOG_OBJECT;
        strLogCategory = IConstants.ATTR_LOG_CATEGORY_AMPP_CC;
        isLogObject = true;
        strFolderPah.append(IConstants.PATH_COPY_EDITING_LOG_FOLDER);
      } else if (strObjectName.toLowerCase().contains(IConstants.AMPP_FILE_PREFX_ERROR_LOG)
          && strObjectName.endsWith(".xml")) {

        strObjectType = IConstants.TYPE_LOG_OBJECT;
        strLogCategory = IConstants.ATTR_LOG_CATEGORY_AMPP_MESSAGES;
        strLogType = IConstants.LOG_TYPE_FAILURE;
        isLogObject = true;
        strFolderPah.append(
            IConstants.PATH_COPY_EDITING_FOLDER + "/" + IConstants.FOLDER_NAME_LOGS);
      } else if (strObjectName.toLowerCase().contains(IConstants.BREEZE_FILE_SUFFIX_ERROR_LOG)
          && strObjectName.endsWith(".txt")) {

        strObjectType = IConstants.TYPE_LOG_OBJECT;
        strLogCategory = IConstants.ATTR_LOG_CATEGORY_BREEZE;
        isLogObject = true;
        strFolderPah.append(
            IConstants.PATH_COPY_EDITING_FOLDER + "/" + IConstants.FOLDER_NAME_LOGS);
      } else if (strObjectName.toLowerCase().contains(IConstants.BREEZE_FILE_SUFFIX_SUCCESS_LOG)
          && strObjectName.endsWith(".txt")) {

        strObjectType = IConstants.TYPE_LOG_OBJECT;
        strLogCategory = IConstants.ATTR_LOG_CATEGORY_BREEZE;
        isLogObject = true;
        strFolderPah.append(
            IConstants.PATH_COPY_EDITING_FOLDER + "/" + IConstants.FOLDER_NAME_LOGS);
      } else if (strObjectName.toLowerCase().contains(IConstants.AMPP_FILE_SUFFIX_STYLED_DOC)) {

        for (String strExtensions : IConstants.AMPP_FILE_EXT_STYLED_DOC) {
          if (strObjectName.contains("." + strExtensions)) {
            strItemType = IConstants.AMPP_WORKITEM_VALUE_DOC;
            strObjectType = IConstants.TYPE_WORKITEM_OBJECT;
            strFolderPah.append(IConstants.PATH_COPY_EDITING_FOLDER);
            break;
          }
        }
      } else {
        idfAttachmentDocObj.destroy();
        throw new RuntimeException(
            "Unexpected file received : " + strObjectName + " | Destroyed Object.. ");
      }

      DfLogger.debug(this, "setAttachmentToArticle folder path : " + strFolderPah, null, null);

      if (!isLogObject) {
        docObj =
            (IDfDocument)
                idfSession.getObjectByQualification(
                    strObjectType
                        + " where Folder('"
                        + strFolderPah
                        + "') "
                        + " and item_type='"
                        + strItemType
                        + "'");
      } else {
        docObj =
            (IDfDocument)
                idfSession.getObjectByQualification(
                    strObjectType
                        + " where Folder('"
                        + strFolderPah
                        + "') "
                        + " and "
                        + IConstants.ATTR_LOG_CATEGORY
                        + " = '"
                        + strLogCategory
                        + "'");
      }

      idfAttachmentDocObj.getFile(null);

      if (docObj != null) {

        DfLogger.debug(
            this,
            utilObj.getSpaces()
                + "Existing version found.Creating new version inside Delivery Folder",
            null,
            null);
        // [TODO] see if checking of "if checked out" can be added in
        // executeCheckoutOperation
        if (docObj.isCheckedOut()) {
          docObj.cancelCheckout();
        }
        isCheckedOut = utilObj.executeCheckoutOperation(docObj);

        if (isCheckedOut) {
          utilObj.executeCheckinOperation(idfSession, docObj, idfAttachmentDocObj);
        }
      } else {
        DfLogger.debug(
            this,
            utilObj.getSpaces() + "New document processing. Linking to article folder",
            null,
            null);

        if (isLogObject == true) {
          DfLogger.debug(this, "Object Name of log file : " + strObjectName, null, null);
          IDfQuery qry = new DfQuery();
          String strObjId = idfAttachmentDocObj.getObjectId().getId();
          qry.setDQL(
              "change "
                  + IConstants.TYPE_WORKITEM_OBJECT
                  + " objects to dm_document where r_object_id='"
                  + strObjId
                  + "'");
          DfLogger.debug(this, qry.getDQL(), null, null);

          IDfCollection idfColl1 = qry.execute(idfSession, IDfQuery.DF_EXEC_QUERY);
          if (null != idfColl1 && IDfCollection.DF_CLOSED_STATE != idfColl1.getState()) {
            idfColl1.close();
          }

          qry.setDQL(
              "change dm_document objects to "
                  + IConstants.TYPE_LOG_OBJECT
                  + " where r_object_id='"
                  + strObjId
                  + "'");
          DfLogger.debug(this, qry.getDQL(), null, null);

          IDfCollection idfColl2 = qry.execute(idfSession, IDfQuery.DF_EXEC_QUERY);
          if (null != idfColl2 && IDfCollection.DF_CLOSED_STATE != idfColl2.getState()) {
            idfColl2.close();
          }
          idfAttachmentDocObj.fetch(null);
          idfAttachmentDocObj.setString(IConstants.ATTR_LOG_TYPE, strLogType);
          idfAttachmentDocObj.setString(IConstants.ATTR_LOG_CATEGORY, strLogCategory);
          idfAttachmentDocObj.setObjectName(strObjectName);
          idfAttachmentDocObj.save();
        }

        IDfACL folderAcl = idfSession.getFolderByPath(strFolderPah.toString()).getACL();
        DfLogger.debug(this, folderAcl.getObjectName(), null, null);

        idfAttachmentDocObj.setACL(folderAcl);
        idfAttachmentDocObj.unlink(idfAttachmentDocObj.getFolderId(0).toString());
        idfAttachmentDocObj.link(strFolderPah.toString());
        setWorkitemMetadata(idfAttachmentDocObj);
      }
      DfLogger.debug(
          this,
          utilObj.getSpaces() + "Method processAttachments completed successfully.",
          null,
          null);
    } catch (DfException e) {
      DfLogger.error(this, "Error occured in processing attachment: " + e.getMessage(), null, e);
    }
  }
  public boolean onCommitChanges() {
    /*-CONFIG-*/ String m = "onCommitChanges-";

    /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
      DfLogger.debug(this, m + "get State Transition config", null, null);
    StateTransitionConfigFactory config = StateTransitionConfigFactory.getSTConfig();
    /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
      DfLogger.debug(this, m + "get MRCS config task definition", null, null);
    MrcsWorkflowTask t = config.getMrcsWorkflowTask(m_mrcsapp, m_processname, m_taskname);

    boolean canCommit = false;
    try {
      AutoSelectSinglePath();

      // perform basic CFR part 11 checks: must have valid user/pass/reason, user is user that is
      // logged in, password is valid, reason is not empty/null
      /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
        DfLogger.debug(this, m + "check form and user/pass/reason validations", null, null);
      String validation = performValidation();
      /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
        DfLogger.debug(
            this, m + "result: " + (validation == null ? "valid" : validation), null, null);
      if (validation != null) {
        /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
          DfLogger.debug(this, m + "User/Pass/Reason error detected: " + validation, null, null);
        setErrorMessage(validation);
        return false;
      }

      /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
        DfLogger.debug(this, m + "get refs to signing controls", null, null);
      Text usernameCtrl = (Text) getControl(QADocForwardWFT.USERNAME_CONTROL_NAME, Text.class);
      Password passwordCtrl =
          (Password) getControl(QADocForwardWFT.PASSWORD_CONTROL_NAME, Password.class);
      DropDownList rsnListCtrl =
          (DropDownList) getControl(QADocForwardWFT.REASONSELECT_CONTROL_NAME, DropDownList.class);
      /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
        DfLogger.debug(this, m + "get refs to signing controls", null, null);
      String username = usernameCtrl.getValue();
      /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
        DfLogger.debug(this, m + " -- user: "******" -- pass: "******"null" : "#########"), null, null);
      String reason = rsnListCtrl.getValue();
      /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
        DfLogger.debug(this, m + " -- reason: " + reason, null, null);

      // HACK the class hierarchy: set Password on superclass, otherwise it won't successfully
      // complete when calling super.onCommitChanges()
      Password passwdCtrl = (Password) getControl("__PASSWORD_CONTROL_NAME");
      passwdCtrl.setValue(password);

      try {
        /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
          DfLogger.debug(this, m + "check for signature validations", null, null);
        if (t.MethodConfiguration != null
            && t.MethodConfiguration.containsKey("SignatureValidations")) {
          /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
            DfLogger.debug(this, m + "signature validations detected", null, null);
          List signvalidations = (List) t.MethodConfiguration.get("SignatureValidations");
          Map context = new HashMap();
          List errmsgs = new ArrayList();
          boolean vflag = false;
          for (int i = 0; i < signvalidations.size(); i++) {
            /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
              DfLogger.debug(this, m + "running signing validation plugin #" + i, null, null);
            MrcsPlugin plugin = (MrcsPlugin) signvalidations.get(i);
            /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
              DfLogger.debug(this, m + "-- instantiating - " + plugin.PluginClassName, null, null);
            // we'll reuse IMrcsWorkflowValidation as the plugin interface, even though it lacks the
            // task name, which I guess we could hardcode in the MRCS config for the task if need
            // be...
            ISignatureValidation vplug =
                (ISignatureValidation) Class.forName(plugin.PluginClassName).newInstance();
            /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
              DfLogger.debug(this, m + "-- exec", null, null);
            if (!vplug.validate(
                getDfSession().getSessionManager(),
                getDfSession().getDocbaseName(),
                m_mrcsapp,
                m_processname,
                m_task,
                m_primarypackage,
                username,
                password,
                reason,
                errmsgs,
                plugin.PluginConfiguration,
                context)) {
              // break immediately? Or run through all of them?
              vflag = false;
              /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
                DfLogger.debug(this, m + "-- VALIDATION FAILURE", null, null);
              break;
            }
          }
          if (vflag) // validation failed if true...
          {
            for (int ii = 0; ii < errmsgs.size(); ii++) setErrorMessage((String) errmsgs.get(ii));
            return false;
          }
        }
      } catch (Exception e) {
        /*-ERROR-*/ DfLogger.error(this, m + "Error in Signature Validations", null, e);
        throw new WrapperRuntimeException(e);
      }

      // now, I'm pretty sure that super.canCommitChanges() is a dangerous point-of-no-return call
      // that actually has side effects, despite its stateless-implying name,
      // so we should make sure as we can that the signing info has been verified at this point, by
      // checking audit records, rendition presence, number of signatures, etc
      if (super.canCommitChanges()) {
        // I'm pretty sure this super.onCommitChanges call is point-of-no-return: the task will be
        // completed and the workflow will proceed with the next task
        // if they are automatic. This can create race conditions with stuff that happens after the
        // task is done, such as workflow plugins, etc. If you get an error
        // message with "can't find object reference" of something like 4d017f38XXXXX, then the
        // workflow completed and cleaned itself before the plugins/signing
        // could complete in time.

        // THEREFORE, we will sign first (signing multiple documents can take...awhile...), THEN
        // commit changes
        if (m_task.isSignOffRequired()) {
          /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
            DfLogger.debug(
                this,
                m
                    + "onCommitChanges is signing the document - I don't think this should ever happen for FinishWFT",
                null,
                null);
          try {
            if (t.MethodConfiguration != null
                && t.MethodConfiguration.containsKey("SignatureService")) {
              MrcsPlugin signingplugin = (MrcsPlugin) t.MethodConfiguration.get("SignatureService");
              ISignatureService signplug =
                  (ISignatureService) Class.forName(signingplugin.PluginClassName).newInstance();
              /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
                DfLogger.debug(this, m + "-- exec signing", null, null);
              signplug.sign(
                  getDfSession().getSessionManager(),
                  getDfSession().getDocbaseName(),
                  m_mrcsapp,
                  m_processname,
                  m_task,
                  m_primarypackage,
                  username,
                  password,
                  reason,
                  signingplugin.PluginConfiguration,
                  null);
            }
          } catch (Exception e) {
            /*-ERROR-*/ DfLogger.error(this, m + "Error in Signature Service", null, e);
            throw new WrapperRuntimeException(e);
          }
        }

        canCommit = super.onCommitChanges();
        /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
          DfLogger.debug(
              this,
              m + "canCommit (after validation and performing super call) : " + canCommit,
              null,
              null);
      } else {
        canCommit = false;
      }
      if (canCommit) {

        // uses Actions as a pluginlayer...
        // IN GENERAL these are a bad idea, due to the race conditions documented in the comments
        // above...
        /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
          DfLogger.debug(
              this, " MRCS:FinishWFT: onCommitChanges : get ref to workflow defn", null, null);
        IDfId workflowid = m_task.getWorkflowId();
        /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
          DfLogger.debug(
              this,
              " MRCS:FinishWFT: onCommitChanges : look up workflow object (IDfWorkflow)",
              null,
              null);
        IDfWorkflow workflow = (IDfWorkflow) getDfSession().getObject(workflowid);
        /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
          DfLogger.debug(
              this,
              " MRCS:FinishWFT: onCommitChanges : look up process object (IDfProcess)",
              null,
              null);
        IDfProcess wfdef = (IDfProcess) getDfSession().getObject(workflow.getProcessId());
        /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
          DfLogger.debug(
              this,
              " MRCS:FinishWFT: onCommitChanges : workflow name: " + wfdef.getObjectName(),
              null,
              null);
        MrcsWorkflowTask mrcstask =
            config.getMrcsWorkflowTask(m_mrcsapp, wfdef.getObjectName(), m_task.getTaskName());
        if (mrcstask.Actions != null) {
          Map context = new HashMap();
          /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
            DfLogger.debug(
                this,
                " MRCS:FinishWFT: onCommitChanges : executing client-side plugins",
                null,
                null);
          for (int k = 0; k < mrcstask.Actions.size(); k++) {
            try {
              /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
                DfLogger.debug(
                    this,
                    " MRCS:FinishWFT: onCommitChanges : executing plugin " + (k + 1),
                    null,
                    null);
              MrcsPlugin plugin = (MrcsPlugin) mrcstask.Actions.get(k);
              /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
                DfLogger.debug(
                    this,
                    " MRCS:FinishWFT: onCommitChanges : -- class: " + plugin.PluginClassName,
                    null,
                    null);
              IMrcsWorkflowActionPlugin wfaction =
                  (IMrcsWorkflowActionPlugin) Class.forName(plugin.PluginClassName).newInstance();
              wfaction.execute(
                  getDfSession().getSessionManager(),
                  getDfSession().getDocbaseName(),
                  m_task,
                  workflow,
                  m_mrcsapp,
                  plugin.PluginConfiguration,
                  context);
            } catch (Exception e) {
              /*-ERROR-*/ DfLogger.error(
                  this, m + "error in MRCS 4.2 client-side workflow actions", null, e);
              setErrorMessage("MSG_UNEXPECTED_ERROR", new Object[] {e.getMessage()}, e);
              throw new WrapperRuntimeException("error in MRCS workflow actions", e);
            }
          }
        }
        if (canCommit)
          setMessage("MSG_FINISH_SUCCESS", new Object[] {super.getString("MSG_OBJECT")});
      } // commit & esign ends
    } catch (DfException e1) {
      /*-ERROR-*/ DfLogger.error(
          this, "MRCS:FinishWFT.onCommitChanges - DfException occurred: ", null, e1);
      canCommit = false;
      try {
        if (m_task.getCompleteErrStatus() == 4) {
          /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
            DfLogger.debug(this, m + "Exception occurred:Incorrect Password " + e1, null, null);
          setErrorMessage("MSG_INCORRECT_PASSWORD");
          return false;
        }
        /*
         * else if(){ [DM_SYSOBJECT_E_ESIGN_SIGNATURE_METHOD_FAILED }
         */
        else {
          /*-ERROR-*/ DfLogger.error(
              this,
              "MRCS:FinishWFT.onCommitChanges - Exception occurred:Unexpected Error ",
              null,
              e1);
          setErrorMessage("MSG_UNEXPECTED_ERROR", new Object[] {e1.getMessage()}, e1);
          return false;
        }
      } catch (DfException e2) {
        /*-ERROR-*/ DfLogger.error(this, m + "error in exception handling code", null, e2);
        throw new WrapperRuntimeException(e2);
      }
    }

    return canCommit;
  }