Package com.centraview.file

Examples of com.centraview.file.CvFileVO


      ArrayList attachmentFileIDs = new ArrayList();
      Iterator iter = attachmentList.iterator();
      ArrayList attachments = new ArrayList();
      int i = 0;
      while (iter.hasNext()) {
        CvFileVO fileVO = (CvFileVO)iter.next();
        int fileID = fileVO.getFileId();
        String fileName = fileVO.getName();
        attachments.add(new DDNameValue(fileID+"#"+fileName,fileName));
      }

      //Setting the Attachments to form.
      emailForm.set("attachmentList", attachments);
View Full Code Here


        int attachmentFolderID = attachmentFolderVO.getFolderId();
        int newFileID = -1;

        // somehow create a file using CvFileFacade, and get a CvFileVO from
        // that.
        CvFileVO fileVO = new CvFileVO();
        SimpleDateFormat df = new SimpleDateFormat("MMMM_dd_yyyy_hh_mm_ss_S");
        String prependDate = df.format(new Date());
        fileVO.setName("OriginalMessage_#" + messageID.intValue() + "_" + prependDate + ".html");
        fileVO.setTitle("OriginalMessage_#" + messageID.intValue());
        fileVO.setDescription("");
        fileVO.setFileSize(0.0f); // float
        fileVO.setVersion("1.0");
        fileVO.setStatus("PUBLISHED");
        fileVO.setVisibility(CvFileVO.FV_PRIVATE);
        fileVO.setPhysical(CvFileVO.FP_PHYSICAL);
        fileVO.setPhysicalFolder(attachmentFolderID);
        fileVO.setAuthorId(individualID);
        fileVO.setIsTemporary(CvFileVO.FIT_YES);

        ByteArrayInputStream inputStream = new ByteArrayInputStream(originalBody.getBytes());

        try {
          CvFileFacade fileFacade = new CvFileFacade();
          newFileID = fileFacade.addFile(individualID, attachmentFolderID, fileVO, inputStream, dataSource);
        } catch (CvFileException cfe) {
          // I guess do nothing
        }

        if (newFileID > 0) {
          // Add the CvFileVO to attachmentList, and the following line for the
          // attachmentMap
          fileVO.setFileId(newFileID);
          String strFileID = String.valueOf(newFileID);
          String strFileName = "OriginalMessage_" + messageID.intValue();

          attachmentMap.add(new DDNameValue(strFileID + "#" + strFileName, strFileName));
        }
View Full Code Here

        // the int representation for use in the code below
        fileID = formFileID.intValue();
      }
     
      CvFileFacade fileFacade = new CvFileFacade();
      CvFileVO fileVO = fileFacade.getFile(individualID, fileID, dataSource);

      fileForm.set("title", fileVO.getTitle());
      fileForm.set("fileName", fileVO.getName());
      fileForm.set("description", fileVO.getDescription());
     
      if (fileVO.getAuthorVO() != null)
      {
        fileForm.set("author", fileVO.getAuthorVO().getFirstName() + " " + fileVO.getAuthorVO().getLastName());
      }else{
        fileForm.set("author", "");
      }

      fileForm.set("created", fileVO.getCreatedOn());
      fileForm.set("modified", fileVO.getModifiedOn());
      fileForm.set("version", fileVO.getVersion());

      System.out.println("\n\n\nfileForm = [" + fileForm + "]\n\n\n");

    }catch(Exception e){
      System.out.println("[Exception][CV ViewFileHandler] Exception thrown in execute(): " + e);
View Full Code Here

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

        CvFileFacade cvfile = new CvFileFacade();
        CvFileVO flvo = new CvFileVO();
        flvo.setTitle(fileName); //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);

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

        CvFolderVO homeFolder = cvfile.getHomeFolder(userid, dataSource);
        int fileId = cvfile.addFile(userid, homeFolder.getFolderId(), flvo, im, dataSource);
        ArrayList fileList = new ArrayList();
        fileList.add(new DDNameValue(fileId+"#"+fileName,fileName));
View Full Code Here

        CvFileFacade fileRemote  = new CvFileFacade();
       
        for (int i = 0; i < attachmentFileIDs.size(); i++) {
          int fileID = ((Integer) attachmentFileIDs.get(i)).intValue();
          // get the CvFileVO from the EJB layer
          CvFileVO fileVO = fileRemote.getFile(individualID, fileID, dataSource);
          if (fileVO != null) {
            // add this attachment to the messageVO
            messageVO.addAttachedFiles(fileVO);
          }
        }   // end while (attachIter.hasNext())
View Full Code Here

            CvFileFacade fileRemote = new CvFileFacade();

            for (int i = 0; i < attachmentFileIDs.size(); i++) {
              int fileID = ((Integer)attachmentFileIDs.get(i)).intValue();
              // get the CvFileVO from the EJB layer
              CvFileVO fileVO = fileRemote.getFile(individualID, fileID, dataSource);
              if (fileVO != null) {
                // add this attachment to the messageVO
                messageVO.addAttachedFiles(fileVO);
              }
            }
          }

          // Send Email to all the Individual with the updated information of
          // the Template
          PrintTemplateHome PTHome = (PrintTemplateHome)CVUtility.getHomeObject(
              "com.centraview.printtemplate.PrintTemplateHome", "Printtemplate");
          PrintTemplate PTRemote = PTHome.create();
          PTRemote.setDataSource(dataSource);

          if (ptfrom != null && !ptfrom.equals("") && !ptfrom.equals("null")) {
            int accountID = Integer.parseInt(ptfrom);
            Message[0] = PTRemote.sendPTEmail(individualID, accountID, emailList, ptSubject,
                ptContent, messageVO);
          }
        } else {
          // generate the Previewed Template into a File.
          try {
            CvFileFacade cvf = new CvFileFacade();

            CvFileHome homeFile = (CvFileHome)CVUtility.getHomeObject(
                "com.centraview.file.CvFileHome", "CvFile");
            CvFile remoteFile = homeFile.create();
            remoteFile.setDataSource(dataSource);

            CvFolderVO homeFld = remoteFile.getHomeFolder(individualID);

            int rn = (new Random()).nextInt();
            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("Print Template_" + rn);
            flvo.setName("Template_" + "_" + rn + "_" + dateStamp + ".html");
            Message[1] = "Template_" + "_" + rn + "_" + dateStamp + ".html";

            flvo.setPhysicalFolder(homeFld.getFolderId());
            flvo.setIsTemporary("NO");
            flvo.setOwner(individualID);
            flvo.setPhysical(CvFileVO.FP_PHYSICAL);
            StringBuffer documentContent = new StringBuffer();

            for (int i = 0; i < ptContent.size(); i++) {
              documentContent.append(ptContent.get(i));
              if (i != (ptContent.size() - 1)) {
View Full Code Here

        CvFileFacade fileRemote = new CvFileFacade();

        for (int i = 0; i < attachmentFileIDs.size(); i++) {
          int fileID = ((Integer)attachmentFileIDs.get(i)).intValue();
          // get the CvFileVO from the EJB layer
          CvFileVO fileVO = fileRemote.getFile(individualID, fileID, dataSource);
          if (fileVO != null) {
            // add this attachment to the messageVO
            messageVO.addAttachedFiles(fileVO);
          }
        } // end while (attachIter.hasNext())
View Full Code Here

      Iterator iter = attachmentList.iterator();
      ArrayList attachmentMap = new ArrayList();
      int i = 0;
      while (iter.hasNext()) {
        CvFileVO fileVO = (CvFileVO)iter.next();
        int fileID = fileVO.getFileId();
        String fileName = fileVO.getTitle();
        attachmentMap.add(new DDNameValue(fileID+"#"+fileName,fileName));
      }

      if (saveOrigBodyAsAttachment) {
        CvFolderVO attachmentFolderVO = (CvFolderVO)remote.getAttachmentFolder(individualID);
        int attachmentFolderID = attachmentFolderVO.getFolderId();
        int newFileID = -1;

        // somehow create a file using CvFileFacade, and get a CvFileVO from that.
        CvFileVO fileVO = new CvFileVO();
        SimpleDateFormat df = new SimpleDateFormat("MMMM_dd_yyyy_hh_mm_ss_S");
        String prependDate = df.format(new Date());
        fileVO.setName("OriginalMessage_#" + messageID.intValue() + "_" + prependDate + ".html");
        fileVO.setTitle("OriginalMessage_#" + messageID.intValue());
        fileVO.setDescription("");
        fileVO.setFileSize(0.0f);   // float
        fileVO.setVersion("1.0");
        fileVO.setStatus("PUBLISHED");
        fileVO.setVisibility(CvFileVO.FV_PRIVATE);
        fileVO.setPhysical(CvFileVO.FP_PHYSICAL);
        fileVO.setPhysicalFolder(attachmentFolderID);
        fileVO.setAuthorId(individualID);
        fileVO.setIsTemporary(CvFileVO.FIT_YES);

        ByteArrayInputStream inputStream = new ByteArrayInputStream(originalBody.getBytes());

        try {
          CvFileFacade fileFacade = new CvFileFacade();
          newFileID = fileFacade.addFile(individualID, attachmentFolderID, fileVO, inputStream, dataSource);
        }catch(CvFileException cfe){
          // I guess do nothing
        }

        if (newFileID > 0) {
          // Add the CvFileVO to attachmentList, and the following line for the attachmentMap
          fileVO.setFileId(newFileID);

          String FileName= "OriginalMessage_" + messageID.intValue();
          attachmentMap.add(new DDNameValue(newFileID+"#"+FileName,FileName));
        }
      }   // end if (saveOrigBodyAsAttachment)
View Full Code Here

        CvFileFacade fileRemote = new CvFileFacade();

        for (int i = 0; i < attachmentFileIDs.size(); i++) {
          int fileID = ((Integer)attachmentFileIDs.get(i)).intValue();
          // get the CvFileVO from the EJB layer
          CvFileVO fileVO = fileRemote.getFile(individualID, fileID, dataSource);
          if (fileVO != null) {
            // add this attachment to the messageVO
            messageVO.addAttachedFiles(fileVO);
          }
        } // end while (attachIter.hasNext())
View Full Code Here

              Number attachmentID = (Number) attachmentHashMap.get("FileID");
              // Reason for providing -13 because we don't want to carry out the Authorization Step
              // We don't have to do the authorization check from here..
              // Thats why passing -13. So that we will avoid the authorization..

              CvFileVO attachment = fileFacade.getFile(-13, attachmentID.intValue(), this.dataSource);
              mailMessageVO.addAttachedFiles(attachment);
            }
          }   // end while (attachmentIterator.hasNext())
        }   // end if (resultsIterator.hasNext())
      // end if (resultsCollection != null)
View Full Code Here

TOP

Related Classes of com.centraview.file.CvFileVO

Copyright © 2018 www.massapicom. 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.