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

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


     */
    public Map getParameterMap(Object biobject, IEngUserProfile profile, String roleName) {
  logger.debug("IN");
  Map map = new Hashtable();
  try {
      BIObject biobj = (BIObject) biobject;
      map = getMap(biobj);
  } catch (ClassCastException cce) {
      logger.error("The parameter is not a BIObject type", cce);
  }
  map = applySecurity(map, profile);
View Full Code Here


    IBIObjectDAO bobjectDAO;
    IObjTemplateDAO templateDAO;
   
    List<Subreport> subreports;
    Subreport subreport;
    BIObject subreportBObject; 
    ObjTemplate subreportTemplate;
   
    String prefixName;
    String tempName;
    String flgTemplateStandard;
    Integer id;
   
    try {
     
           
      subreportDAO = DAOFactory.getSubreportDAO();
        bobjectDAO = DAOFactory.getBIObjectDAO();
        templateDAO = DAOFactory.getObjTemplateDAO();
 
        subreports = subreportDAO.loadSubreportsByMasterRptId( reportBObject.getId() );
        for (int i = 0; i < subreports.size(); i++) {
          subreport = subreports.get(i);
        subreportBObject = bobjectDAO.loadBIObjectForDetail(subreport.getSub_rpt_id());
        subreportTemplate = templateDAO.getBIObjectActiveTemplate(subreportBObject.getId());
       
        prefixName = subreportBObject.getId()  + "_" + subreportTemplate.getBinId();
        pars.put("sr." + (i + 1) + ".ids", prefixName);
        logger.debug("ids: " + prefixName);
       
        /*
        tempName = subreportTemplate.getName().substring(0,subreportTemplate.getName().indexOf("."));
View Full Code Here

     * @return the data set
     */
    public SpagoBiDataSet getDataSet(String documentId) {
   
      SpagoBiDataSet datasetConfig = null;
      BIObject obj;
      IDataSet dataSet;
     
      logger.debug("IN");
   
    logger.debug("Requested the datasource associated to document [" + documentId + "]");

    if (documentId == null) {
        return null;
    }
 
    // gets data source data from database
    try {
        obj = DAOFactory.getBIObjectDAO().loadBIObjectById( Integer.valueOf(documentId) );
        if (obj == null) {
        logger.warn("The object with id " + documentId + " deoes not exist on database.");
        return null;
        }
       
       
        if (obj.getDataSetId() == null) {
          logger.warn("Dataset is not configured for this document:"+documentId);
          return null;
        }
       
        dataSet = DAOFactory.getDataSetDAO().loadActiveIDataSetByID( obj.getDataSetId() );
        if (dataSet == null) {
        logger.warn("The dataSet with id " + obj.getDataSetId() + " deoes not exist on database.");
        return null;
        }
       
        datasetConfig = dataSet.toSpagoBiDataSet();
 
View Full Code Here

      CoreContextManager contextManager = new CoreContextManager(new SpagoBISessionContainer(sessionContainer),
          new LightNavigatorContextRetrieverStrategy(requestSB));
      ExecutionInstance instance = contextManager.getExecutionInstance(ExecutionInstance.class.getName());
      String executionRole = instance.getExecutionRole();
      Integer objId = DAOFactory.getBIObjectDAO().loadBIObjectByLabel(objLabel).getId();
      BIObject obj = DAOFactory.getBIObjectDAO().loadBIObjectForExecutionByIdAndRole(objId, executionRole);
      if (obj == null){
        logger.error("Cannot obtain engine url. Document with label " + objLabel +" doesn't exist into database.");   
        List l = new ArrayList();
        l.add(objLabel);
        throw new EMFUserError(EMFErrorSeverity.ERROR, "1005", l, messageBundle);
      }
      Engine engine = obj.getEngine();
      // GET THE TYPE OF ENGINE (INTERNAL / EXTERNAL) AND THE SUITABLE BIOBJECT TYPES
      Domain engineType = null;
      Domain compatibleBiobjType = null;
      try {
        engineType = DAOFactory.getDomainDAO().loadDomainById(engine.getEngineTypeId());
        compatibleBiobjType = DAOFactory.getDomainDAO().loadDomainById(engine.getBiobjTypeId());
      } catch (EMFUserError error) {
        logger.error("Error retrieving document's engine information", error);
        return "1009|";
      } catch (Exception error) {
        logger.error("Error retrieving document's engine information", error);
        return "1009|";
      }

      String compatibleBiobjTypeCd = compatibleBiobjType.getValueCd();
      String biobjTypeCd = obj.getBiObjectTypeCode();

      // CHECK IF THE BIOBJECT IS COMPATIBLE WITH THE TYPES SUITABLE FOR THE ENGINE
      if (!compatibleBiobjTypeCd.equalsIgnoreCase(biobjTypeCd)) {
        // the engine document type and the biobject type are not compatible
        logger.error("Engine cannot execute input document type: " +
            "the engine " + engine.getName() + " can execute '" + compatibleBiobjTypeCd + "' type documents " +
            "while the input document is a '" + biobjTypeCd + "'.");
        Vector params = new Vector();
        params.add(engine.getName());
        params.add(compatibleBiobjTypeCd);
        params.add(biobjTypeCd);
        //errorHandler.addError(new EMFUserError(EMFErrorSeverity.ERROR, 2002, params));
        return "2002|";
      }

      // IF USER CAN'T EXECUTE THE OBJECT RETURN
      if (!ObjectsAccessVerifier.canSee(obj, profile)) return "1010|";

      //get object configuration
      DocumentCompositionConfiguration docConfig = null;
      docConfig = (DocumentCompositionConfiguration)contextManager.get("docConfig");

      Document document = null;
      //get correct document configuration
      List lstDoc = docConfig.getLabelsArray();
      boolean foundDoc = false;
      for (int i = 0; i < lstDoc.size(); i++){
        document = (Document)docConfig.getDocument((String)lstDoc.get(i));
        if (document != null){
          if (!obj.getLabel().equalsIgnoreCase(document.getSbiObjLabel()))
            continue;
          else{
            foundDoc = true;
            break;
          }
        }
      }
      if (!foundDoc){
        List l = new ArrayList();
        l.add(obj.getLabel());
        EMFUserError userError = new EMFUserError(EMFErrorSeverity.ERROR, 1079, l);
        logger.error("The object with label " + obj.getLabel() + " hasn't got a document into template" );
        return "1002|";
      }

      String className = obj.getEngine().getClassName();
      if (className == null || className.trim().equals("")) {
        // external engine
        //baseUrlReturn = obj.getEngine().getUrl() + "?";
        baseUrlReturn = obj.getEngine().getUrl();
        if (baseUrlReturn.indexOf("?") < 0) baseUrlReturn += "?";
        String driverClassName = obj.getEngine().getDriverName();
        IEngineDriver aEngineDriver = (IEngineDriver)Class.forName(driverClassName).newInstance();
        Map mapPars = aEngineDriver.getParameterMap(obj, profile, executionRole);
        String id = (String) requestSB.getAttribute("vpId");
        if (id != null){
          IViewpointDAO VPDAO = DAOFactory.getViewpointDAO();   
View Full Code Here

    return retHM;
  }

  private static List getInstanceValue(String key, ExecutionInstance instance){
    List retVal = new ArrayList();
    BIObject obj = instance.getBIObject();
    List objPars = obj.getBiObjectParameters();

    for (int i=0; i < objPars.size(); i++){
      BIObjectParameter objPar = (BIObjectParameter)objPars.get(i);
      if (objPar.getParameterUrlName().equalsIgnoreCase(key)){
        retVal.add((objPar.getParameterValues()==null)?"":(String)objPar.getParameterValues().get(0));
View Full Code Here

  if (documentId == null)
      return null;

  // gets data source data from database
  try {
      BIObject obj = DAOFactory.getBIObjectDAO().loadBIObjectById(Integer.valueOf(documentId));
      if (obj == null) {
    logger.error("The object with id " + documentId + " is not found on the database.");
    return null;
      }
      Integer dsId = null;
      if (obj.getDataSourceId() != null) {
        dsId = obj.getDataSourceId();
        logger.debug("Using document datasource id = " + dsId);
      } else {
        Engine engine = obj.getEngine();
        dsId = engine.getDataSourceId();
        logger.debug("Using document's engine datasource id = " + dsId);
      }
      if (dsId == null) {
        logger.error("Data source is not configured neither for document nor for its engine.");
        return null;
      }
      IDataSource ds = DAOFactory.getDataSourceDAO().loadDataSourceByID(dsId);
      if (ds == null) {
    logger.error("The data source with id " + obj.getDataSourceId() + " is not found on the database.");
    return null;
      }
     
      Domain dialectHB = DAOFactory.getDomainDAO().loadDomainById(ds.getDialectId());
      if (ds == null) {
    logger.error("The data source with id " + obj.getDataSourceId() + " is not found on the database.");
    return null;
      }     
      sbds = new SpagoBiDataSource();
      sbds.setLabel(ds.getLabel());
      sbds.setJndiName(ds.getJndi());
View Full Code Here

      // 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

      if(idObject==null){
        logger.error("Document id not found");
      }

      Integer id=Integer.valueOf(idObject.toString());
      BIObject document=DAOFactory.getBIObjectDAO().loadBIObjectById(id);
      String docName=document.getName();

      //Recover user Id
      HashedMap parameters=new HashedMap();

      BasicXmlBuilder basic=new BasicXmlBuilder(docName);
View Full Code Here

   * @return the BIObject associated with the input key.
   */
 
  public BIObject getBIObject(String key) {
    logger.debug("IN");
    BIObject toReturn = null;
    try {
      Object object = get(key);
      toReturn = (BIObject) object;
      return toReturn;
    } finally {
View Full Code Here

        String imgFolder = urlBuilder.getResourceLinkByTheme(httpRequest, "/img/treefolder.gif",currTheme);
        String imgFolderOp = urlBuilder.getResourceLinkByTheme(httpRequest, "/img/treefolderopen.gif",currTheme);
        htmlStream.append("  treeCMS.add(" + idFolder + ", " + parentId + ",'" + name + "', '', '', '', '" + imgFolder + "', '" + imgFolderOp + "', '', '');\n");
        List objects = folder.getBiObjects();
        for (Iterator it = objects.iterator(); it.hasNext(); ) {
          BIObject obj = (BIObject) it.next();
          Engine engine = obj.getEngine();
          if(engine!=null) {
            if(!EngineUtilities.isExternal(obj.getEngine())&& !engine.getClassName().equals("it.eng.spagobi.engines.kpi.SpagoBIKpiInternalEngine")){             
              continue;
            }
          }
          String biObjType = obj.getBiObjectTypeCode();
          String imgUrl = "/img/objecticon_"+ biObjType+ ".png";
          String userIcon = urlBuilder.getResourceLinkByTheme(httpRequest, imgUrl,currTheme);
          String biObjState = obj.getStateCode();
          String stateImgUrl = "/img/stateicon_"+ biObjState+ ".png";
          String stateIcon = urlBuilder.getResourceLinkByTheme(httpRequest, stateImgUrl,currTheme);
          Integer idObj = obj.getId();         
          String stateObj = obj.getStateCode();
          if(stateObj.equalsIgnoreCase("REL")) {
            String checked = "";
            if(biobjIds.contains(obj.getId())) {
              checked = "checked";
            }
            htmlStream.append("  treeCMS.add(" + dTreeObjects-- + ", " + idFolder + ",'<img src=\\'" + stateIcon + "\\' /> " + obj.getName() + "', '', '', '', '" + userIcon + "', '', '', '', 'biobject', '"+obj.getId()+"', '"+checked+"' );\n");
          }
        }
      }
    }
  }
View Full Code Here

TOP

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

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.