Package it.eng.spagobi.services.content.bo

Examples of it.eng.spagobi.services.content.bo.Content


          if(isSpagoBIDev != null){
            jpaloUrl += ",isdeveloper=\""+isSpagoBIDev+"\"";
          }         
         
      }else{
        Content templateContent = contentProxy.readTemplate(documentId,new HashMap());
 
        byte[] byteContent = null;
        try {
          BASE64Decoder bASE64Decoder = new BASE64Decoder();
          byteContent = bASE64Decoder.decodeBuffer(templateContent.getContent());
          String xmlSourceBean = new String(byteContent);
          SourceBean sb =SourceBean.fromXMLString(xmlSourceBean);
          template = new JPaloEngineTemplate(sb);   
         
          if(template == null){
View Full Code Here


      if (documentId == null)
        throw new Exception("Document id missing!!");
      logger.debug("Got parameter documentId = " + documentId);
     
      ContentServiceImplSupplier c = new ContentServiceImplSupplier();
      Content template = c.readTemplate(profile.getUserUniqueIdentifier().toString(), documentId, null);
      String templateFileName = template.getFileName();
 
      logger.debug("Template Read");
 
      if(templateFileName==null){
        logger.warn("Template has no name");
        templateFileName="";
      }
     
      response.setHeader("Cache-Control: ",""); // leave blank to avoid IE errors
      response.setHeader("Pragma: ",""); // leave blank to avoid IE errors
      response.setHeader("content-disposition","inline; filename="+templateFileName)
     
      String mimeType = MimeUtils.getMimeType(templateFileName);
      logger.debug("Mime type is = " + mimeType);
      response.setContentType(mimeType);

      BASE64Decoder bASE64Decoder = new BASE64Decoder();
      byte[] templateContent = bASE64Decoder.decodeBuffer(template.getContent());
      response.setContentLength(templateContent.length);
      response.getOutputStream().write(templateContent);
      response.getOutputStream().flush()
      response.getOutputStream().close();
     
View Full Code Here

     * @throws SecurityException the security exception
     * @throws EMFUserError the EMF user error
     * @throws EMFInternalError the EMF internal error
     */
    public Content readTemplate(String user, String document, HashMap parameters) throws SecurityException, EMFUserError, EMFInternalError {
      Content content;
      BIObject biobj;
     
      logger.debug("IN");
   
      logger.debug("user: [" + user + "]");
    logger.debug("document: [" + document + "]");
   
      if (parameters == null) {
        logger.debug("Input parameters map is null. It will be considered as an empty map");
        parameters = new HashMap();
      }
   
    content = new Content();
    try {
        Integer id = new Integer(document);
        biobj = DAOFactory.getBIObjectDAO().loadBIObjectById(id);
        // only if the user is not Scheduler or Workflow system user or it is a call to retrieve a subreport,
        //check visibility on document and parameter values
        boolean checkNeeded = true;
        boolean modContained = parameters.containsKey("SBI_READ_ONLY_TEMPLATE");
        if(modContained){
           boolean onlytemplate = parameters.containsValue("true");
           if(onlytemplate){
             checkNeeded = false;
           }
        }
       
        if (checkNeeded && !UserProfile.isSchedulerUser(user) && !UserProfile.isWorkflowUser(user&& !isSubReportCall(biobj, parameters)) {
          checkRequestCorrectness(user, biobj, parameters);
        }
       
        IObjTemplateDAO tempdao = DAOFactory.getObjTemplateDAO();
        ObjTemplate temp = tempdao.getBIObjectActiveTemplate(biobj.getId());
        if (temp==null){
           logger.warn("The template dor document [" + id + "] is NULL");
           throw new SecurityException("The template dor document [" + id + "] is NULL");
        }
        byte[] template = temp.getContent();
 
        BASE64Encoder bASE64Encoder = new BASE64Encoder();
        content.setContent(bASE64Encoder.encode(template));
        logger.debug("template read");
        content.setFileName(temp.getName());       
    } catch (NumberFormatException e) {
        logger.error("NumberFormatException", e);
        throw e;
    } catch (EMFUserError e) {
        logger.error("EMFUserError", e);
View Full Code Here

     * @throws SecurityException the security exception
     * @throws EMFUserError the EMF user error
     * @throws EMFInternalError the EMF internal error
     */
    public Content readTemplateByLabel(String user, String label, HashMap parameters) throws SecurityException, EMFUserError, EMFInternalError {
      Content content;
      BIObject biobj;
     
      logger.debug("IN");
   
      logger.debug("user: [" + user + "]");
    logger.debug("document: [" + label + "]");
   
   
    content = new Content();
    try {
        biobj = DAOFactory.getBIObjectDAO().loadBIObjectByLabel(label);
        // only if the user is not Scheduler or Workflow system user or it is a call to retrieve a subreport,
        //check visibility on document and parameter values
        if (!UserProfile.isSchedulerUser(user) && !UserProfile.isWorkflowUser(user&& !isSubReportCall(biobj, parameters)) {
          checkRequestCorrectness(user, biobj, parameters);
        }
       
        IObjTemplateDAO tempdao = DAOFactory.getObjTemplateDAO();
        ObjTemplate temp = tempdao.getBIObjectActiveTemplate(biobj.getId());
        if (temp==null){
           logger.warn("The template dor document [" + label + "] is NULL");
           throw new SecurityException("The template dor document [" + label + "] is NULL");
        }
        byte[] template = temp.getContent();
 
        BASE64Encoder bASE64Encoder = new BASE64Encoder();
        content.setContent(bASE64Encoder.encode(template));
        logger.debug("template read");
        content.setFileName(temp.getName());       
    } catch (NumberFormatException e) {
        logger.error("NumberFormatException", e);
        throw e;
    } catch (EMFUserError e) {
        logger.error("EMFUserError", e);
View Full Code Here

   
    // PRIVATE METHOD
   
    private Content readSubObjectContent(String user,String subObjectId){
      logger.debug("IN");
      Content content=new Content();
      try {
          Integer id = new Integer(subObjectId);
          ISubObjectDAO subdao = DAOFactory.getSubObjectDAO();
          SubObject subobj = subdao.getSubObject(id);
          byte[] cont = subobj.getContent();
          BASE64Encoder bASE64Encoder = new BASE64Encoder();
          content.setContent(bASE64Encoder.encode(cont));
          content.setFileName(subobj.getName());
          return content;
      } catch (NumberFormatException e) {
          logger.error("NumberFormatException",e);
      } catch (EMFUserError e) {
          logger.error("EMFUserError",e);
View Full Code Here

      return null
    }
 
    private Content readSubObjectContent(String user,String subObjectName, Integer objId){
      logger.debug("IN");
      Content content=new Content();
      try {
          ISubObjectDAO subdao = DAOFactory.getSubObjectDAO();
          SubObject subobj = subdao.getSubObjectByNameAndBIObjectId(subObjectName, objId);
          byte[] cont = subobj.getContent();
          BASE64Encoder bASE64Encoder = new BASE64Encoder();
          content.setContent(bASE64Encoder.encode(cont));
          content.setFileName(subobj.getName());
          return content;
      } catch (NumberFormatException e) {
          logger.error("NumberFormatException",e);
      } catch (EMFUserError e) {
          logger.error("EMFUserError",e);
View Full Code Here

    //read the template of svg file from the db and create a content object
    public Content readMap(String token,String user,String mapName){
      Monitor monitor =MonitorFactory.start("spagobi.service.content.readMap");
        logger.debug("IN");
        logger.debug("mapName = " +mapName);
        Content content = new Content();
        try {
            validateTicket(token,user);
            GeoMap tmpMap =  DAOFactory.getSbiGeoMapsDAO().loadMapByName(mapName);
            if (tmpMap == null) {
              logger.info("Map with name " + mapName + " not found on db.");
              return null;
            }
            byte[] template = DAOFactory.getBinContentDAO().getBinContent(tmpMap.getBinId());
  
            if (template == null)
            {
              logger.info("Template map is empty. Try uploadyng the svg.");
              return null;
            }
            BASE64Encoder bASE64Encoder = new BASE64Encoder();
          content.setContent(bASE64Encoder.encode(template));
          logger.debug("template read");
          content.setFileName(mapName +".svg");
         
          return content;
       
    } catch (Throwable e) {
        logger.error("Exception",e);
View Full Code Here

   * @see it.eng.spagobi.engines.geo.map.provider.AbstractMapProvider#getSVGMapDOMDocument(java.lang.String)
   */
  public SVGDocument getSVGMapDOMDocument(String mapName) throws GeoEngineException {
      logger.debug("IN.mapName="+mapName);
    SVGDocument svgDocument = null;   
    Content map = null;   
   
     
    try {
      map = mapCatalogueServiceProxy.readMap(mapName);     
    } catch (Exception e) {
View Full Code Here

   * @return the standard hierarchy
   *
   * @throws Exception the exception
   */
  public Content readMap(String mapName) throws Exception {
    Content map;
   
    ContentServiceProxy proxy = new ContentServiceProxy(userId, session);
    map = proxy.readMap(mapName);
    if (map == null) {
      throw new Exception("Error while getting map [" + mapName +"] from map catalogue");
View Full Code Here

   * Gets the analysis state row data.
   *
   * @return the analysis state row data
   */
  public byte[] getAnalysisStateRowData() {
    Content spagoBISubObject;
      byte[] rowData;
     
    if ( analysisStateRowData == null && getAnalysisMetadata().getId() != null ) {
     
      logger.debug("IN");
     
      spagoBISubObject = getContentServiceProxy().readSubObjectContent( getAnalysisMetadata().getId().toString() )
      try {
        rowData = DECODER.decodeBuffer( spagoBISubObject.getContent() );
        analysisStateRowData = rowData;
      } catch (IOException e) {
        logger.warn( "Impossible to decode the content of " + getAnalysisMetadata().getId().toString() + " subobject");
          return null;
      }
View Full Code Here

TOP

Related Classes of it.eng.spagobi.services.content.bo.Content

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.