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

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


     
      // make a validation of the request data
      ValidationCoordinator.validate("PAGE", "BIObjectValidation", this);     

      // build and ObjTemplate object using data into request
      ObjTemplate objTemp = helper.recoverBIObjTemplateDetails();
      if (objTemp!= null) {
        objTemp.setBiobjId(obj.getId());
      }
      //if the template is not loaded check if default version is changed
      if (objTemp == null){
        String strCurTempVer = (String)request.getAttribute("versionTemplate");
        if (strCurTempVer != null && !strCurTempVer.equals("")) {
          Integer idCurTempVer = Integer.valueOf((strCurTempVer).trim());
          if (idCurTempVer != null) {
            objTemp = DAOFactory.getObjTemplateDAO().getBIObjectActiveTemplate(obj.getId());
            if (objTemp.getId().compareTo(idCurTempVer) != 0){
              flgReloadTemp = true;
              List lstTemplatesObj = DAOFactory.getObjTemplateDAO().getBIObjectTemplateList(obj.getId());
              for (int i=0; i<lstTemplatesObj.size(); i++){
                objTemp = (ObjTemplate)lstTemplatesObj.get(i);
                if (objTemp.getId().compareTo(idCurTempVer) == 0)
                  break;             
              }         
            }
          }
        }
View Full Code Here


    SessionContainer session = reqCont.getSessionContainer();
    SessionContainer permanentSession = session.getPermanentContainer();     
    IEngUserProfile profile = (IEngUserProfile) permanentSession.getAttribute(IEngUserProfile.ENG_USER_PROFILE);
    //String userId=(String)profile.getUserUniqueIdentifier();
    String userId=(String)((UserProfile)profile).getUserId();
      ObjTemplate templ = null;
     
    FileItem uploaded = (FileItem) request.getAttribute("UPLOADED_FILE");
    if (uploaded != null) {
      String fileName = GeneralUtilities.getRelativeFileNames(uploaded.getName());
      if (fileName != null && !fileName.trim().equals("")) {
        if (uploaded.getSize() == 0) {
          EMFValidationError error = new EMFValidationError(EMFErrorSeverity.ERROR, "uploadFile", "201");
          this.respCont.getErrorHandler().addError(error);
          return null;
        }
        int maxSize = GeneralUtilities.getTemplateMaxSize();
        if (uploaded.getSize() > maxSize) {
          EMFValidationError error = new EMFValidationError(EMFErrorSeverity.ERROR, "uploadFile", "202");
          this.respCont.getErrorHandler().addError(error);
          return null;
        }
        templ = new ObjTemplate();
        templ.setActive(new Boolean(true));
        templ.setCreationUser(userId);
        templ.setDimension(Long.toString(uploaded.getSize()/1000)+" KByte");
            templ.setName(fileName);
            byte[] uplCont = uploaded.get();
            templ.setContent(uplCont);
      }
    }
     
//    UploadedFile uploaded = (UploadedFile) request.getAttribute("UPLOADED_FILE");
//    if (uploaded != null) {
View Full Code Here

      logger.debug("Getting template");

      SourceBean content = null;
      byte[] contentBytes = null;
      try{
        ObjTemplate template = DAOFactory.getObjTemplateDAO().getBIObjectActiveTemplate(obj.getId());
        if(template==null) throw new Exception("Active Template null");
        contentBytes = template.getContent();
        if(contentBytes==null) throw new Exception("Content of the Active template null");

        // get bytes of template and transform them into a SourceBean

        String contentStr = new String(contentBytes);
View Full Code Here

      logger.warn("SDKTemplate in input is null!!");
      return null;
    }
    InputStream is = null;
    DataHandler dh = null;
    ObjTemplate toReturn = null;
    try {
      toReturn = new ObjTemplate();
      toReturn.setName(sdkTemplate.getFileName());
      dh = sdkTemplate.getContent();
      is = dh.getInputStream();
      byte[] templateContent = SpagoBIUtilities.getByteArrayFromInputStream(is);
      toReturn.setContent(templateContent);
      toReturn.setDimension(Long.toString(templateContent.length/1000)+" KByte");
    } catch (Exception e) {
      logger.error("Error while converting SDKTemplate into ObjTemplate.", e);
      logger.debug("Returning null.");
      return null;
    } finally {
View Full Code Here

      obj.setVisible(new Integer(1));
      List functionalities = new ArrayList();
      functionalities.add(functionalityId);
      obj.setFunctionalities(functionalities);

      ObjTemplate objTemplate = null;
      if (sdkTemplate != null) {
        objTemplate = new SDKObjectsConverter().fromSDKTemplateToObjTemplate(sdkTemplate);
        objTemplate.setActive(new Boolean(true));
        objTemplate.setCreationUser(userId);
        objTemplate.setCreationDate(new Date());
      }

      logger.debug("Saving document ...");
      IBIObjectDAO biObjDAO = DAOFactory.getBIObjectDAO();
      biObjDAO.setUserProfile(profile);
View Full Code Here

      if (!ObjectsAccessVerifier.canDevBIObject(documentId, profile)) {
        NotAllowedOperationException e = new NotAllowedOperationException();
        e.setFaultString("User cannot upload templates on specified document since he cannot develop it.");
        throw e;
      }
      ObjTemplate objTemplate = new SDKObjectsConverter().fromSDKTemplateToObjTemplate(sdkTemplate);
      objTemplate.setBiobjId(documentId);
      objTemplate.setActive(new Boolean(true));
      String userId = ((UserProfile) profile).getUserId().toString();
      logger.debug("Current user id is [" + userId + "]");
      objTemplate.setCreationUser(userId);
      objTemplate.setCreationDate(new Date());
      logger.debug("Saving template....");
      IObjTemplateDAO tempDAO = DAOFactory.getObjTemplateDAO();
      tempDAO.setUserProfile(profile);
      tempDAO.insertBIObjectTemplate(objTemplate);
      logger.debug("Template stored without errors.");
View Full Code Here

        e.setFaultString("User cannot download templates of specified document since he cannot develop it.");
        throw e;
      }
      // retrieves template
      IObjTemplateDAO tempdao = DAOFactory.getObjTemplateDAO();
      ObjTemplate temp = tempdao.getBIObjectActiveTemplate(documentId);
      if (temp == null) {
        logger.warn("The template dor document [" + documentId + "] is NULL");
        return null;
      }
      logger.debug("Template dor document [" + documentId + "] retrieved: file name is [" + temp.getName() + "]");
      toReturn = new SDKObjectsConverter().fromObjTemplateToSDKTemplate(temp);
    } catch(Exception e) {
      logger.error(e);
    }
    logger.debug("OUT");
View Full Code Here

        funct = DAOFactory.getLowFunctionalityDAO().loadLowFunctionalityByPath("/" + userId , false);
        functionalities.add(funct.getId());
        obj.setFunctionalities(functionalities);
      }
      //sets the template's content
      ObjTemplate objTemplate = new ObjTemplate();
      objTemplate.setActive(new Boolean(true));
      objTemplate.setCreationUser(userId);
      objTemplate.setCreationDate(new Date());
      objTemplate.setName(sdkTemplate.getFolderName() + ".xml");
      String template = getTemplate(datamartName);
      objTemplate.setContent(template.getBytes());

      //inserts the document
      logger.debug("Saving document ...");
      IBIObjectDAO biObjDAO = DAOFactory.getBIObjectDAO();
      biObjDAO.setUserProfile(profile);
View Full Code Here

    try{
      //SourceBean content = getTemplate(documentId);
      SourceBean content = null;
      byte[] contentBytes = null;
      try{
        ObjTemplate template = DAOFactory.getObjTemplateDAO().getBIObjectActiveTemplate(Integer.valueOf(documentId));
        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

  public SourceBean getTemplate(String documentId) throws EMFUserError{
    SourceBean content = null;
    byte[] contentBytes = null;
    try{
      ObjTemplate template = DAOFactory.getObjTemplateDAO().getBIObjectActiveTemplate(Integer.valueOf(documentId));
      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

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.