Package it.eng.spagobi.analiticalmodel.document.bo

Examples of it.eng.spagobi.analiticalmodel.document.bo.ObjTemplate


   * @param hibObjTemp the hib obj temp
   *
   * @return the obj template
   */
  public ObjTemplate toObjTemplate(SbiObjTemplates hibObjTemp){
    ObjTemplate objTemp = new ObjTemplate();
    objTemp.setActive(hibObjTemp.getActive());
    objTemp.setBinId(hibObjTemp.getSbiBinContents().getId());
    objTemp.setBiobjId(hibObjTemp.getSbiObject().getBiobjId());
    objTemp.setCreationDate(hibObjTemp.getCreationDate());
    objTemp.setId(hibObjTemp.getObjTempId());
    objTemp.setName(hibObjTemp.getName());
    objTemp.setProg(hibObjTemp.getProg());
    // metadata
    objTemp.setDimension(hibObjTemp.getDimension());
    objTemp.setCreationUser(hibObjTemp.getCreationUser());
    return objTemp;
  }
View Full Code Here


      Integer stateID = objState.getValueId();
      o.setStateID(stateID);
      o.setStateCode(objState.getValueCd());   
     
      BIObject orig_obj = objDao.loadBIObjectById(new Integer(orig_biobj_id));
      ObjTemplate objTemp = new ObjTemplate();
      byte[] content = null;
      if(template != null && template != ""){
        content = template.getBytes();
      }else if(smartFilterValues!=null){
        content = getSmartFilterTemplateContent();
      }else if(wk_definition!=null && query!=null && orig_obj!=null){
        ObjTemplate qbETemplate = orig_obj.getActiveTemplate();
        String templCont = new String(qbETemplate.getContent());
        WorksheetDriver q = new WorksheetDriver();
        String temp = q.composeWorksheetTemplate(wk_definition, query, null, templCont);
        content = temp.getBytes();
      }else{
        logger.error("Document template not available");
View Full Code Here

  }

  private void updateWorksheetTemplate() throws Exception {
    logger.debug("IN");
    byte[] content = getTemplateContent();
    ObjTemplate objTemp = createNewTemplate(content);
    ExecutionInstance executionInstance = getContext().getExecutionInstance( ExecutionInstance.class.getName() );
    BIObject biobj = executionInstance.getBIObject();
    UserProfile userProfile = (UserProfile) this.getUserProfile();
    logger.info("User with unique identifier " + userProfile.getUserUniqueIdentifier() + ", id " + userProfile.getUserId()
        + ", name " + userProfile.getUserName() + " is updating document with id " + biobj.getId()
        + ", label " + biobj.getLabel() + ", name " + biobj.getName() + "; new template is:");
    logger.info(new String(objTemp.getContent()));
    objDao.modifyBIObject(biobj, objTemp);
    logger.debug("Template of document with id " + biobj.getId() + ", label " + biobj.getLabel() + ", name " + biobj.getName() + " updated");
    JSONObject response = new JSONObject();
    response.put("text", "Operation succeded");
    writeBackToClient( new JSONSuccess(response) );
View Full Code Here

    logger.debug("Worksheet definition : " + wkDefinition);
    logger.debug("Base query definition : " + query);
    logger.debug("Smart filter values : " + smartFilterValues);
    ExecutionInstance executionInstance = getContext().getExecutionInstance( ExecutionInstance.class.getName() );
    BIObject biobj = executionInstance.getBIObject();
    ObjTemplate qbETemplate = biobj.getActiveTemplate();
    String templCont = new String(qbETemplate.getContent());
    WorksheetDriver q = new WorksheetDriver();
    String temp = q.composeWorksheetTemplate(wkDefinition, query, smartFilterValuesString, templCont);
    byte[] content = temp.getBytes();
    logger.debug("OUT");
    return content;
View Full Code Here

    return content;
  }

  protected ObjTemplate createNewTemplate(byte[] content) {
    logger.debug("IN");
    ObjTemplate objTemp = new ObjTemplate();
    objTemp.setContent(content);
    UserProfile userProfile = (UserProfile) this.getUserProfile();
    objTemp.setCreationUser(userProfile.getUserId().toString());
    objTemp.setDimension(Long.toString(content.length/1000)+" KByte");
    objTemp.setName("template.sbiworksheet");
    logger.debug("OUT");
    return objTemp;
  }
View Full Code Here

    Assert.assertNotNull(smartFilterValues, "Missing smart Filter Values");
    logger.debug("Worksheet definition : " + wkDefinition);
    logger.debug("Smart filter values : " + smartFilterValues);
    ExecutionInstance executionInstance = getContext().getExecutionInstance( ExecutionInstance.class.getName() );
    BIObject biobj = executionInstance.getBIObject();
    ObjTemplate qbETemplate = biobj.getActiveTemplate();
    String templCont = new String(qbETemplate.getContent());
    WorksheetDriver q = new WorksheetDriver();
    String temp = q.composeWorksheetTemplate(wkDefinition, null, smartFilterValuesString, templCont);
    byte[] content = temp.getBytes();
    logger.debug("OUT");
    return content;
View Full Code Here

      logger.debug("getting template");

      SourceBean content = null;
      byte[] contentBytes = null;
      try{
        ObjTemplate template = DAOFactory.getObjTemplateDAO().getBIObjectActiveTemplate(Integer.valueOf(id));
        if(template==null) throw new Exception("Active Template null");
        contentBytes = template.getContent();
        if(contentBytes==null) {
          logger.error("TEMPLATE DOESN'T EXIST !!!!!!!!!!!!!!!!!!!!!!!!!!!");
          EMFUserError userError = new EMFUserError(EMFErrorSeverity.ERROR, 2007);
          userError.setBundle("messages");
          throw userError;
View Full Code Here

      tx.commit();

      // update biobject template info
      if (objTemp != null) {
        try {
          ObjTemplate oldTemp = DAOFactory.getObjTemplateDAO().getBIObjectActiveTemplate(biObject.getId());
          // set the biobject id into ObjTemplate (it should not be necessary, but to avoid errors ...)
          objTemp.setBiobjId(biObject.getId());
          //insert or update new template
          IObjTemplateDAO dao = DAOFactory.getObjTemplateDAO();
          dao.setUserProfile(this.getUserProfile());
          dao.insertBIObjectTemplate(objTemp);
          //if the input document is a document composition and template is changed deletes existing parameters
          //and creates all new parameters automatically
          //(the parameters are recovered from all documents that compose general document)
          if (loadParsDC &&
              (oldTemp==null || objTemp.getId()==null || objTemp.getId().compareTo(oldTemp.getId()) != 0)){
            insertParametersDocComposition(biObject, objTemp, true);
          }
        } catch (Exception e) {
          logger.error("Error during creation of document composition parameters : ", e);
          throw new EMFUserError(EMFErrorSeverity.ERROR, e.getMessage());
View Full Code Here

    //get informations about documents child
    Session aSession = null;
    Transaction tx = null;
    try {
      //gets document composition configuration
      ObjTemplate template = DAOFactory.getObjTemplateDAO().getBIObjectActiveTemplate(biobjectId);
      aSession = getSession();
      tx = aSession.beginTransaction();
      logger.debug("Template document composition in insert: " + template );
      if (template==null) return;
      byte[] contentBytes = template.getContent();
      String contentStr = new String(contentBytes);
      SourceBean content = SourceBean.fromXMLString(contentStr);
      DocumentCompositionConfiguration docConf = new DocumentCompositionConfiguration(content);
      List lstLabeldDocs = docConf.getSbiObjLabelsArray();
      List totalParameters = new ArrayList();
View Full Code Here

      
           String idStr = (String)request.getAttribute("biobjectId");
           Integer id = new Integer (idStr);        
           
            BIObject obj = DAOFactory.getBIObjectDAO().loadBIObjectById(id);
            ObjTemplate templ1 = obj.getActiveTemplate();
            byte[] jcrContent1 = templ1.getContent();   
            String templateFileName = templ1.getName();
            ZipEntry entry = new ZipEntry(templateFileName);
            String label = obj.getLabel();
            zipOut.putNextEntry(entry);
            zipOut.write(jcrContent1);   
           
            List subReports = DAOFactory.getSubreportDAO().loadSubreportsByMasterRptId(id);
              Iterator subReportsIt = subReports.iterator();
              while (subReportsIt.hasNext()) {
                  Subreport subRpt = (Subreport) subReportsIt.next();
                  BIObject aSubRptObj = DAOFactory.getBIObjectDAO().loadBIObjectById(subRpt.getSub_rpt_id());
                  // load the subreport template
                  ObjTemplate templ = aSubRptObj.getActiveTemplate();
                  byte[] jcrContent = templ.getContent();
                    templateFileName = templ.getName();
                    label = aSubRptObj.getLabel();
                  // put the subreport template in a folder which name is the subreport label
                  entry = new ZipEntry(label + "/" + templateFileName);
                  zipOut.putNextEntry(entry);
                  zipOut.write(jcrContent);
              }
          
             String templateFileZIP = (String)request.getAttribute("fileName");
         if (templateFileName == null){
           templateFileName = "template.zip";
         }
           httpResp.setHeader("Content-Disposition","attachment; filename=\"" + templateFileZIP + "\";");
           zipOut.flush();
           zipOut.close();
           out.flush();
          
          }else{
   
      freezeHttpResponse();
      HttpServletResponse httpResp = getHttpResponse();
      String idTemplateStr = (String)request.getAttribute("TEMP_ID");
      Integer idTemplate = new Integer(idTemplateStr);
      IObjTemplateDAO objtempdao = DAOFactory.getObjTemplateDAO();
      ObjTemplate objTemp = objtempdao.loadBIObjectTemplate(idTemplate)
      byte[] content = objTemp.getContent();
      httpResp.setHeader("Content-Disposition","attachment; filename=\"" + objTemp.getName() + "\";");
      httpResp.setContentLength(content.length);
      httpResp.getOutputStream().write(content);
      httpResp.getOutputStream().flush();
          }
  }
View Full Code Here

TOP

Related Classes of it.eng.spagobi.analiticalmodel.document.bo.ObjTemplate

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.