Examples of IDataSourceDAO


Examples of it.eng.spagobi.tools.datasource.dao.IDataSourceDAO

   */
  private void modifyDataSource(SourceBean serviceRequest, String mod, SourceBean serviceResponse)
    throws EMFUserError, SourceBeanException {
   
    try {
      IDataSourceDAO dao=DAOFactory.getDataSourceDAO();
      dao.setUserProfile(profile);
     
      DataSource dsNew = recoverDataSourceDetails(serviceRequest);
     
      EMFErrorHandler errorHandler = getErrorHandler();
      
      // if there are some validation errors into the errorHandler does not write into DB
      Collection errors = errorHandler.getErrors();
      if (errors != null && errors.size() > 0) {
        Iterator iterator = errors.iterator();
        while (iterator.hasNext()) {
          Object error = iterator.next();
          if (error instanceof EMFValidationError) {
            serviceResponse.setAttribute("dsObj", dsNew);
            serviceResponse.setAttribute("modality", mod);
            return;
          }
        }
      }
     
      if (mod.equalsIgnoreCase(SpagoBIConstants.DETAIL_INS)) {     
        //if a ds with the same label not exists on db ok else error
        if (DAOFactory.getDataSourceDAO().loadDataSourceByLabel(dsNew.getLabel()) != null){
          HashMap params = new HashMap();
          params.put(AdmintoolsConstants.PAGE, ListDataSourceModule.MODULE_PAGE);
          EMFUserError error = new EMFUserError(EMFErrorSeverity.ERROR, 8004, new Vector(), params );
          getErrorHandler().addError(error);
          return;
        }      

        dao.insertDataSource(dsNew);
       
        IDataSource tmpDS = dao.loadDataSourceByLabel(dsNew.getLabel());
        dsNew.setDsId(tmpDS.getDsId());
        mod = SpagoBIConstants.DETAIL_MOD;
      } else {       
        //update ds
        dao.modifyDataSource(dsNew);     
     
      IDomainDAO domaindao = DAOFactory.getDomainDAO();
      List dialects = domaindao.loadListDomainsByType("DIALECT_HIB");
      serviceResponse.setAttribute(NAME_ATTR_LIST_DIALECTS, dialects);
     
View Full Code Here

Examples of it.eng.spagobi.tools.datasource.dao.IDataSourceDAO

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

Examples of it.eng.spagobi.tools.datasource.dao.IDataSourceDAO

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

Examples of it.eng.spagobi.tools.datasource.dao.IDataSourceDAO

      String type = lov.getITypeCd();
      if(type.equalsIgnoreCase("QUERY")) {
        String provider = lov.getLovProvider();
        QueryDetail queryDet = QueryDetail.fromXML(provider);
        String datasourceName = queryDet.getDataSource();
        IDataSourceDAO dsDAO = DAOFactory.getDataSourceDAO();
        List allDS = dsDAO.loadAllDataSources();
        Iterator allDSIt = allDS.iterator();
        IDataSource dsFound = null;
        while (allDSIt.hasNext()) {
          IDataSource ds = (IDataSource) allDSIt.next();
          if (ds.getLabel().equals(datasourceName)) {
View Full Code Here

Examples of it.eng.spagobi.tools.datasource.dao.IDataSourceDAO

            "ImportExportExistingMetadataAssociation");
        }
    } else {
      // move to jsp
      List exportedDatasources = impManager.getExportedDataSources();
      IDataSourceDAO dsDao=DAOFactory.getDataSourceDAO();
      List currentDatasources = dsDao.loadAllDataSources();
      response.setAttribute(ImportExportConstants.LIST_EXPORTED_DATA_SOURCES, exportedDatasources);
      response.setAttribute(ImportExportConstants.LIST_CURRENT_DATA_SOURCES, currentDatasources);
      response.setAttribute(ImportExportConstants.PUBLISHER_NAME, "ImportExportDataSourceAssociation");
    }
View Full Code Here

Examples of it.eng.spagobi.tools.datasource.dao.IDataSourceDAO

    RequestContainer requestContainer = this.getRequestContainer();
    SessionContainer session = requestContainer.getSessionContainer();
    impManager = (IImportManager) session.getAttribute(ImportExportConstants.IMPORT_MANAGER);
    impManager.openSession();
    List exportedDataSources = impManager.getExportedDataSources();
    IDataSourceDAO dsDao=DAOFactory.getDataSourceDAO();
    List currentDatasources = dsDao.loadAllDataSources();
      response.setAttribute(ImportExportConstants.LIST_EXPORTED_DATA_SOURCES, exportedDataSources);
      response.setAttribute(ImportExportConstants.LIST_CURRENT_DATA_SOURCES, currentDatasources);
      response.setAttribute(ImportExportConstants.PUBLISHER_NAME, "ImportExportDataSourceAssociation");
  } catch (SourceBeanException sbe) {
      logger.error("Error while populating response source bean ", sbe);
View Full Code Here

Examples of it.eng.spagobi.tools.datasource.dao.IDataSourceDAO

  public boolean associateAllExportedDataSourcesByUserAssociation() throws EMFUserError {
    logger.debug("IN");
    try {
      List exportedDataSources = this.getExportedDataSources();
      if (exportedDataSources == null || exportedDataSources.size() == 0) return false;
      IDataSourceDAO datasourceDAO = DAOFactory.getDataSourceDAO();
      List currentDataSources = datasourceDAO.loadAllDataSources();
      Iterator exportedDataSourcesIt = exportedDataSources.iterator();
      while (exportedDataSourcesIt.hasNext()) {
        IDataSource exportedDataSource = (IDataSource) exportedDataSourcesIt.next();
        String associatedDataSourceLabel = this.getUserAssociation().getAssociatedDataSource(exportedDataSource.getLabel());
        if (associatedDataSourceLabel == null || associatedDataSourceLabel.trim().equals("")) return true;
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.