/**
  * Retrieve all the documents from the virtual folder
  *
  * @param session The session used to retrieve the folder documents
  * @return A list of all documents in the folder
  * @throws DfException
  */
 public List<IDfDocument> getAllDocuments(IDfSession session) throws DfException {
   List<IDfDocument> returnVal = new ArrayList<IDfDocument>();
   logger.debug("Retrieving all documents from the virtual folder");
   for (DocumentumIdentifier ident : this.documents) {
     returnVal.add((IDfDocument) session.getObjectByQualification(ident.getQualification()));
   }
   return returnVal;
 }
Example #2
0
  @Override
  public void execute(final IDfSession session) throws DfException {
    LOGGER.debug("AddGrouptoACL.execute()");

    final IDfACL acl =
        (IDfACL)
            session.getObjectByQualification("dm_acl where object_name = 'ajwf_acdc_default_acl'");
    acl.grant(GROUP_NAME, 7, null);
    acl.save();
  }
  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 void execute(
      IDfSessionManager sMgr,
      String docbase,
      IDfWorkitem task,
      IDfWorkflow workflow,
      IDfProcess process,
      String mrcsapp,
      Map config,
      Map context) {
    /*-CONFIG-*/ String m = "QADocFormGenerateAcrobatRenditionOnServer.execute - ";
    GenerateAcrobatRendition gar = new GenerateAcrobatRendition();
    IDfSession session = null;
    try {
      session = sMgr.getSession(docbase);
      // get attachment...
      /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
        DfLogger.debug(this, m + "getting ATTACHMENT collection for workitem", null, null);
      IDfCollection attachments = task.getAttachments();
      while (attachments.next()) {
        /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
          DfLogger.debug(this, m + "--NEXT ATTACHMENT--", null, null);
        for (int i = 0; i < attachments.getAttrCount(); i++) {
          /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
            DfLogger.debug(this, m + "attr:    " + attachments.getAttr(i).getName(), null, null);
          /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
            DfLogger.debug(
                this, m + "type:    " + attachments.getAttr(i).getDataType(), null, null);
          /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
            DfLogger.debug(
                this, m + "repeats: " + attachments.getAttr(i).isRepeating(), null, null);
          /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
            DfLogger.debug(
                this, m + "val:     " + attachments.getValueAt(i).asString(), null, null);
        }
        String compid = attachments.getString("r_component_id");
        /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
          DfLogger.debug(this, m + "--ATTACHMENT id: " + compid, null, null);
        if (compid != null) {
          /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
            DfLogger.debug(this, m + "--getting ATTACHMENT from docbase", null, null);
          IDfDocument attacheddoc = (IDfDocument) session.getObject(new DfId(compid));
          /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
            DfLogger.debug(
                this,
                m
                    + "--pkgdoc retrieved: "
                    + attacheddoc.getObjectName()
                    + " - "
                    + attacheddoc.getObjectId().getId(),
                null,
                null);

          /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
            DfLogger.debug(this, m + "--getting most recent version of attachment", null, null);
          IDfDocument pkgdoc =
              (IDfDocument)
                  session.getObjectByQualification(
                      "dm_document where i_chronicle_id = '"
                          + attacheddoc.getChronicleId().getId()
                          + "'");
          /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
            DfLogger.debug(
                this,
                m
                    + "--most recent retrieved: "
                    + pkgdoc.getObjectName()
                    + " - "
                    + pkgdoc.getObjectId().getId(),
                null,
                null);

          try {
            /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
              DfLogger.debug(this, m + "CALLING render plugin", null, null);
            gar.render(session, pkgdoc, config);
            // need to save...this may cause deadlock errors if in a transaction?
            /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
              DfLogger.debug(this, m + "saving doc changes", null, null);
            pkgdoc.save();
            /*-DEBUG-*/ if (DfLogger.isDebugEnabled(this))
              DfLogger.debug(this, m + "doc save complete", null, null);

          } catch (Exception e) {
            /*-ERROR-*/ DfLogger.error(
                this, m + "error while loading or executing promotion service module", null, e);
            throw e;
          }
        }
      }

    } catch (Exception dfe) {
      /*-ERROR-*/ DfLogger.error(this, m + "ERROR in generate rendtion on server event", null, dfe);
      throw new RuntimeException(
          "Error in workflow plugin - generate rendition on server event plugin", dfe);
    } finally {
      sMgr.release(session);
    }
  }
 /**
  * Execute the method task and all defined {@link fi.sardion.dctm.deploy.job.Job job} subtasks.
  *
  * <ul>
  *   <li>Created: 18 Sep 2010 19:10:07
  *   <li>Author: Christopher Harper, account: dmadmin
  * </ul>
  *
  * @since %since%
  */
 @Override
 public void execute() {
   final IDfSession session = getSession();
   try {
     if (isForThisRepository(session.getDocbaseName())) {
       final String qualification =
           new StringBuilder()
               .append(DCTMTask.DM_METHOD)
               .append(" where ")
               .append( //$NON-NLS-1$
                   DCTMTask.OBJECT_NAME)
               .append(" = '") // $NON-NLS-1$
               .append(getMethodName())
               .append('\'')
               .toString();
       IDfMethodObject method = (IDfMethodObject) session.getObjectByQualification(qualification);
       if (method == null) {
         log(
             String.format(
                 "Qualification %s din't return a method. Creating a new one.", //$NON-NLS-1$
                 new Object[] {qualification}));
         method = (IDfMethodObject) session.newObject(DCTMTask.DM_METHOD);
         method.setObjectName(getMethodName());
         method.grant(DCTMTask.DM_WORLD, IDfACL.DF_PERMIT_READ, ""); // $NON-NLS-1$
         // method.link(Method.METHOD_FOLDER);
         setReaplySettings(String.valueOf(true));
       } else {
         log(
             String.format(
                 "Found method with qualification %s.", //$NON-NLS-1$
                 new Object[] {qualification}));
       }
       if (reaplySettings()) {
         if (!method.isDirty()) {
           method.checkout();
           log(
               String.format(
                   "Modifying existing method %s values.", //$NON-NLS-1$
                   new Object[] {getMethodName()}));
         }
         method.setMethodVerb(getMethodVerb());
         method.setTimeoutMin(getTimeoutMin());
         method.setTimeoutMax(getTimeoutMax());
         method.setTimeoutDefault(getTimeoutDefault());
         method.setLaunchDirect(getLaunchDirect());
         method.setLaunchAsync(getLaunchAsync());
         method.setTraceLaunch(getTraceLaunch());
         method.setRunAsServer(getRunAsServer());
         method.setUseMethodContent(getUseMethodContent());
         method.setMethodType(getMethodType());
         method.setUseMethodServer(getUseMethodServer());
         method.setSuccessStatus(getSuccessStatus());
         method.setBoolean(DCTMTask.IS_RESTARTABLE, getIsRestartable());
         method.removeAll(DCTMTask.SUCCESS_RETURN_CODES);
         for (final Integer successReturnCode : getSuccessReturnCodes()) {
           method.appendInt(DCTMTask.SUCCESS_RETURN_CODES, successReturnCode.intValue());
         }
         method.removeAll(DCTMTask.METHOD_ARGS);
         for (final String methodArgument : getMethodArguments()) {
           method.appendString(DCTMTask.METHOD_ARGS, methodArgument);
         }
         method.removeAll(DCTMTask.A_EXTENDED_PROPERTIES);
         for (final String extededProperty : getExtendedProperties()) {
           method.appendString(DCTMTask.A_EXTENDED_PROPERTIES, extededProperty);
         }
       }
       if (method.isDirty()) {
         if (method.isCheckedOut()) {
           method = (IDfMethodObject) session.getObject(method.checkin(false, "")); // $NON-NLS-1$
         } else {
           method.save();
         }
       }
       if (isVerbose()) {
         log(
             String.format(
                 "########## METHOD OBJECT DUMP START ##########\n%s\n########### METHOD OBJECT DUMP END ###########", //$NON-NLS-1$
                 new Object[] {method.dump()}),
             Project.MSG_INFO);
       }
     } else {
       log(
           String.format(
               "This method %s was only defined for repositories %s and the current repository is %s.", //$NON-NLS-1$
               new Object[] {getMethodName(), getRepositories(), session.getDocbaseName()}));
     }
   } catch (final Throwable t) {
     printStack(t);
     log(
         String.format(
             "Shit!:\nclass: %s\nmessage: %s\nstack: %s", //$NON-NLS-1$
             new Object[] {
               t.getClass().getName(), t.getMessage(), t.getStackTrace()[0].toString()
             }));
   }
   for (final Job job : getJobs()) {
     job.setSession(session);
     job.setMethodname(getMethodName());
     job.execute();
   }
 }