public void setAttachmentsContentTypeForElf( IDfSession idfSession, String[] attachmentIds, String strArticleFolderPath, String strStageName) throws DfException, XPathExpressionException, ParserConfigurationException, SAXException, IOException { DfLogger.debug( this, utilObj.getSpaces() + "setAttachmentsContentType :::: Length of Attachments : " + attachmentIds.length, null, null); String strDeliveryFolderName = ""; String strStageFolderName = ""; if (IConstants.ATTR_STAGE_NAME_200.equalsIgnoreCase(strStageName)) { strDeliveryFolderName = IConstants.PATH_AMPP_COPY_EDITING; // IConstants.PATH_AMPP_DELIVERY_FOLDER; strStageFolderName = IConstants.FOLDER_NAME_STAGE_200; } else { strDeliveryFolderName = IConstants.PATH_AMPP_COPY_EDITING; // IConstants.PATH_AMPP_DELIVERY_FOLDER; strStageFolderName = IConstants.FOLDER_NAME_STAGE_300; } for (int i = 0; i < attachmentIds.length; i++) { if (DfId.isObjectId(attachmentIds[i])) { DfLogger.debug( this, utilObj.getSpaces() + "Attachment ID : " + attachmentIds[i], null, null); IDfDocument idfDocument = (IDfDocument) idfSession.getObject(new DfId(attachmentIds[i])); if (idfDocument != null) { setContentTypeFromName(idfSession, idfDocument); idfDocument.fetch(null); setAttachmentToArticleForElf( idfSession, idfDocument, strArticleFolderPath, strStageFolderName, strDeliveryFolderName); } } } }
/** * This is the main method which processes AMPP received documents. * * @param idfSession * @param attachmentIds * @param strArticleFolderPath * @throws DfException */ public void setAttachmentsContentTypeForAMPP( IDfSession idfSession, String[] attachmentIds, String strArticleFolderPath, String strStageName) throws DfException { DfLogger.debug(this, utilObj.getSpaces() + "setAttachmentsContentType ::::", null, null); String strDeliveryFolderName = ""; String strStageFolderName = ""; if (IConstants.ATTR_STAGE_NAME_200.equalsIgnoreCase(strStageName)) { strDeliveryFolderName = IConstants.PATH_AMPP_COPY_EDITING; // IConstants.PATH_AMPP_DELIVERY_FOLDER; strStageFolderName = IConstants.FOLDER_NAME_STAGE_200; } else { // Pramod | 30 Oct 2014 | All files will be stored under // Stage/Delivery Folder // strDeliveryFolderName = IConstants.PATH_AMPP_300_DELIVERY_FOLDER; strDeliveryFolderName = IConstants.PATH_AMPP_COPY_EDITING; // IConstants.PATH_AMPP_DELIVERY_FOLDER; strStageFolderName = IConstants.FOLDER_NAME_STAGE_300; } for (int i = 0; i < attachmentIds.length; i++) { if (DfId.isObjectId(attachmentIds[i])) { DfLogger.debug( this, utilObj.getSpaces() + "Attachment ID : " + attachmentIds[i], null, null); IDfDocument idfDocument = (IDfDocument) idfSession.getObject(new DfId(attachmentIds[i])); if (idfDocument != null) { DfLogger.debug( this, "File Path before setting content type : " + idfDocument.getFile(null), null, null); setContentTypeFromName(idfSession, idfDocument); idfDocument.save(); idfDocument.fetch(null); setAttachmentToArticleForAMPP( idfSession, idfDocument, strArticleFolderPath, strStageFolderName, strDeliveryFolderName); if (idfDocument.isDeleted() != true) { idfDocument.save(); DfLogger.debug( this, utilObj.getSpaces() + "Attachment " + idfDocument.getObjectName() + " Processed and Saved successfully ", null, null); } } } } }