コード例 #1
0
  /**
   * Create document for sent mail information
   *
   * @param processAttachmentsFolder
   * @param attachmentInfo
   */
  private void createDocumentForMail(Folder processAttachmentsFolder, String attachmentInfo) {
    String docName =
        RepositoryUtility.createDocumentName(
            processAttachmentsFolder,
            DocumentMgmtUtility.stripOffSpecialCharacters(mailSubject),
            0);

    DocumentInfo docInfo = DmsUtils.createDocumentInfo(docName);
    docInfo.setContentType(MimeTypesHelper.HTML.getType());
    docInfo.setOwner(ContextPortalServices.getUser().getAccount());

    // set correspondence data
    PrintDocumentAnnotations annotations = new PrintDocumentAnnotationsImpl();
    annotations.setTemplateType(DocumentTemplate.CORRESPONDENCE_TEMPLATE);
    annotations.setRecipients(getToMailAddress());
    annotations.setBlindCarbonCopyRecipients(bccMailAddress);
    annotations.setCarbonCopyRecipients(ccMailAddress);
    annotations.setFaxNumber(getFaxMailAddress());
    annotations.setSendDate(Calendar.getInstance().getTime());
    annotations.setAttachments(attachmentInfo);
    annotations.setSender(mailSender);
    annotations.setSubject(getMailSubject());
    annotations.setFaxEnabled(false);
    annotations.setEmailEnabled(false);

    docInfo.setDocumentAnnotations(annotations);

    Document mailDocument =
        DocumentMgmtUtility.getDocumentManagementService()
            .createDocument(
                processAttachmentsFolder.getId(), docInfo, editor.getContent().getBytes(), null);

    DMSHelper.addAndSaveProcessAttachment(processInstance, mailDocument);
  }
コード例 #2
0
  /** default constructor */
  public CorrespondenceViewBean() {
    super("correspondenceView");
    attachments = new ArrayList<Attachment>();
    Document document =
        (Document) PortalApplication.getInstance().getFocusView().getViewParams().get("attachment");
    if (null != document) {
      addAttachments(new Attachment(document, DocumentMgmtUtility.getDocumentManagementService()));
    }
    String procInstOID =
        (String)
            PortalApplication.getInstance()
                .getFocusView()
                .getViewParams()
                .get("processInstanceOID");
    processInstance = ProcessInstanceUtils.getProcessInstance(Long.valueOf(procInstOID));
    requestParamMap.put("To", "toaddressess");
    requestParamMap.put("Cc", "ccaddressess");
    requestParamMap.put("Bcc", "bccaddressess");
    requestParamMap.put("Fax", "faxaddressess");
    dropBoxEffect = new Pulsate(EFFECT_DURATION);
    dropBoxEffect.setFired(true);

    // set sender's mail address
    String emailId = getMailSender();
    emailId =
        (emailId == null || emailId.equals(""))
            ? DocumentMgmtUtility.getUser().getEMail()
            : emailId;
    emailId =
        (emailId == null || emailId.equals(""))
            ? Parameters.instance().getString(EngineProperties.MAIL_SENDER)
            : emailId;
    setMailSender(emailId);

    pdfConverterHelper = new PDFConverterHelper();
    printAvailable = pdfConverterHelper.isPDFConverterAvailable();

    correspondenceAttachments =
        new CorrespondenceAttachments(
            new CorrespondenceAttachmentsHandler() {
              public boolean addAttachment(Document document) {
                return CorrespondenceViewBean.this.addAttachments(
                    new Attachment(document, DocumentMgmtUtility.getDocumentManagementService()));
              }

              public boolean addTemplate(Document document, AddPolicy addPolicy) {
                return CorrespondenceViewBean.this.addTemplate(
                    document, AddPolicy.AT_TOP == addPolicy);
              }

              public boolean isDocumentTemplate(Document document) {
                return CorrespondenceViewBean.this.isDocumentTemplate(document);
              }
            });
  }
コード例 #3
0
  /**
   * create document for attached file
   *
   * @param attachment
   * @param processAttachmentsFolder
   * @throws DocumentManagementServiceException
   * @throws IOException
   */
  private void createDocumentFromAttachment(Attachment attachment, Folder processAttachmentsFolder)
      throws DocumentManagementServiceException, IOException {
    FileInfo fileInfo = attachment.getFileInfo();
    String docName =
        RepositoryUtility.createDocumentName(processAttachmentsFolder, fileInfo.getFileName(), 0);

    // create document
    Document document =
        DocumentMgmtUtility.createDocument(
            processAttachmentsFolder.getId(),
            docName,
            DocumentMgmtUtility.getFileSystemDocumentContent(fileInfo.getPhysicalPath()),
            null,
            fileInfo.getContentType(),
            null,
            null,
            null,
            null);

    // update process attachment
    DMSHelper.addAndSaveProcessAttachment(processInstance, document);
  }
コード例 #4
0
 /** @param dropEvent */
 public void dropAttachment(DropEvent dropEvent) {
   // if (dropEvent.getEventType() == DropEvent.DROPPED)
   {
     try {
       DefaultMutableTreeNode valueNode = (DefaultMutableTreeNode) dropEvent.getTargetDragValue();
       RepositoryDocumentUserObject docUserObject =
           (RepositoryDocumentUserObject) valueNode.getUserObject();
       Document draggedFile = (Document) docUserObject.getResource();
       addAttachments(
           new Attachment(draggedFile, DocumentMgmtUtility.getDocumentManagementService()));
     } catch (Exception e) {
     }
   }
 }
コード例 #5
0
  /**
   * @param document
   * @param addAtTop
   * @return
   */
  private boolean addTemplate(Document document, boolean addAtTop) {
    if (isDocumentTemplate(document)) {
      String tempContent =
          new String(
              DocumentMgmtUtility.getDocumentManagementService()
                  .retrieveDocumentContent(document.getId()));

      tempContent = resolveExpressions(tempContent);

      editor.addContent(
          tempContent,
          addAtTop ? DocumentEditingPolicy.ADD_AT_TOP : DocumentEditingPolicy.ADD_AT_BOTTOM);

      return true;
    } else {
      MessageDialog.addErrorMessage(
          this.getMessages().getString("invalid.template.message")
              + " "
              + document.getContentType());
      return false;
    }
  }