Package it.eng.spagobi.engines.documentcomposition.exporterUtils

Examples of it.eng.spagobi.engines.documentcomposition.exporterUtils.DocumentContainer


      Document doc=(Document)docMap.get(key);
      String label=doc.getSbiObjLabel();
      logger.debug("Document "+label);

      // get document container information
      DocumentContainer documentContainer=documentsMap.get(label);

      // Recover BIObject     
      IBIObjectDAO dao=DAOFactory.getBIObjectDAO();
      BIObject objectID=dao.loadBIObjectByLabel(label);
      BIObject object=null;

      // get roles
      Collection roles = null;
      roles = ((UserProfile)profile).getRolesForUse();


      for (Iterator iterator2 = roles.iterator(); iterator2.hasNext();) {
        Object role = (Object) iterator2.next();
        try{
          object=dao.loadBIObjectForExecutionByIdAndRole(objectID.getId(), role.toString());
        }
        catch (Exception e) {
          logger.error("error in recovering the role");
        }
        if(object!=null) break;
      }

      // set parameters: from url retrieved by iframe, fill BiObjectParameters with value
      logger.debug("fill parameters from URL");
      fillBIObjectWithParameterValues(object, currentConfs.get(label));
     
      //only for highcharts document is necessary to pass the svg parameter to the engine.
      //At the moment it force the svgContent into description attribute of the object (only for background execution)
      if (currentConfs.get("SVG_"+label) != null){
        Map tmpSvg = currentConfs.get("SVG_"+label).getParameters();
        String tmpContent = tmpSvg.get("SVG_"+label).toString();
        object.setDescription(tmpContent);
      }
      logger.debug("call execution proxy");
      // Calling execution proxy
      ExecutionProxy proxy = new ExecutionProxy();
     
      proxy.setBiObject(object);
     

      // if engine is Birt, export in PDF, elsewhere in JPG
      Engine engine = object.getEngine();
      String driverName = engine.getDriverName();
      if (driverName != null && driverName.endsWith("BirtReportDriver")) {
        output = "PDF";
      } else {
        output = "JPG";
      }
      byte[] returnByteArray = proxy.exec(profile, "EXPORT", output);

      // add content retrieved to Document Container
      logger.debug("add content retrieved to Document Container");
      if( returnByteArray.length==0)logger.warn("empty byte array retrieved for document "+label);
      documentContainer.setContent(returnByteArray);     
      documentContainer.setDocumentLabel(label);
      documentContainer.setDocumentType(object.getBiObjectTypeCode());

//      FileOutputStream fos=null;
//      File dir = new File("C:/zzzEsportazione.pdf");
//      File toReturn=null;
//      if(i==0){
View Full Code Here


      MetadataStyle metadataStyle=MetadataStyle.getMetadataStyle(label,styleString.toString(), docCompConf);
      if(defaultStyle==false){
        defaultStyle=(metadataStyle == null) ? true : false;
      }
     
      DocumentContainer documentContainer=new DocumentContainer();
      documentContainer.setStyle(metadataStyle);
      documents.put(label, documentContainer);

      // get its parameters configuration
      logger.debug("Get parametrs configuration for document "+label);     
      Object urlO=sb.getAttribute("TRACE_PAR_"+label);
View Full Code Here

TOP

Related Classes of it.eng.spagobi.engines.documentcomposition.exporterUtils.DocumentContainer

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.