Package it.eng.spagobi.tools.datasource.metadata

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


          aEngine.getId());
      SbiDomains hibDomainBiobjType = (SbiDomains) aSession.load(SbiDomains.class,
          aEngine.getBiobjTypeId());
      SbiDomains hibDomainEngineType = (SbiDomains) aSession.load(SbiDomains.class,
          aEngine.getEngineTypeId());
      SbiDataSource hibDataSource = null;
      if (aEngine.getDataSourceId() != null) {
        hibDataSource = (SbiDataSource) aSession.load(SbiDataSource.class, aEngine.getDataSourceId());
      }
      hibEngine.setName(aEngine.getName());
      hibEngine.setLabel(aEngine.getLabel());
View Full Code Here


      tx = aSession.beginTransaction();
      SbiDomains hibDomainBiobjType = (SbiDomains) aSession.load(SbiDomains.class,
          aEngine.getBiobjTypeId());
      SbiDomains hibDomainEngineType = (SbiDomains) aSession.load(SbiDomains.class,
          aEngine.getEngineTypeId());
      SbiDataSource hibDataSource = null;
      if (aEngine.getDataSourceId() != null) {
        hibDataSource = (SbiDataSource) aSession.load(SbiDataSource.class, aEngine.getDataSourceId());
      }
      SbiEngines hibEngine = new SbiEngines();
      hibEngine.setName(aEngine.getName());
View Full Code Here

    Transaction tx = null;

    try {
      aSession = getSession();
      tx = aSession.beginTransaction();
      SbiDataSource hibDataSource = (SbiDataSource)aSession.load(SbiDataSource.class,  dsID);
      toReturn = toDataSource(hibDataSource);
      tx.commit();
     
    } catch (HibernateException he) {
      logger.error("Error while loading the data source with id " + dsID.toString(), he);     
View Full Code Here

      tmpSession = getSession();
      tx = tmpSession.beginTransaction();
      Criterion labelCriterrion = Expression.eq("label", label);
      Criteria criteria = tmpSession.createCriteria(SbiDataSource.class);
      criteria.add(labelCriterrion)
      SbiDataSource hibDS = (SbiDataSource) criteria.uniqueResult();
      if (hibDS == null) return null;
      biDS = toDataSource(hibDS);       
     
      tx.commit();
    } catch (HibernateException he) {
View Full Code Here

        logger.error("The Domain with value_id= "+aDataSource.getDialectId()+" does not exist.");
        throw new EMFUserError(EMFErrorSeverity.ERROR, 1035);
      }

      //If DataSource Label has changed all LOVS with that DS need to be changed
      SbiDataSource hibDataSource = (SbiDataSource) aSession.load(SbiDataSource.class,
          new Integer(aDataSource.getDsId()))
      if (aDataSource.getLabel() != null && hibDataSource.getLabel() != null){
      if (!aDataSource.getLabel().equals(hibDataSource.getLabel())){
        Query hibQuery = aSession.createQuery(" from SbiLov s where s.inputTypeCd = 'QUERY'");
       
        List hibList = hibQuery.list();
        if (!hibList.isEmpty()){
        Iterator it = hibList.iterator()
        while (it.hasNext()) {
          SbiLov lov = (SbiLov)it.next();
          String prov = lov.getLovProvider();
            SourceBean sb = SourceBean.fromXMLString(prov);
            SourceBean conn = (SourceBean)sb.getAttribute("CONNECTION");
            String conne = conn.getCharacters();
            if (conne.equals(hibDataSource.getLabel())){
              int cutStart = prov.indexOf("<CONNECTION>");
              cutStart = cutStart+12;
              int cutEnd = prov.indexOf("</CONNECTION>");
              String firstPart = prov.substring(0, cutStart);
              String secondPart = prov.substring(cutEnd, prov.length());
              prov = firstPart+aDataSource.getLabel()+secondPart;
              lov.setLovProvider(prov);
              aSession.update(lov);
            }
           
        }}
      }}
      hibDataSource.setLabel(aDataSource.getLabel());
      hibDataSource.setDialect(dialect);
      hibDataSource.setDialectDescr(dialect.getValueNm());
      hibDataSource.setDescr(aDataSource.getDescr());
      hibDataSource.setJndi(aDataSource.getJndi());
      hibDataSource.setUrl_connection(aDataSource.getUrlConnection());
      hibDataSource.setUser(aDataSource.getUser());
      hibDataSource.setPwd(aDataSource.getPwd());
      hibDataSource.setDriver(aDataSource.getDriver());
      hibDataSource.setMultiSchema(aDataSource.getMultiSchema());
      hibDataSource.setSchemaAttribute(aDataSource.getSchemaAttribute());
      updateSbiCommonInfo4Update(hibDataSource);
      tx.commit();
    } catch (HibernateException he) {
      logger.error("Error while modifing the data source with id " + ((aDataSource == null)?"":String.valueOf(aDataSource.getDsId())), he);
View Full Code Here

      if (dialect == null){
        logger.error("The Domain with value_id="+aDataSource.getDialectId()+" does not exist.");
        throw new EMFUserError(EMFErrorSeverity.ERROR, 1035);
      }
      SbiDataSource hibDataSource = new SbiDataSource();
      hibDataSource.setDialect(dialect);
      hibDataSource.setDialectDescr(dialect.getValueNm());
      hibDataSource.setLabel(aDataSource.getLabel());
      hibDataSource.setDescr(aDataSource.getDescr());
      hibDataSource.setJndi(aDataSource.getJndi());
      hibDataSource.setUrl_connection(aDataSource.getUrlConnection());
      hibDataSource.setUser(aDataSource.getUser());
      hibDataSource.setPwd(aDataSource.getPwd());
      hibDataSource.setDriver(aDataSource.getDriver());
      hibDataSource.setMultiSchema(aDataSource.getMultiSchema());
      hibDataSource.setSchemaAttribute(aDataSource.getSchemaAttribute());
      updateSbiCommonInfo4Insert(hibDataSource);
      aSession.save(hibDataSource);
      tx.commit();
    } catch (HibernateException he) {
      logger.error("Error while inserting the data source with id " + ((aDataSource == null)?"":String.valueOf(aDataSource.getDsId())), he);
View Full Code Here

    Session aSession = null;
    Transaction tx = null;
    try {
      aSession = getSession();
      tx = aSession.beginTransaction();
      SbiDataSource hibDataSource = (SbiDataSource) aSession.load(SbiDataSource.class,
          new Integer(aDataSource.getDsId()));

      aSession.delete(hibDataSource);
      tx.commit();
    } catch (HibernateException he) {
View Full Code Here

          hibDataSet=new SbiQueryDataSet();
          if(((QueryDataSetDetail)dataSetActiveDetail).getQuery()!=null){
            ((SbiQueryDataSet)hibDataSet).setQuery(((QueryDataSetDetail)dataSetActiveDetail).getQuery().toString());
          }
          if(((QueryDataSetDetail)dataSetActiveDetail).getDataSourceLabel()!=null){
            SbiDataSource hibDataSource = null;
            String dataSourceLabel = ((QueryDataSetDetail)dataSetActiveDetail).getDataSourceLabel();
            Criterion labelCriterrion = Expression.eq("label", dataSourceLabel);
            Criteria criteria = aSession.createCriteria(SbiDataSource.class);
            criteria.add(labelCriterrion)
            hibDataSource = (SbiDataSource) criteria.uniqueResult();
            ((SbiQueryDataSet)hibDataSet).setDataSource(hibDataSource)
          }       
        } 
       
        else if(dataSetActiveDetail instanceof QbeDataSetDetail){
          hibDataSet = new SbiQbeDataSet();
          SbiQbeDataSet hibQbeDataSet = (SbiQbeDataSet) hibDataSet;
          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 = aSession.createCriteria(SbiDataSource.class);
          criteria.add(labelCriterrion)
          SbiDataSource hibDataSource = (SbiDataSource) criteria.uniqueResult();
          hibQbeDataSet.setDataSource(hibDataSource)
        }

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

          hibDataSet=new SbiQueryDataSet();
          if(((QueryDataSetDetail)dsActiveDetailToSet).getQuery()!=null){
            ((SbiQueryDataSet)hibDataSet).setQuery(((QueryDataSetDetail)dsActiveDetailToSet).getQuery().toString());
          }
          if(((QueryDataSetDetail)dsActiveDetailToSet).getDataSourceLabel()!=null){
            SbiDataSource hibDataSource = null;
            String dataSourceLabel = ((QueryDataSetDetail)dsActiveDetailToSet).getDataSourceLabel();
            Criterion labelCriterrion = Expression.eq("label", dataSourceLabel);
            Criteria criteria = aSession.createCriteria(SbiDataSource.class);
            criteria.add(labelCriterrion)
            hibDataSource = (SbiDataSource) criteria.uniqueResult();
            ((SbiQueryDataSet)hibDataSet).setDataSource(hibDataSource)
          }       
        }
       
        else if (dsActiveDetailToSet instanceof QbeDataSetDetail) {
          hibDataSet = new SbiQbeDataSet();
          SbiQbeDataSet hibQbeDataSet = (SbiQbeDataSet) hibDataSet;
          QbeDataSetDetail qbeDataSet = (QbeDataSetDetail) dsActiveDetailToSet;
          hibQbeDataSet.setSqlQuery(qbeDataSet.getSqlQuery());
          hibQbeDataSet.setJsonQuery(qbeDataSet.getJsonQuery());
          hibQbeDataSet.setDatamarts(qbeDataSet.getDatamarts());
          String dataSourceLabel = qbeDataSet.getDataSourceLabel();
          Criterion labelCriterrion = Expression.eq("label", dataSourceLabel);
          Criteria criteria = aSession.createCriteria(SbiDataSource.class);
          criteria.add(labelCriterrion)
          SbiDataSource hibDataSource = (SbiDataSource) criteria.uniqueResult();
          hibQbeDataSet.setDataSource(hibDataSource)
        }

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

    }

    if(hibDataSet instanceof SbiQueryDataSet){     
      dsActiveDetail=new QueryDataSetDetail();
      ((QueryDataSetDetail)dsActiveDetail).setQuery(((SbiQueryDataSet)hibDataSet).getQuery());
      SbiDataSource sbids=((SbiQueryDataSet)hibDataSet).getDataSource();
      if(sbids!=null){
        String dataSourceLabel = sbids.getLabel();
        ((QueryDataSetDetail)dsActiveDetail).setDataSourceLabel(dataSourceLabel);
      }
      dsActiveDetail.setDsType(JDBC_DS_TYPE);
      logger.debug("Jdbc dataset");
    }
   
    if(hibDataSet instanceof SbiQbeDataSet){     
      dsActiveDetail = new QbeDataSetDetail();
      QbeDataSetDetail aQbeDataSetDetail = (QbeDataSetDetail) dsActiveDetail;
      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());
      }
      dsActiveDetail.setDsType(QBE_DS_TYPE);
    }

    if(hibDataSet instanceof SbiWSDataSet){     
View Full Code Here

TOP

Related Classes of it.eng.spagobi.tools.datasource.metadata.SbiDataSource

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.