Examples of CvFileVO


Examples of com.centraview.file.CvFileVO

      // Handle attachments
      Collection attachments = messageVO.getAttachedFiles();
      if (attachments != null) {
        Iterator attachmentIterator = attachments.iterator();
        while (attachmentIterator.hasNext()) {
          CvFileVO thisAttachment = (CvFileVO) attachmentIterator.next();
          String path = thisAttachment.getPhysicalFolderVO().getFullPath(null, true) + thisAttachment.getName();
          String insertQuery = "INSERT INTO attachment (MessageID, FileName, FileID) VALUES(?, ?, ?)";
          cvdal.setSqlQuery(insertQuery);
          cvdal.setInt(1, messageID);
          cvdal.setString(2, thisAttachment.getName());
          cvdal.setInt(3, thisAttachment.getFileId());
          cvdal.executeUpdate();
          cvdal.clearParameters();
          cvdal.setSqlQueryToNull();
        }
      }
View Full Code Here

Examples of com.centraview.file.CvFileVO

          String disposition = part.getDisposition();

          if (disposition != null && (disposition.equalsIgnoreCase(Part.ATTACHMENT) || disposition.equalsIgnoreCase(Part.INLINE))) {
            // by SPEC, we should only save those parts whose disposition is "attachment" or "inline".
            // disposition == null means that it is a content part (message body, readable content)
            CvFileVO attachment = new CvFileVO();

            String filename = (part.getFileName() != null) ? (String)part.getFileName() : "Part-" + i;

            // prepend human readable date to the fileName. This is for uniqueness.
            SimpleDateFormat df = new SimpleDateFormat("MMMM_dd_yyyy_hh_mm_ss_S");
            String prependDate = df.format(new Date());
            attachment.setName(prependDate + "-" + filename);
            attachment.setTitle(filename);
            attachment.setOwner(ownerID);
            attachment.setAuthorId(ownerID);
            attachment.setCreatedBy(ownerID);
            attachment.setDescription("Email Attachment: " + filename);
            attachment.setPhysical(CvFileVO.FP_PHYSICAL);

            if (attachment.getTitle() == null || (attachment.getTitle()).length() <= 0) {
              // this is not good, and we should never reach this point, because I
              // have added some fail-proof default content for filename above
              return -1;
            }

            int newFileID = fileFacade.addFile(ownerID, attachmentFolderID, attachment, part.getInputStream(), this.dataSource);

            if (newFileID > 0) {
              cvdal.clearParameters();
              cvdal.setInt(1, messageID);
              cvdal.setString(2, attachment.getTitle());
              cvdal.setInt(3, newFileID);
              int rowsAffected = cvdal.executeUpdate();
            }

            numberOfAttachments++;
          }else if(contentType != null && contentType.toLowerCase().indexOf("rfc822") > -1){
            // The attachment is itself an rfc822 message. Therefore, we need to
            // create a new MailMessage object, and process all its parts too
            this.saveAttachments(this.getPartContent(part), messageID, accountID, ownerID, attachmentFolderID, cvdal, embededImageMap);
          } else if (contentType != null && (contentType.length() >= 10) && ((contentType.toLowerCase().substring(0, 10)).indexOf("image") != -1)) {
            // The attachment is itself an rfc2387 message. Therefore, we need to
            // create a new MailMessage object, and process all the embeded image parts too
            CvFileVO attachment = new CvFileVO();

            String contentID = null;
      String partContentID[] = part.getHeader("Content-ID");
      if(partContentID != null && partContentID.length != 0){
        contentID = partContentID[0];
      }
            String filename = (part.getFileName() != null) ? (String)part.getFileName() : "Part-" + i;

            // prepend human readable date to the fileName. This is for uniqueness.
            SimpleDateFormat df = new SimpleDateFormat("MMMM_dd_yyyy_hh_mm_ss_S");
            String prependDate = df.format(new Date());
            String storedFileName = prependDate + "-" + filename;
            attachment.setName(storedFileName);
            attachment.setTitle(filename);
      attachment.setOwner(ownerID);
            attachment.setAuthorId(ownerID);
            attachment.setCreatedBy(ownerID);
            attachment.setDescription("Email Attachment: " + filename);
            attachment.setPhysical(CvFileVO.FP_PHYSICAL);

            if (attachment.getTitle() == null || (attachment.getTitle()).length() <= 0) {
              // this is not good, and we should never reach this point, because I
              // have added some fail-proof default content for filename above
              return -1;
            }
View Full Code Here

Examples of com.centraview.file.CvFileVO

      if (attachments != null) {
        message.setContent(multipart);
        Iterator attachmentIterator = attachments.iterator();
        while (attachmentIterator.hasNext()) {
          messageBodyPart = new MimeBodyPart();
          CvFileVO thisAttachment = (CvFileVO) attachmentIterator.next();
          String path = thisAttachment.getPhysicalFolderVO().getFullPath(null, true) + thisAttachment.getName();
          DataSource source = new FileDataSource(path);
          messageBodyPart.setDataHandler(new DataHandler(source));
          messageBodyPart.setFileName(thisAttachment.getTitle());
          multipart.addBodyPart(messageBodyPart);
        }
      }

      message.setSentDate(new Date());
View Full Code Here

Examples of com.centraview.file.CvFileVO

      if (attachments != null) {
        message.setContent(multipart);
        Iterator attachmentIterator = attachments.iterator();
        while (attachmentIterator.hasNext()) {
          messageBodyPart = new MimeBodyPart();
          CvFileVO thisAttachment = (CvFileVO) attachmentIterator.next();
          String path = thisAttachment.getPhysicalFolderVO().getFullPath(null, true) + thisAttachment.getName();
          DataSource source = new FileDataSource(path);
          messageBodyPart.setDataHandler(new DataHandler(source));
          messageBodyPart.setFileName(thisAttachment.getTitle());
          multipart.addBodyPart(messageBodyPart);
        }
      }

      message.setSentDate(new Date());
View Full Code Here

Examples of com.centraview.file.CvFileVO

      if (ff.getFileSize() > 0) {
        String strf = ff.getFileName();
        InputStream im = ff.getInputStream();

        //Add file first
        CvFileVO flvo = new CvFileVO();
        flvo.setTitle("Literature"); //file name
        flvo.setName(strf);
        flvo.setCreatedBy(userid);

        fileID = cvfile.addLiterature(userid, flvo, im, dataSource);
      }

      LiteratureHome literatureHome = (LiteratureHome) CVUtility.getHomeObject("com.centraview.administration.modulesettings.LiteratureHome", "LiteratureAdmin");
View Full Code Here

Examples of com.centraview.file.CvFileVO

        FormFile ff = (FormFile) fileform.getFile();
        String strf = ff.getFileName();
        InputStream im = ff.getInputStream();

        CvFileFacade cvfile = new CvFileFacade();
        CvFileVO flvo = new CvFileVO();
        flvo.setTitle(strf); //file name

    Calendar c = Calendar.getInstance();
    java.util.Date dt = c.getTime();
    DateFormat df = new SimpleDateFormat("MM_dd_yyyy_hh_mm_ss");
    String dateStamp = df.format(dt);

    strf = "attachment_" + dateStamp +"_"+ strf;
        flvo.setName(strf);
        flvo.setCreatedBy(userid);
        flvo.setOwner(userid);
        flvo.setAuthorId(userid);
        flvo.setFileSize((float) ff.getFileSize());

        CvFolderVO homeFolder = cvfile.getHomeFolder(userid, dataSource);
        int xxx = cvfile.addFile(userid, homeFolder.getFolderId(), flvo, im, dataSource);
        //int xxx = cvfile.addEmailAttachment(userid, flvo, im, dataSource);
View Full Code Here

Examples of com.centraview.file.CvFileVO

      FormFile ff = dyn.getTheFile();
      String strf = ff.getFileName();
      InputStream im = ff.getInputStream();

      CvFileFacade cvfile = new CvFileFacade();
      CvFileVO flvo = new CvFileVO();
      flvo.setTitle("EmailAttachment");
      flvo.setName(strf);
      flvo.setCreatedBy(indvID);
      flvo.setOwner(indvID);
      int emailAttachmentResult = cvfile.addEmailAttachment(indvID, flvo, im, dataSource);

      flvo = cvfile.getEmailAttachment(indvID, emailAttachmentResult, dataSource);
      String path = flvo.getPhysicalFolderVO().getFullPath(null, true) + flvo.getName();

      session.setAttribute("path", path);

      // fill vector with column name
      Vector v = new Vector();
View Full Code Here

Examples of com.centraview.file.CvFileVO

            FormFile ff = (FormFile) fileform.getFile();
            String strf = ff.getFileName();
            InputStream im = ff.getInputStream();

            CvFileFacade cvfile = new CvFileFacade();
            CvFileVO flvo = new CvFileVO();
            flvo.setTitle(strf); //file name

            Calendar c = Calendar.getInstance();
            java.util.Date dt = c.getTime();
            DateFormat df = new SimpleDateFormat("MM_dd_yyyy_hh_mm_ss");
            String dateStamp = df.format(dt);

            strf = "attachment_" + dateStamp +"_"+ strf;
            flvo.setName(strf);
            flvo.setCreatedBy(userid);
            flvo.setOwner(userid);
            flvo.setAuthorId(userid);
            flvo.setFileSize((float) ff.getFileSize());

            CvFolderVO homeFolder = cvfile.getHomeFolder(userid, dataSource);
            int xxx = cvfile.addFile(userid, homeFolder.getFolderId(), flvo, im, dataSource);
            flvo = cvfile.getFile(userid, xxx, dataSource);

            HashMap hm = (HashMap) session.getAttribute("AttachfileList");

            if (hm == null)
            {
               hm = new HashMap();
            }
            hm.put(Integer.toString(xxx), flvo.getTitle());
            session.setAttribute("AttachfileList", hm);
         }
         else
         {
            String fileId = "";
View Full Code Here

Examples of com.centraview.file.CvFileVO

      String strf = ff.getFileName();
      InputStream im = ff.getInputStream();

      //Add file first
      CvFileFacade cvfile = new CvFileFacade();
      CvFileVO flvo = new CvFileVO();
      flvo.setTitle("Literature");
      flvo.setName(strf);
      flvo.setCreatedBy(individualID);

      int fileID = cvfile.addLiterature(individualID, flvo, im, dataSource);

      //Add entry in Literature table
      LiteratureHome literatureHome = (LiteratureHome)CVUtility.getHomeObject("com.centraview.administration.modulesettings.LiteratureHome", "LiteratureAdmin");
View Full Code Here

Examples of com.centraview.file.CvFileVO

          Calendar c = Calendar.getInstance();
          java.util.Date dt = c.getTime();
          DateFormat df = new SimpleDateFormat("MM_dd_yyyy");
          String dateStamp = df.format(dt);

          CvFileVO flvo = new CvFileVO();
          flvo.setTitle("Error Log");
          flvo.setName("errorLog_" + indvID + "_" + rn + "_" + dateStamp + ".txt");
          messageList.put("fileName","errorLog_" + indvID + "_" + rn + "_" + dateStamp + ".txt");

          flvo.setPhysicalFolder(homeFld.getFolderId());
          flvo.setIsTemporary("NO");
          flvo.setOwner(indvID);

          //flvo.setAuthor(indvID);
          flvo.setPhysical(CvFileVO.FP_PHYSICAL);

          StringBufferInputStream stringInputStream = new StringBufferInputStream(importInputStream.toString());
          int fileId = cvf.addFile(indvID, homeFld.getFolderId(), flvo, stringInputStream, this.dataSource);
          messageList.put("fileID",fileId + "");
        } catch (Exception e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.