Examples of SbiDataSetHistory


Examples of it.eng.spagobi.tools.dataset.metadata.SbiDataSetHistory

      tx = aSession.beginTransaction();

      Query hibQuery = aSession.createQuery("from SbiDataSetHistory h where h.active = ? and h.sbiDsConfig = ?" );
      hibQuery.setBoolean(0, true);
      hibQuery.setInteger(1, dsId)
      SbiDataSetHistory dsActiveDetail =(SbiDataSetHistory)hibQuery.uniqueResult();
      if(dsActiveDetail!=null){
        toReturn = toIDataSet(dsActiveDetail);
      }
      tx.commit();
View Full Code Here

Examples of it.eng.spagobi.tools.dataset.metadata.SbiDataSetHistory

      Integer dsId = hibDS.getDsId();

      Query hibQuery = aSession.createQuery("from SbiDataSetHistory h where h.active = ? and h.sbiDsConfig = ?" );
      hibQuery.setBoolean(0, true);
      hibQuery.setInteger(1, dsId)
      SbiDataSetHistory dsActiveDetail =(SbiDataSetHistory)hibQuery.uniqueResult();
      if(dsActiveDetail!=null){
        toReturn = toIDataSet(dsActiveDetail);
      }
      tx.commit();
    } catch (HibernateException he) {
View Full Code Here

Examples of it.eng.spagobi.tools.dataset.metadata.SbiDataSetHistory

      List<SbiDataSetHistory> hibList = hibQuery.list();
      Iterator it = hibList.iterator();

      while (it.hasNext()) {
        SbiDataSetHistory temp = (SbiDataSetHistory) it.next();
        if(temp!=null){
          realResult.add(toIDataSet(temp));       
        }
      }
    } catch (HibernateException he) {
View Full Code Here

Examples of it.eng.spagobi.tools.dataset.metadata.SbiDataSetHistory

      // Make precedent active inactive, new one will be active
      Query hibQueryPreActive = sessionCurrDB.createQuery("from SbiDataSetHistory h where h.active = ? and h.sbiDsConfig = ?" );
      hibQueryPreActive.setBoolean(0, true);
      hibQueryPreActive.setInteger(1, existingId)
      SbiDataSetHistory  preActive = (SbiDataSetHistory)hibQueryPreActive.uniqueResult();
      preActive.setActive(false);
      sessionCurrDB.update(preActive);

      //      // finally save the new exported history
      //      // insert new Active dataset: in the export DB there is only one for each datasetConfig
      //      Query hibQuery = sessionExpDB.createQuery(" from SbiDataSetHistory where dsId = '" + exportedDataset.getDsId() + "'");
View Full Code Here

Examples of it.eng.spagobi.tools.dataset.metadata.SbiDataSetHistory

    logger.debug("IN");
    try {
      // save the new exported history
      // insert new Active dataset: in the export DB there is only one for each datasetConfig
      Query hibQuery = sessionExpDB.createQuery(" from SbiDataSetHistory where sbiDsConfig = '" + exportedDataset.getDsId() + "'");
      SbiDataSetHistory dsHistory = (SbiDataSetHistory)hibQuery.uniqueResult();

      // create a copy for current dataset (cannot modify the one retieved frome export DB
      SbiDataSetHistory dsnewHistory = DAOFactory.getDataSetDAO().copyDataSetHistory(dsHistory );

      dsnewHistory.setSbiDsConfig(dataset);

      // associate data source
      if (dsHistory instanceof SbiQueryDataSet) {
        SbiQueryDataSet queryDataSet = (SbiQueryDataSet) dsHistory;
        SbiDataSource ds = getAssociatedSbiDataSource(queryDataSet, sessionCurrDB, metaAss);
        if (ds != null) {
          ((SbiQueryDataSet) dsnewHistory).setDataSource(ds);
        }
      }

      SbiDomains transformer = getAssociatedTransfomerType(exportedDataset, sessionCurrDB, metaAss, importer);
      if (transformer != null) {
        dsnewHistory.setTransformer(transformer);

      }
      SbiCommonInfo i = new SbiCommonInfo();
      IEngUserProfile profile = (IEngUserProfile)session.getPermanentContainer().getAttribute(IEngUserProfile.ENG_USER_PROFILE);
      String userid = "biadmin";
      if(profile!=null){
        userid =(String) profile.getUserUniqueIdentifier();
      }
     
      dsnewHistory.setUserIn(userid);
      dsnewHistory.setTimeIn(new Date());
      dsnewHistory.setSbiVersionIn(SbiCommonInfo.SBI_VERSION);

      sessionCurrDB.save(dsnewHistory);

    } catch (EMFUserError e) {
      logger.error("EMF user Error",e);
View Full Code Here

Examples of it.eng.spagobi.tools.dataset.metadata.SbiDataSetHistory

      if(!hibList.isEmpty()) {
          logger.debug("dataset with id "+dataSet.getDsId()+" already inserted");
        return;
      }
     
      SbiDataSetHistory hibDataSetHistory =null;
      if(dataSet!=null){
        // get active dataset
        GuiDataSetDetail dataSetActiveDetail = dataSet.getActiveDetail();

        if(dataSetActiveDetail instanceof FileDataSetDetail){
          hibDataSetHistory=new SbiFileDataSet();
          if(((FileDataSetDetail)dataSetActiveDetail).getFileName()!=null){
            ((SbiFileDataSet)hibDataSetHistory).setFileName(((FileDataSetDetail)dataSetActiveDetail).getFileName());
          }
        } 
        else if(dataSetActiveDetail instanceof QueryDataSetDetail){
          hibDataSetHistory=new SbiQueryDataSet();
          if(((QueryDataSetDetail)dataSetActiveDetail).getQuery()!=null){
            ((SbiQueryDataSet)hibDataSetHistory).setQuery(((QueryDataSetDetail)dataSetActiveDetail).getQuery().toString());
          }
          if(((QueryDataSetDetail)dataSetActiveDetail).getDataSourceLabel()!=null){
            SbiDataSource hibDataSource = null;
            String dataSourceLabel = ((QueryDataSetDetail)dataSetActiveDetail).getDataSourceLabel();
            if(dataSourceLabel!=null && !dataSourceLabel.equals("")){
              IDataSourceDAO dataSourceDao = DAOFactory.getDataSourceDAO();
              IDataSource ds = dataSourceDao.loadDataSourceByLabel(dataSourceLabel);
              insertDataSource(ds, session);       
              Criterion labelCriterrion = Expression.eq("label", dataSourceLabel);
              Criteria criteria = session.createCriteria(SbiDataSource.class);
              criteria.add(labelCriterrion)
              hibDataSource = (SbiDataSource) criteria.uniqueResult();
              ((SbiQueryDataSet)hibDataSetHistory).setDataSource(hibDataSource)
            }
          }       
        }else if(dataSetActiveDetail instanceof QbeDataSetDetail){
          hibDataSetHistory = new SbiQbeDataSet();
          SbiQbeDataSet hibQbeDataSet = (SbiQbeDataSet) hibDataSetHistory;
          QbeDataSetDetail qbeDataSet = (QbeDataSetDetail) dataSetActiveDetail;
          hibQbeDataSet.setSqlQuery(qbeDataSet.getSqlQuery());
          hibQbeDataSet.setJsonQuery(qbeDataSet.getJsonQuery());
          hibQbeDataSet.setDatamarts(qbeDataSet.getDatamarts());
          String dataSourceLabel = qbeDataSet.getDataSourceLabel();
          Criterion labelCriterrion = Expression.eq("label", dataSourceLabel);
          Criteria criteria = session.createCriteria(SbiDataSource.class);
          criteria.add(labelCriterrion)
          SbiDataSource hibDataSource = (SbiDataSource) criteria.uniqueResult();
          hibQbeDataSet.setDataSource(hibDataSource)
        }   
        else if(dataSetActiveDetail instanceof WSDataSetDetail){
          hibDataSetHistory=new SbiWSDataSet();
          if(((WSDataSetDetail)dataSetActiveDetail).getAddress()!=null){
            ((SbiWSDataSet)hibDataSetHistory).setAdress(((WSDataSetDetail)dataSetActiveDetail).getAddress());
          }
          if(((WSDataSetDetail)dataSetActiveDetail).getOperation()!=null){
            ((SbiWSDataSet)hibDataSetHistory).setOperation(((WSDataSetDetail)dataSetActiveDetail).getOperation());
         
        }

        else if(dataSetActiveDetail instanceof JClassDataSetDetail){
          hibDataSetHistory=new SbiJClassDataSet();
          if(((JClassDataSetDetail)dataSetActiveDetail).getJavaClassName()!=null){
            ((SbiJClassDataSet)hibDataSetHistory).setJavaClassName(((JClassDataSetDetail)dataSetActiveDetail).getJavaClassName());
          }
        }

        else if(dataSetActiveDetail instanceof ScriptDataSetDetail){
          hibDataSetHistory=new SbiScriptDataSet();
          if(((ScriptDataSetDetail)dataSetActiveDetail).getScript()!=null){
            ((SbiScriptDataSet)hibDataSetHistory).setScript(((ScriptDataSetDetail)dataSetActiveDetail).getScript());
          }
          if(((ScriptDataSetDetail)dataSetActiveDetail).getLanguageScript()!=null){
            ((SbiScriptDataSet)hibDataSetHistory).setLanguageScript(((ScriptDataSetDetail)dataSetActiveDetail).getLanguageScript());
          }
        }

        SbiDomains transformer = null;
        if (dataSetActiveDetail.getTransformerId() != null){
          Criterion aCriterion = Expression.eq("valueId",  dataSetActiveDetail.getTransformerId());
          Criteria criteria = session.createCriteria(SbiDomains.class);
          criteria.add(aCriterion);

          transformer = (SbiDomains) criteria.uniqueResult();

          if (transformer == null){
            logger.error("The Domain with value_id= "+dataSetActiveDetail.getTransformerId()+" does not exist.");
            throw new EMFUserError(EMFErrorSeverity.ERROR, 1035);
          }
        }

        SbiDomains category = null;
        if (dataSetActiveDetail.getCategoryId()!= null){
          Criterion aCriterion = Expression.eq("valueId",  dataSetActiveDetail.getCategoryId());
          Criteria criteria = session.createCriteria(SbiDomains.class);
          criteria.add(aCriterion);

          category = (SbiDomains) criteria.uniqueResult();

          if (category == null){
            logger.error("The Domain with value_id= "+dataSetActiveDetail.getCategoryId()+" does not exist.");
            throw new EMFUserError(EMFErrorSeverity.ERROR, 1035);
          }
        }
        Date currentTStamp = new Date();

        // Fill dataset config values

        SbiDataSetConfig hibDataSetConfig = new SbiDataSetConfig()

        hibDataSetConfig.setDsId(dataSet.getDsId());
        hibDataSetConfig.setLabel(dataSet.getLabel());
        hibDataSetConfig.setDescription(dataSet.getDescription());
        hibDataSetConfig.setName(dataSet.getName())

        tx = session.beginTransaction();
        session.save(hibDataSetConfig);
        tx.commit();

        // Fill Data set history values
        hibDataSetHistory.setSbiDsConfig(hibDataSetConfig);
        if(dataSetActiveDetail.getDsHId()!=0){
          hibDataSetHistory.setDsHId(dataSetActiveDetail.getDsHId());
        }     
        hibDataSetHistory.setVersionNum(1);
        hibDataSetHistory.setActive(true);     

        hibDataSetHistory.setTransformer(transformer);
        hibDataSetHistory.setPivotColumnName(dataSetActiveDetail.getPivotColumnName());
        hibDataSetHistory.setPivotRowName(dataSetActiveDetail.getPivotRowName());
        hibDataSetHistory.setPivotColumnValue(dataSetActiveDetail.getPivotColumnValue());
        hibDataSetHistory.setNumRows(dataSetActiveDetail.isNumRows());

        hibDataSetHistory.setCategory(category);
        hibDataSetHistory.setParameters(dataSetActiveDetail.getParameters());
        hibDataSetHistory.setDsMetadata(dataSetActiveDetail.getDsMetadata());
       
        tx2 = session.beginTransaction();
        session.save(hibDataSetHistory);
        tx2.commit();
      }
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.