Package org.jboss.seam.document.DocumentData

Examples of org.jboss.seam.document.DocumentData.DocumentType


   {

      // Get the bytes from workbook that should be passed on to the user
      byte[] bytes = excelWorkbook.getBytes();

      DocumentType type = excelWorkbook.getDocumentType();

      String viewId = Pages.getViewId(context);
      String baseName = baseNameForViewId(viewId);

      DocumentData documentData = new DocumentData(baseName, type, bytes);
      documentData.setFilename(getFilename());

      if (getExportKey() != null) {
         Contexts.getEventContext().set(getExportKey(), documentData);
         return;
      }
     
      if (sendRedirect)
      {
         DocumentStore store = DocumentStore.instance();
         String id = store.newId();

         String url = store.preferredUrlForContent(baseName, type.getExtension(), id);
         url = Manager.instance().encodeConversationId(url, viewId);

         store.saveData(id, documentData);

         context.getExternalContext().redirect(url);
View Full Code Here


      String viewId = Pages.getViewId(facesContext);
      String baseName = Pages.getCurrentBaseName();

      DocumentStore store = DocumentStore.instance();
      DocumentType documentType = new DocumentData.DocumentType("pdf", "application/pdf");
      DocumentData documentData = new ByteArrayDocumentData(baseName, documentType, buffer.toByteArray());
      documentData.setFilename(getFilename());

      if (getExportKey() != null)
      {
         log.debug("Exporting PDF data to event key #0", getExportKey());
         Contexts.getEventContext().set(getExportKey(), documentData);
         return;
      }

      String id = store.newId();
      String url = store.preferredUrlForContent(baseName, documentType.getExtension(), id);
      url = Manager.instance().encodeConversationId(url, viewId);
      store.saveData(id, documentData);
      log.debug("Redirecting to #0 for PDF view", url);
      facesContext.getExternalContext().redirect(url);
   }
View Full Code Here

   {

      // Get the bytes from workbook that should be passed on to the user
      byte[] bytes = excelWorkbook.getBytes();

      DocumentType type = excelWorkbook.getDocumentType();

      String viewId = Pages.getViewId(context);
      String baseName = Pages.getCurrentBaseName();

      DocumentData documentData = new ByteArrayDocumentData(baseName, type, bytes);
      documentData.setFilename(getFilename());

      if (getExportKey() != null)
      {
         Contexts.getEventContext().set(getExportKey(), documentData);
         return;
      }

      if (sendRedirect)
      {
         DocumentStore store = DocumentStore.instance();
         String id = store.newId();

         String url = store.preferredUrlForContent(baseName, type.getExtension(), id);
         url = Manager.instance().encodeConversationId(url, viewId);

         store.saveData(id, documentData);

         context.getExternalContext().redirect(url);
View Full Code Here

        String viewId = Pages.getViewId(facesContext);
        String baseName = baseNameForViewId(viewId);

        DocumentStore store = DocumentStore.instance();
        DocumentType documentType = new DocumentData.DocumentType("pdf",
                "application/pdf");
        DocumentData documentData = new DocumentData(baseName, documentType,
                buffer.toByteArray());
        documentData.setFilename(getFilename());

        if (getExportKey() != null) {
            log.debug("Exporting PDF data to event key #0", getExportKey());
            Contexts.getEventContext().set(getExportKey(), documentData);
            return;
        }

        String id = store.newId();
        String url = store.preferredUrlForContent(baseName, documentType
                .getExtension(), id);
        url = Manager.instance().encodeConversationId(url, viewId);
        store.saveData(id, documentData);
        log.debug("Redirecting to #0 for PDF view", url);
        facesContext.getExternalContext().redirect(url);
View Full Code Here

        String viewId = Pages.getViewId(ctx);

        DocumentStore store = DocumentStore.instance();
        String id = store.newId();

        DocumentType type = new DocumentType("", resource.getContentType());

        DocumentData documentData = new DownloadableDocumentData(baseName, type, resource.getData());
        documentData.setFilename(resource.getFileName());
        documentData.setDisposition(resource.getDisposition());

        String url = store.preferredUrlForContent(resource.getFileName(), type.getExtension(), id);
        url = Manager.instance().encodeConversationId(url, viewId);
        store.saveData(id, documentData);
        return url;
    }
View Full Code Here

TOP

Related Classes of org.jboss.seam.document.DocumentData.DocumentType

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.