Examples of SbiDataSource


Examples of it.eng.spagobi.tools.datasource.metadata.SbiDataSource

    }

    if(hibDataSet instanceof SbiQueryDataSet){     
      dsVersionDetail=new QueryDataSetDetail();
      ((QueryDataSetDetail)dsVersionDetail).setQuery(((SbiQueryDataSet)hibDataSet).getQuery());
      SbiDataSource sbids=((SbiQueryDataSet)hibDataSet).getDataSource();
      if(sbids!=null){
        String dataSourceLabel = sbids.getLabel();
        ((QueryDataSetDetail)dsVersionDetail).setDataSourceLabel(dataSourceLabel);
      }
      dsVersionDetail.setDsType(JDBC_DS_TYPE);
    }
   
    if (hibDataSet instanceof SbiQbeDataSet){     
      dsVersionDetail = new QbeDataSetDetail();
      QbeDataSetDetail aQbeDataSetDetail = (QbeDataSetDetail) dsVersionDetail;
      SbiQbeDataSet qbeHibDataSet = (SbiQbeDataSet) hibDataSet;
      aQbeDataSetDetail.setSqlQuery(qbeHibDataSet.getSqlQuery());
      aQbeDataSetDetail.setJsonQuery(qbeHibDataSet.getJsonQuery());
      aQbeDataSetDetail.setDatamarts(qbeHibDataSet.getDatamarts());
      SbiDataSource sbids = qbeHibDataSet.getDataSource();
      if (sbids!=null) aQbeDataSetDetail.setDataSourceLabel(sbids.getLabel());
      dsVersionDetail.setDsType(QBE_DS_TYPE);
    }

    if(hibDataSet instanceof SbiWSDataSet){     
      dsVersionDetail=new WSDataSetDetail();
View Full Code Here

Examples of it.eng.spagobi.tools.datasource.metadata.SbiDataSource

    if(hibDataSet instanceof SbiQueryDataSet){     
      ds=new JDBCDataSet();
      ((JDBCDataSet)ds).setQuery(((SbiQueryDataSet)hibDataSet).getQuery());

      SbiDataSource sbids=((SbiQueryDataSet)hibDataSet).getDataSource();
      if(sbids!=null){
        DataSourceDAOHibImpl dataSourceDao=new DataSourceDAOHibImpl();
        IDataSource dataSource=dataSourceDao.toDataSource(sbids);
        ((JDBCDataSet)ds).setDataSource(dataSource);
      }
      ds.setDsType(DataSetConstants.QUERY);
    }

    if(hibDataSet instanceof SbiWSDataSet){     
      ds=new WebServiceDataSet();
      ((WebServiceDataSet)ds).setAddress(((SbiWSDataSet)hibDataSet).getAdress());
      ((WebServiceDataSet)ds).setOperation(((SbiWSDataSet)hibDataSet).getOperation());
      ds.setDsType(DataSetConstants.WEB_SERVICE);
    }

    if(hibDataSet instanceof SbiScriptDataSet){     
      ds=new ScriptDataSet();
      ((ScriptDataSet)ds).setScript(((SbiScriptDataSet)hibDataSet).getScript());
      ((ScriptDataSet)ds).setLanguageScript(((SbiScriptDataSet)hibDataSet).getLanguageScript());
      ds.setDsType(DataSetConstants.SCRIPT);
    }

    if(hibDataSet instanceof SbiJClassDataSet){     
      ds=new JavaClassDataSet();
      ((JavaClassDataSet)ds).setClassName(((SbiJClassDataSet)hibDataSet).getJavaClassName());
      ds.setDsType(DataSetConstants.JAVA_CLASS);
    }
   
    if (hibDataSet instanceof SbiQbeDataSet) {     
      ds = new QbeDataSet();
      SbiQbeDataSet aSbiQbeDataSet = (SbiQbeDataSet) hibDataSet;
      QbeDataSet qbeDataset = (QbeDataSet) ds;
      qbeDataset.setJsonQuery(aSbiQbeDataSet.getJsonQuery());
      qbeDataset.setDatamarts(aSbiQbeDataSet.getDatamarts());
     
      SbiDataSource sbids = aSbiQbeDataSet.getDataSource();
      if (sbids!=null){
        DataSourceDAOHibImpl dataSourceDao = new DataSourceDAOHibImpl();
        IDataSource dataSource = dataSourceDao.toDataSource(sbids);
        qbeDataset.setDataSource(dataSource);       
      }
View Full Code Here

Examples of it.eng.spagobi.tools.datasource.metadata.SbiDataSource

   *
   * @return the sbi data source
   */
  public static SbiDataSource makeNewSbiDataSource(SbiDataSource ds){
    logger.debug("IN");
    SbiDataSource newDS = new SbiDataSource();
    newDS.setDescr(ds.getDescr());
    newDS.setLabel(ds.getLabel());
    newDS.setJndi(ds.getJndi());
    newDS.setDriver(ds.getDriver());
    newDS.setPwd(ds.getPwd());
    newDS.setUrl_connection(ds.getUrl_connection());
    newDS.setUser(ds.getUser());
    newDS.setMultiSchema((ds.getMultiSchema()!=null) ? ds.getMultiSchema() : Boolean.valueOf(false) );
    newDS.setSchemaAttribute(ds.getSchemaAttribute());
    logger.debug("OUT");
    return newDS;
 
View Full Code Here

Examples of it.eng.spagobi.tools.datasource.metadata.SbiDataSource

  public static SbiDataSource modifyExistingSbiDataSource(
      SbiDataSource dataSource, Session sessionCurrDB,
      Integer existingDatasourceId) {
    logger.debug("IN");
    SbiDataSource existingDatasource = null;
    try {
      existingDatasource = (SbiDataSource) sessionCurrDB.load(SbiDataSource.class, existingDatasourceId);
      existingDatasource.setDescr(dataSource.getDescr());
      existingDatasource.setDialect(dataSource.getDialect());
      existingDatasource.setDialectDescr(dataSource.getDialectDescr());
      existingDatasource.setDriver(dataSource.getDriver());
      existingDatasource.setJndi(dataSource.getJndi());
      existingDatasource.setLabel(dataSource.getLabel());
      existingDatasource.setPwd(dataSource.getPwd());
      existingDatasource.setUrl_connection(dataSource.getUrl_connection());
      existingDatasource.setUser(dataSource.getUser());
      existingDatasource.setMultiSchema((dataSource.getMultiSchema()!=null) ? dataSource.getMultiSchema() : Boolean.valueOf(false));
      existingDatasource.setSchemaAttribute(dataSource.getSchemaAttribute());
    } finally {
      logger.debug("OUT");
    }
    return existingDatasource;
  }
View Full Code Here

Examples of it.eng.spagobi.tools.datasource.metadata.SbiDataSource

      if (existDomSt != null) {
        obj.setState(existDomSt);
        obj.setStateCode(existDomSt.getValueCd());
      }
      // reading exist datasource
      SbiDataSource localDS = getAssociatedSbiDataSource(exportedObj, sessionCurrDB, metaAss);
      if (localDS != null) obj.setDataSource(localDS);
      // reading exist datasset
      SbiDataSetConfig localDataSet = getAssociatedSbiDataSet(exportedObj, sessionCurrDB, metaAss);
      if (localDataSet != null) obj.setDataSet(localDataSet);
    } finally {
View Full Code Here

Examples of it.eng.spagobi.tools.datasource.metadata.SbiDataSource

  private static SbiDataSource getAssociatedSbiDataSource(
      SbiObjects exportedObj, Session sessionCurrDB,
      MetadataAssociations metaAss) {
    logger.debug("IN");
    SbiDataSource expDs = exportedObj.getDataSource();
    if (expDs != null) {
      Integer existingDsId = (Integer) metaAss.getDataSourceIDAssociation().get(new Integer(expDs.getDsId()));
      //      if (label == null) {
      //      // exist a DataSource Association, read a new DataSource
      //      // from the DB
      //      label = expDs.getLabel();
      //      }
      //      Criterion labelCriterrion = Expression.eq("label", label);
      //      Criteria criteria = sessionCurrDB.createCriteria(SbiDataSource.class);
      //      criteria.add(labelCriterrion);
      //      SbiDataSource localDS = (SbiDataSource) criteria.uniqueResult();
      SbiDataSource localDS = (SbiDataSource) sessionCurrDB.load(SbiDataSource.class, existingDsId);
      logger.debug("OUT");
      return localDS;
    } else {
      logger.debug("OUT");
      return null;
View Full Code Here

Examples of it.eng.spagobi.tools.datasource.metadata.SbiDataSource

  }

  private static SbiDataSource getAssociatedSbiDataSource(SbiQueryDataSet exportedDataset,
      Session sessionCurrDB, MetadataAssociations metaAss) {
    logger.debug("IN");
    SbiDataSource existingDs = null;
    SbiDataSource exportedDs = exportedDataset.getDataSource();
    if (exportedDs != null) {
      Integer exportedDsId = new Integer(exportedDs.getDsId());
      Map assDatasources = metaAss.getDataSourceIDAssociation();
      Integer existingDsID = (Integer) assDatasources.get(exportedDsId);
      existingDs = (SbiDataSource) sessionCurrDB.load(SbiDataSource.class, existingDsID);
    }
    logger.debug("OUT");
View Full Code Here

Examples of it.eng.spagobi.tools.datasource.metadata.SbiDataSource

      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);
        }
      }
View Full Code Here

Examples of it.eng.spagobi.tools.datasource.metadata.SbiDataSource

      if(!hibList.isEmpty()) {
        return;
      }
      SbiDomains dialect=(SbiDomains)session.load(SbiDomains.class, ds.getDialectId());

      SbiDataSource hibDS = new SbiDataSource(ds.getDsId());
      hibDS.setDescr(ds.getDescr());
      hibDS.setDriver(ds.getDriver());
      hibDS.setJndi(ds.getJndi());
      hibDS.setLabel(ds.getLabel());
      hibDS.setPwd(ds.getPwd());
      hibDS.setUrl_connection(ds.getUrlConnection());
      hibDS.setUser(ds.getUser());
      hibDS.setDialect(dialect);
      hibDS.setSchemaAttribute(ds.getSchemaAttribute());
      hibDS.setMultiSchema(ds.getMultiSchema());   

      // va aggiunto il legame con gli engine e il doc ????

      session.save(hibDS);
      tx.commit();
View Full Code Here

Examples of it.eng.spagobi.tools.datasource.metadata.SbiDataSource

          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){
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.