Package it.eng.spagobi.tools.datasource.bo

Examples of it.eng.spagobi.tools.datasource.bo.DataSource


      String sqlQuery = statement.getSqlQueryString();
      UserProfile userProfile = (UserProfile)getEnv().get(EngineConstants.ENV_USER_PROFILE);
     
      ConnectionDescriptor connection = (ConnectionDescriptor)getDataSource().getConfiguration().loadDataSourceProperties().get("connection");
      DataSource dataSource = getDataSource(connection);
     
      String sqlStatement = buildSqlStatement(crosstabDefinition, query, sqlQuery, statement);
      logger.debug("Querying temporary table: user [" + userProfile.getUserId() + "] (SQL): [" + sqlStatement + "]");
     
      if (!TemporaryTableManager.isEnabled()) {
View Full Code Here


      logger.debug("OUT");
   
  }

  private DataSource getDataSource(ConnectionDescriptor connection) {
    DataSource dataSource = new DataSource();
    dataSource.setJndi(connection.getJndiName());
    dataSource.setHibDialectName(connection.getDialect());
    dataSource.setUrlConnection(connection.getUrl());
    dataSource.setDriver(connection.getDriverClass());
    dataSource.setUser(connection.getUsername());
    dataSource.setPwd(connection.getPassword());
    return dataSource;
  }
View Full Code Here

        logger.debug("Executing query: [" + sqlQuery + "]");
        auditlogger.info("[" + userProfile.getUserId() + "]:: SQL: " + sqlQuery);
       
        dataSet = new JDBCDataSet();
        ConnectionDescriptor connection = (ConnectionDescriptor)getDataSource().getConfiguration().loadDataSourceProperties().get("connection");
        DataSource dataSource = new DataSource();
        dataSource.setJndi(connection.getJndiName());
        dataSource.setHibDialectName(connection.getDialect());
        dataSource.setUrlConnection(connection.getUrl());
        dataSource.setDriver(connection.getDriverClass());
        dataSource.setUser(connection.getUsername());
        dataSource.setPwd(connection.getPassword());
        dataSet.setDataSource(dataSource);
        dataSet.setQuery(sqlQuery);
        dataSet.loadData(start, limit, -1);
        dataStore = dataSet.getDataStore();
      } catch (Exception e) {
View Full Code Here

   *
   * @see it.eng.spagobi.tools.datasource.dao.IDataSourceDAO#loadDataSourceByID(java.lang.Integer)
   */
  public DataSource loadDataSourceByID(Integer dsID) throws EMFUserError {
    logger.debug("IN");
    DataSource toReturn = null;
    Session aSession = null;
    Transaction tx = null;

    try {
      aSession = getSession();
View Full Code Here

   * @param hibDataSource The hybernate data source
   *
   * @return The corrispondent <code>DataSource</code> object
   */
  public DataSource toDataSource(SbiDataSource hibDataSource){
    DataSource ds = new DataSource();
    
    ds.setDsId(hibDataSource.getDsId());
    ds.setLabel(hibDataSource.getLabel());
    ds.setDescr(hibDataSource.getDescr());
    ds.setJndi(hibDataSource.getJndi());
    ds.setUrlConnection(hibDataSource.getUrl_connection());
    ds.setUser(hibDataSource.getUser());
    ds.setPwd(hibDataSource.getPwd());
    ds.setDriver(hibDataSource.getDriver());
    ds.setDialectId(hibDataSource.getDialect().getValueId());
    ds.setEngines(hibDataSource.getSbiEngineses());
    ds.setObjects(hibDataSource.getSbiObjectses());
    ds.setSchemaAttribute(hibDataSource.getSchemaAttribute());
    ds.setMultiSchema(hibDataSource.getMultiSchema());
    ds.setHibDialectClass(hibDataSource.getDialect().getValueCd());
   
    return ds;
  }
View Full Code Here

   * @param response The response Source Bean
   * @throws EMFUserError If an exception occurs
   */  
  private void getDataSource(SourceBean request, SourceBean response) throws EMFUserError {   
    try {                      
      DataSource ds = DAOFactory.getDataSourceDAO().loadDataSourceByID(new Integer((String)request.getAttribute("ID")));   
      this.modalita = SpagoBIConstants.DETAIL_MOD;
      if (request.getAttribute("SUBMESSAGEDET") != null &&
        ((String)request.getAttribute("SUBMESSAGEDET")).equalsIgnoreCase(MOD_SAVEBACK))
      {
        response.setAttribute("loopback", "true");
View Full Code Here

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

        auditlogger.info("[" + userProfile.getUserId() + "]:: SQL: " + sqlQuery);
       
        dataSet = new JDBCDataSet();
        //Session session = getDatamartModel().getDataSource().getSessionFactory().openSession();
        ConnectionDescriptor connection = (ConnectionDescriptor)getDataSource().getConfiguration().loadDataSourceProperties().get("connection");
        DataSource dataSource = new DataSource();
        dataSource.setJndi(connection.getJndiName());
        dataSource.setHibDialectName(connection.getDialect());
        dataSource.setUrlConnection(connection.getUrl());
        dataSource.setDriver(connection.getDriverClass());
        dataSource.setUser(connection.getUsername());
        dataSource.setPwd(connection.getPassword());
        dataSet.setDataSource(dataSource);
        dataSet.setQuery(sqlQuery);
        dataSet.loadData(start, limit, -1);
        dataStore = dataSet.getDataStore();
        IDataStoreMetaData dataStoreMetadata = dataStore.getMetaData();
View Full Code Here

  private void newDataSource(SourceBean response) throws EMFUserError {
   
    try {
     
      DataSource ds = null;
      this.modalita = SpagoBIConstants.DETAIL_INS;
      response.setAttribute("modality", modalita);
      ds = new DataSource();
      ds.setDsId(-1);
      ds.setDescr("");
      ds.setDialectId(new Integer("-1"));
      ds.setLabel("");
      ds.setJndi("");
      ds.setUrlConnection("");
      ds.setUser("");
      ds.setPwd("");
      ds.setDriver("");
      ds.setMultiSchema(false);
      ds.setSchemaAttribute("");
      response.setAttribute("dsObj", ds);
      IDomainDAO domaindao = DAOFactory.getDomainDAO();
      List dialects = domaindao.loadListDomainsByType("DIALECT_HIB");
      response.setAttribute(NAME_ATTR_LIST_DIALECTS, dialects);
    } catch (Exception ex) {
View Full Code Here

   
  }


  private DataSource recoverDataSourceDetails (SourceBean serviceRequest) throws EMFUserError, SourceBeanException, IOException  {
    DataSource ds  = new DataSource();
   
    String idStr = (String)serviceRequest.getAttribute("ID");
    Integer id = new Integer(idStr);
    Integer dialectId = Integer.valueOf((String)serviceRequest.getAttribute("DIALECT"))
    String description = (String)serviceRequest.getAttribute("DESCR")
    String label = (String)serviceRequest.getAttribute("LABEL");
    String jndi = (String)serviceRequest.getAttribute("JNDI");
    String url = (String)serviceRequest.getAttribute("URL_CONNECTION");
    String user = (String)serviceRequest.getAttribute("USER");
    String pwd = (String)serviceRequest.getAttribute("PWD");
    String driver = (String)serviceRequest.getAttribute("DRIVER");
    String schemaAttr = (String)serviceRequest.getAttribute("ATTRSCHEMA");
    String multiSchema = (String)serviceRequest.getAttribute("MULTISCHEMA");
    Boolean isMultiSchema = false;
    if(multiSchema!=null && multiSchema.equals("YES")){
      isMultiSchema = true;
    }
   
    ds.setDsId(id.intValue());
    ds.setDialectId(dialectId);
    ds.setLabel(label);
    ds.setDescr(description);
    ds.setJndi(jndi);
    ds.setUrlConnection(url);
    ds.setUser(user);
    ds.setPwd(pwd);
    ds.setDriver(driver);
    ds.setSchemaAttribute(schemaAttr);
    ds.setMultiSchema(isMultiSchema);
       
    return ds;
  }
View Full Code Here

TOP

Related Classes of it.eng.spagobi.tools.datasource.bo.DataSource

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.