Examples of IBIObjectDAO


Examples of it.eng.spagobi.analiticalmodel.document.dao.IBIObjectDAO

          String biobjidStr = (String)iterBiobjIdsFromRequest.next();
          Integer biobjInt = Integer.valueOf(biobjidStr.substring(0, biobjidStr.lastIndexOf("__")));
          //adds new documents
          if(!biobjIds.contains(biobjInt)) {
            Integer biobjid = new Integer(biobjidStr.substring(0, biobjidStr.lastIndexOf("__")));
            IBIObjectDAO biobjectDAO = DAOFactory.getBIObjectDAO();
            IBIObjectParameterDAO ibiobjpardao = DAOFactory.getBIObjectParameterDAO();
            BIObject biobj = biobjectDAO.loadBIObjectById(biobjid);
            List bipars = ibiobjpardao.loadBIObjectParametersById(biobjid);
            biobj.setBiObjectParameters(bipars);
            biobj_sel_now.add(biobj);
          } else {
            Iterator iter_prev_biobj = biobjects.iterator();
            int index = 0;
            boolean flgExists = false;
            //preserves documents already existing
            while(iter_prev_biobj.hasNext()){
              index ++;
              BIObject biobj = (BIObject)iter_prev_biobj.next();
              String tmpID = biobj.getId().toString()+"__"+index;
              if(tmpID.equals(biobjidStr)) {
                biobj_sel_now.add(biobj);
                flgExists = true;
                continue;
              }
            }
            //adds new copy of document already existing
            if (!flgExists){
              Integer biobjid = new Integer(biobjidStr.substring(0, biobjidStr.lastIndexOf("__")));
              IBIObjectDAO biobjectDAO = DAOFactory.getBIObjectDAO();
              IBIObjectParameterDAO ibiobjpardao = DAOFactory.getBIObjectParameterDAO();
              BIObject biobj = biobjectDAO.loadBIObjectById(biobjid);
              List bipars = ibiobjpardao.loadBIObjectParametersById(biobjid);
              biobj.setBiObjectParameters(bipars);
              biobj_sel_now.add(biobj);
            }             
          }
View Full Code Here

Examples of it.eng.spagobi.analiticalmodel.document.dao.IBIObjectDAO

    }

    try {
      if ((idObj == null) || idObj.trim().equals(""))
        return;
      IBIObjectDAO biobjDAO = DAOFactory.getBIObjectDAO();
      BIObject biobj = biobjDAO.loadBIObjectForDetail(new Integer(idObj));

      IDataSourceDAO dataSourceDao = DAOFactory.getDataSourceDAO();
      IDataSetDAO dataSetDao = DAOFactory.getDataSetDAO();
      // Data source, if present
      Integer objataSourceId = biobj.getDataSourceId();
      if (objataSourceId != null) {
        IDataSource ds = dataSourceDao.loadDataSourceByID(objataSourceId);
        exporter.insertDataSource(ds, session);
      }
     
      // Data set if present
      Integer objDataSetId = biobj.getDataSetId();
      if (objDataSetId != null) {

        GuiGenericDataSet genericDs = dataSetDao.loadDataSetById(objDataSetId);
        if(genericDs!=null){
          exporter.insertDataSet(genericDs, session);
        }

      }     

      // Engine if present, and data source if engine uses data source
      Engine engine = biobj.getEngine();
      if (engine.getUseDataSource() && engine.getDataSourceId() != null) {
        Integer engineDataSourceId = engine.getDataSourceId();
        IDataSource ds = dataSourceDao.loadDataSourceByID(engineDataSourceId);
        exporter.insertDataSource(ds, session);
      }

      exporter.insertEngine(engine, session);  
      exporter.insertBIObject(biobj, session, false); // do not insert dataset


      logger.debug("Export metadata associated to the object");
      IObjMetacontentDAO objMetacontentDAO = DAOFactory.getObjMetacontentDAO();
      //  get metacontents associated to object
      List metacontents = objMetacontentDAO.loadObjOrSubObjMetacontents(biobj.getId(), null);
      for (Iterator iterator = metacontents.iterator(); iterator.hasNext();) {
        ObjMetacontent metacontent = (ObjMetacontent) iterator.next();
        exporter.insertObjMetacontent(metacontent, session);
      }


      // if the document is a chart, export the relevant dataset that is referenced by the template
      boolean isChart = false;
      if (biobj.getBiObjectTypeCode().equalsIgnoreCase("DASH")
          && engine.getClassName() != null && engine.getClassName().equals("it.eng.spagobi.engines.chart.SpagoBIChartInternalEngine")) {
        isChart = true;
      }

      if (isChart) {
        ObjTemplate template = biobj.getActiveTemplate();
        if (template != null) {
          try {
            byte[] tempFileCont = template.getContent();
            String tempFileStr = new String(tempFileCont);
            SourceBean tempFileSB = SourceBean.fromXMLString(tempFileStr);
            SourceBean datasetnameSB = (SourceBean) tempFileSB.getFilteredSourceBeanAttribute("CONF.PARAMETER", "name", "confdataset");
            if (datasetnameSB != null) {
              String datasetLabel = (String) datasetnameSB.getAttribute("value");
              IDataSetDAO datasetDao = DAOFactory.getDataSetDAO();
              IDataSet dataset = datasetDao.loadActiveDataSetByLabel(datasetLabel);
              GuiGenericDataSet guiGenericDataSet = datasetDao.loadDataSetByLabel(datasetLabel);



              if (dataset == null) {
                logger.warn("Error while exporting dashboard with id " + idObj + " and label " + biobj.getLabel() + " : " +
                    "the template refers to a dataset with label " + datasetLabel + " that does not exist!");
              } else {
                exporter.insertDataSet(guiGenericDataSet, session);
              }
            }
          } catch (Exception e) {
            logger.error("Error while exporting dashboard with id " + idObj + " and label " + biobj.getLabel() + " : " +
            "could not find dataset reference in its template.");         
          }
        }
      }


      // use Types Manager to handle specific export types, by now only KPI and CONSOLE.. TODO with all types

      ITypesExportManager typeManager = TypesExportManagerFactory.createTypesExportManager(biobj, engine, exporter, this);
      // if null means it is not defined
      if (typeManager != null)
        typeManager.manageExport(biobj, session);


      //maps kpi export
      //      boolean isKpi = false;
      //      if (biobj.getBiObjectTypeCode().equalsIgnoreCase("KPI")
      //          && engine.getClassName() != null && engine.getClassName().equals("it.eng.spagobi.engines.kpi.SpagoBIKpiInternalEngine")) {
      //        isKpi = true;
      //      }

      //      if (isKpi) {
      //        List objsToInsert=new ArrayList();
      //        ObjTemplate template = biobj.getActiveTemplate();
      //        if (template != null) {
      //          try {
      //            byte[] tempFileCont = template.getContent();
      //            String tempFileStr = new String(tempFileCont);
      //            SourceBean tempFileSB = SourceBean.fromXMLString(tempFileStr);
      //
      //
      //            String modelInstanceLabel = (String) tempFileSB.getAttribute("model_node_instance");
      //
      //            // biObjectToInsert keeps track of objects that have to be inserted beacuse related to Kpi
      //
      //            if (modelInstanceLabel != null) {
      //              IModelInstanceDAO modelInstanceDao = DAOFactory.getModelInstanceDAO();
      //              ModelInstance modelInstance = modelInstanceDao.loadModelInstanceWithoutChildrenByLabel(modelInstanceLabel);
      //              if (modelInstance == null) {
      //                logger.warn("Error while exporting kpi with id " + idObj + " and label " + biobj.getLabel() + " : " +
      //                    "the template refers to a Model Instance with label " + modelInstanceLabel + " that does not exist!");
      //              } else {
      //                objsToInsert=exporter.insertAllFromModelInstance(modelInstance, session);
      //                //exporter.insertModelInstance(modelInstance, session);
      //              }
      //            }
      //          } catch (Exception e) {
      //            logger.error("Error while exporting kpi with id " + idObj + " and label " + biobj.getLabel());
      //            throw new EMFUserError(EMFErrorSeverity.ERROR, "8010", "component_impexp_messages");
      //
      //          }
      //        }
      //
      //        for (Iterator iterator = objsToInsert.iterator(); iterator.hasNext();) {
      //          Integer id = (Integer) iterator.next();
      //          BIObject obj=(BIObject)biobjDAO.loadBIObjectById(id);
      //          if(obj!=null){
      //            exportSingleObj(obj.getId().toString());
      //          }
      //          else{
      //            logger.error("Could not find object with id"+id);
      //          }
      //        }
      //
      //      }



      // maps catalogue export
      boolean isMap = false;
      if (biobj.getBiObjectTypeCode().equalsIgnoreCase("MAP")) isMap = true;
      if (isMap) {
        exporter.insertMapCatalogue(session);
      }

      if (exportSubObjects) {
        ISubObjectDAO subDao = DAOFactory.getSubObjectDAO();
        List subObjectLis = subDao.getSubObjects(biobj.getId());
        if (subObjectLis != null && !subObjectLis.isEmpty())
          exporter.insertAllSubObject(biobj, subObjectLis, session);
      }
      if (exportSnapshots) {
        ISnapshotDAO subDao = DAOFactory.getSnapshotDAO();
        List snapshotLis = subDao.getSnapshots(biobj.getId());
        if (snapshotLis != null && !snapshotLis.isEmpty())
          exporter.insertAllSnapshot(biobj, snapshotLis, session);
      }

      // insert functionalities and association with object
      List functs = biobj.getFunctionalities();
      Iterator iterFunct = functs.iterator();
      while (iterFunct.hasNext()) {
        Integer functId = (Integer) iterFunct.next();
        ILowFunctionalityDAO lowFunctDAO = DAOFactory.getLowFunctionalityDAO();
        LowFunctionality funct = lowFunctDAO.loadLowFunctionalityByID(functId, false);
        if (funct.getCodType().equals(SpagoBIConstants.USER_FUNCTIONALITY_TYPE_CODE)) {
          logger.debug("User folder [" + funct.getPath() + "] will be not exported.");
          // if the folder is a personal folder, it is not exported
          continue;
        }
        exporter.insertFunctionality(funct, session);
        exporter.insertObjFunct(biobj, funct, session);
      }
      // export parameters
      List biparams = biobjDAO.getBIObjectParameters(biobj);
      exportBIParamsBIObj(biparams, biobj);
      // export parameters dependecies
      exporter.insertBiParamDepend(biparams, session);

      // export subReport relation
View Full Code Here

Examples of it.eng.spagobi.analiticalmodel.document.dao.IBIObjectDAO

      Iterator i = kpiDocsList.iterator();
      while (i.hasNext()) {
        KpiDocuments doc = (KpiDocuments) i.next();
        String label = doc.getBiObjLabel();

        IBIObjectDAO biobjDAO = DAOFactory.getBIObjectDAO();
        BIObject biobj = biobjDAO.loadBIObjectByLabel(label);
        if(biobj!=null){
          insertBIObject(biobj, session, true);
          doc.setBiObjId(biobj.getId());       
        }
View Full Code Here

Examples of it.eng.spagobi.analiticalmodel.document.dao.IBIObjectDAO

      Iterator i = kpiDocsList.iterator();
      while (i.hasNext()) {
        KpiDocuments doc = (KpiDocuments) i.next();
        String label = doc.getBiObjLabel();

        IBIObjectDAO biobjDAO = DAOFactory.getBIObjectDAO();
        BIObject biobj = biobjDAO.loadBIObjectByLabel(label);
        if(biobj!=null){
          insertBIObject(biobj, session, true);
          doc.setBiObjId(biobj.getId());       
        }
View Full Code Here

Examples of it.eng.spagobi.analiticalmodel.document.dao.IBIObjectDAO

        throw new EMFUserError(EMFErrorSeverity.ERROR, "8010", "component_impexp_messages");

      }
    }

    IBIObjectDAO biobjDAO = DAOFactory.getBIObjectDAO();

    for (Iterator iterator = objsToInsert.iterator(); iterator.hasNext();) {
      Integer id = (Integer) iterator.next();
      BIObject obj=(BIObject)biobjDAO.loadBIObjectById(id);
      if(obj!=null){
        exportManager.exportSingleObj(obj.getId().toString());
      }
      else{
        logger.error("Could not find object with id"+id);
View Full Code Here

Examples of it.eng.spagobi.analiticalmodel.document.dao.IBIObjectDAO

  public static Integer LIMIT_DEFAULT = 16;

  @Override
  public void doService() {
    logger.debug("IN");
    IBIObjectDAO boDao;
    try {
      boDao = DAOFactory.getBIObjectDAO();
      boDao.setUserProfile(getUserProfile());
    } catch (EMFUserError e1) {
      logger.error(e1.getMessage(), e1);
      throw new SpagoBIServiceException(SERVICE_NAME,  "Error occurred");
    }
    Locale locale = getLocale();

    String serviceType = this.getAttributeAsString(MESSAGE_DET);
    logger.debug("Service type "+serviceType);
    if (serviceType != null && serviceType.equalsIgnoreCase(BIOBJECTS_LIST)) {
     
      try {   
       
        Integer start = getAttributeAsInteger( START );
        Integer limit = getAttributeAsInteger( LIMIT );
       
        if(start==null){
          start = START_DEFAULT;
        }
        if(limit==null){
          limit = LIMIT_DEFAULT;
        }

        Integer totalItemsNum = boDao.countBIObjects();
        List items = boDao.loadPagedObjectsList(start,limit);
        logger.debug("Loaded items list");
        JSONArray itemsJSON = (JSONArray) SerializerFactory.getSerializer("application/json").serialize(items, locale);
        JSONObject responseJSON = createJSONResponse(itemsJSON, totalItemsNum);

        writeBackToClient(new JSONSuccess(responseJSON));
View Full Code Here

Examples of it.eng.spagobi.analiticalmodel.document.dao.IBIObjectDAO

      numRows = 10;
      logger.error("Error while recovering number rows for " + "lookup from configuration, usign default 10", e);
  }
  paginator.setPageSize(numRows);
  logger.debug("setPageSize="+numRows);
  IBIObjectDAO objDAO = DAOFactory.getBIObjectDAO();
  List objectsList = null;
  logger.debug("Loading the documents list");
  if (initialPath != null && !initialPath.trim().equals("")) {
      objectsList = objDAO.loadAllBIObjectsFromInitialPath(initialPath, currentFieldOrder);
  } else {
      objectsList = objDAO.loadAllBIObjects(currentFieldOrder);
  }

  for (Iterator it = objectsList.iterator(); it.hasNext();) {
      BIObject obj = (BIObject) it.next();
      SourceBean rowSB = makeListRow(profile, obj);
View Full Code Here

Examples of it.eng.spagobi.analiticalmodel.document.dao.IBIObjectDAO

        throw new Exception("Functionality not specified");
      }

      //onlyOneFunct=true;
      Integer objId = new Integer(objIdStr);
      IBIObjectDAO biobjdao = DAOFactory.getBIObjectDAO();
      BIObject obj = biobjdao.loadBIObjectById(objId);
      Integer fId=Integer.decode(funcIdStr);

      // check that the functionality specified is the user one or that user is administrator

      // first case: user is administrator
      if(profile.isAbleToExecuteAction(SpagoBIConstants.DOCUMENT_MANAGEMENT_ADMIN)){
        biobjdao.eraseBIObject(obj, fId);
        logger.debug("Object deleted by administrator")
      }
      else
      {
        ILowFunctionalityDAO functDAO = DAOFactory.getLowFunctionalityDAO();
        LowFunctionality lowFunc = functDAO.loadLowFunctionalityByID(fId, false);

        if(lowFunc==null){
          logger.error("Functionality does not exist");
          throw new Exception("Functionality does not exist");         
        }

        if(lowFunc.getPath().equals("/"+userId)){ // folder is current user one
          biobjdao.eraseBIObject(obj, fId);
          logger.debug("Object deleted");
        }
        else{
          logger.error("Functionality is not user's one");
          throw new Exception("Functionality  is not user's one");         
View Full Code Here

Examples of it.eng.spagobi.analiticalmodel.document.dao.IBIObjectDAO

    Integer masterReportId = biobj.getId();
    String masterReportStatus = biobj.getStateCode();

    try {
      ISubreportDAO subrptdao = DAOFactory.getSubreportDAO();
      IBIObjectDAO biobjectdao = DAOFactory.getBIObjectDAO();

      List subreportList = subrptdao
      .loadSubreportsByMasterRptId(masterReportId);
      for (int i = 0; i < subreportList.size(); i++) {
        Subreport subreport = (Subreport) subreportList.get(i);
        BIObject subrptbiobj = biobjectdao
        .loadBIObjectForDetail(subreport.getSub_rpt_id());
        if (!isSubRptStatusAdmissible(masterReportStatus, subrptbiobj
            .getStateCode())) {
          errorHandler.addError(new EMFUserError(
              EMFErrorSeverity.ERROR, 1062));
View Full Code Here

Examples of it.eng.spagobi.analiticalmodel.document.dao.IBIObjectDAO

        logger.error("No function associated");
        throw new Exception("No function associated");
      }

      // Load document
      IBIObjectDAO biObjectDAOHibImpl = DAOFactory.getBIObjectDAO();
      biObjectDAOHibImpl.setUserProfile(profile);
      BIObject biObject = biObjectDAOHibImpl.loadBIObjectById(Integer.valueOf(documentIdStr));
      if (biObject == null) {
        logger.error("Could not load document");
        throw new Exception("Could not load document");
      }

      List funcs = biObject.getFunctionalities();
      if (funcs == null) {
        logger.error("BIObject with label " + biObject.getLabel() + " has no functionalities associated!!!");
        throw new Exception("BIObject with label " + biObject.getLabel() + " has no functionalities associated!!!");
      }
      if (!funcs.contains(idFunction)){
        funcs.add(idFunction);
        biObject.setFunctionalities(funcs);
        biObjectDAOHibImpl.modifyBIObject(biObject);
        logger.debug("Object modified");
        retCode = OK;
      }
      else {
        logger.warn("the object is already associated to the functionality");
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.