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

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


      logger.error("Document identifier NOT found. Returning null.");
      throw new ConnectionParameterNotValidException("No default connection defined in "
          + "engine-config.xml file.");
    }
    DataSourceServiceProxy proxyDS = new DataSourceServiceProxy(userId, session);
    IDataSource ds = null;
    if (requestConnectionName!=null){
      ds =proxyDS.getDataSourceByLabel(requestConnectionName);
    }else{
      ds =proxyDS.getDataSource(documentId);
    }
View Full Code Here


    // Set parameters for the report
    Map reportParams = findReportParams(request, design);

    String requestConnectionName = (String) request.getParameter(CONNECTION_NAME);
    logger.debug("requestConnectionName:" + requestConnectionName);
    IDataSource ds = findDataSource(request.getSession(), userId, documentId,requestConnectionName);
    if (ds != null) {
      logger.debug("DataSource founded.");
   
      if (ds.checkIsJndi() ) {
       
        if (ds.checkIsMultiSchema()){
          String schema=null;
          try {
              String attrname=ds.getSchemaAttribute();
              if (attrname!=null) schema = (String)profile.getUserAttribute(attrname);           
          } catch (EMFInternalError e) {
            logger.error("Cannot retrive ENTE", e);
          }
          reportParams.put("connectionName", ds.getJndi()+schema);
        }else{
          reportParams.put("connectionName", ds.getJndi());
        }

       
      } else {
        reportParams.put("driver", ds.getDriver());
        reportParams.put("url", ds.getUrlConnection());
        reportParams.put("user", ds.getUser());
        reportParams.put("pwd", (ds.getPwd().equals("")) ? " " : ds.getPwd());

      }
    }

    reportParams.put("KpiDSXmlUrl", kpiUrl);
View Full Code Here

    output.append("      </span>\n");
    output.append("    </div>\n");
    output.append("    <div class='div_detail_form'>\n");
    output.append("      <select onchange='setLovProviderModified(true);' style='width:180px;' class='portlet-form-input-field' name='datasource' id='datasource' >\n");
    while (itDs.hasNext()) {
      IDataSource ds = (IDataSource)itDs.next();
      String dataSource = String.valueOf(ds.getLabel());
      String dataSourceDescription = ds.getDescr();
      dataSource = StringEscapeUtils.escapeHtml(dataSource);
      dataSourceDescription = StringEscapeUtils.escapeHtml(dataSourceDescription);
     
      String dsLabeleSelected = "";
      if (dataSourceLabel.equals(dataSource)) dsLabeleSelected = "selected=\"selected\"";
View Full Code Here

        Integer dataSourceId = dataset.getJdbcDataSourceId();
        if(query!=null && !query.equals("")){
          ((QueryDataSetDetail)dsDetail).setQuery(query);
        }
        if(dataSourceId!=null){
          IDataSource dataSource = DAOFactory.getDataSourceDAO().loadDataSourceByID(dataSourceId);
          if(dataSource!=null){
            ((QueryDataSetDetail)dsDetail).setDataSourceLabel(dataSource.getLabel());
          }
         
        }
      }else if(dataset.getType().equalsIgnoreCase(DataSetConstants.DS_QBE)){
        dsDetail = new QbeDataSetDetail();
        String sqlQuery = dataset.getJdbcQuery();
        String jsonQuery = dataset.getJsonQuery();
        Integer dataSourceId = dataset.getJdbcDataSourceId();
        String datamarts = dataset.getDatamarts();       
        ((QbeDataSetDetail) dsDetail).setSqlQuery(sqlQuery);
        ((QbeDataSetDetail) dsDetail).setJsonQuery(jsonQuery);
        ((QbeDataSetDetail) dsDetail).setDatamarts(datamarts);
        IDataSource dataSource = DAOFactory.getDataSourceDAO().loadDataSourceByID(dataSourceId);
        if(dataSource!=null){
          ((QbeDataSetDetail)dsDetail).setDataSourceLabel(dataSource.getLabel());
        }
      }else if(dataset.getType().equalsIgnoreCase(DataSetConstants.DS_SCRIPT)){
        dsDetail = new ScriptDataSetDetail();
        String script = dataset.getScriptText();
        String scriptLanguage = dataset.getScriptLanguage();
View Full Code Here

      super.checkUserPermissionForFunctionality(SpagoBIConstants.DATASOURCE_MANAGEMENT, "User cannot see datasource congifuration.");
      if (dataSourceId == null) {
        logger.warn("DataSource identifier in input is null!");
        return null;
      }
      IDataSource dataSource = DAOFactory.getDataSourceDAO().loadDataSourceByID(dataSourceId);
      if (dataSource == null) {
        logger.warn("DataSource with identifier [" + dataSourceId + "] not existing.");
        return null;
      }
      toReturn = new SDKObjectsConverter().fromSpagoBiDataSourceToSDKDataSource(dataSource.toSpagoBiDataSource());
    } catch(NotAllowedOperationException e) {
      throw e;
    } catch(Exception e) {
      logger.error("Error while retrieving SDKDataSources list", e);
      logger.debug("Returning null");
View Full Code Here

    try {
      super.checkUserPermissionForFunctionality(SpagoBIConstants.DATASOURCE_MANAGEMENT, "User cannot see datasources congifuration.");
      List dataSourceList = DAOFactory.getDataSourceDAO().loadAllDataSources();
      toReturn = new SDKDataSource[dataSourceList.size()];
      for (int i = 0; i < dataSourceList.size(); i++) {
        IDataSource dataSource = (IDataSource) dataSourceList.get(i);
        SDKDataSource sdkDataSource = new SDKObjectsConverter().fromSpagoBiDataSourceToSDKDataSource(dataSource.toSpagoBiDataSource());
        toReturn[i] = sdkDataSource;
      }
    } catch(NotAllowedOperationException e) {
      throw e;
    } catch(Exception e) {
View Full Code Here

      Integer engineIdInt = new Integer(engineIdStr);
      engine = DAOFactory.getEngineDAO().loadEngineByID(engineIdInt);
    }
   
    String dsIdStr = (String) request.getAttribute("datasource");
    IDataSource ds = null;
    if (dsIdStr != null && !dsIdStr.equals("")) {
      Integer dsIdInt = new Integer(dsIdStr);
      ds = DAOFactory.getDataSourceDAO().loadDataSourceByID(dsIdInt);
    }
   
    String datasetIdStr = (String) request.getAttribute("dataset");
    IDataSet dataset  = null;
    if (datasetIdStr != null && !datasetIdStr.equals("")) {
      Integer datasetIdInt = new Integer(datasetIdStr);
      dataset = DAOFactory.getDataSetDAO().loadActiveIDataSetByID(datasetIdInt);
    }
   
    // TRY TO LOAD ALL THE FUNCTIONALITIES ASSOCIATED (into request) TO THE BIOBEJCT
    List functionalities = new ArrayList();
    List functionalitiesStr = request.getAttributeAsList(ObjectsTreeConstants.FUNCT_ID);
    if (functionalitiesStr.size() == 0) {
      EMFValidationError error = new EMFValidationError(EMFErrorSeverity.ERROR, ObjectsTreeConstants.FUNCT_ID, "1008");
      this.respCont.getErrorHandler().addError(error);
    } else {
      for (Iterator it = functionalitiesStr.iterator(); it.hasNext(); ) {
        String functIdStr = (String) it.next();
        Integer functId = new Integer (functIdStr);
        functionalities.add(functId);
      }
    }
    // lOAD ALL THE FUNCTIONALITIES ASSOCIATED TO THE BIOBJECT (but not into request)
    // First case: the current user is not an administrator (so he cannot see all the functionalities)
    // and the modality is Modify. In this case some functionalities, that the user cannot see, can be
    // already associated to the object (by different users). This associations mustn't be erased.
    if (!profile.isAbleToExecuteAction(SpagoBIConstants.DOCUMENT_MANAGEMENT_ADMIN) && mod.equalsIgnoreCase(ObjectsTreeConstants.DETAIL_MOD)) {
      IBIObjectDAO objDAO = DAOFactory.getBIObjectDAO();
      BIObject prevObj = objDAO.loadBIObjectById(id);
      List prevFuncsId = prevObj.getFunctionalities();
      for (Iterator it = prevFuncsId.iterator(); it.hasNext(); ) {
        Integer funcId = (Integer) it.next();
        if (!ObjectsAccessVerifier.canDev(stateCode, funcId, profile)) {
          functionalities.add(funcId);
        }
      }
    }
    // Second case: the current user is a local administrator (he can admin only a part of the tree)
    // and the modality is Modify. In this case some funtionalities in oder part of the tree, which the
    // user cannot see, can be already associated to the object. This associations mustn't be erased.
    if (profile.isAbleToExecuteAction(SpagoBIConstants.DOCUMENT_MANAGEMENT_ADMIN)
        && initialPath != null && !initialPath.trim().equals(""
        && mod.equalsIgnoreCase(ObjectsTreeConstants.DETAIL_MOD)) {
      IBIObjectDAO objDAO = DAOFactory.getBIObjectDAO();
      BIObject prevObj = objDAO.loadBIObjectById(id);
      List functionalitiesId = prevObj.getFunctionalities();
      Iterator it = functionalitiesId.iterator();
      while (it.hasNext()) {
        Integer folderId = (Integer) it.next();
        LowFunctionality folder = DAOFactory.getLowFunctionalityDAO().loadLowFunctionalityByID(folderId, false);
        String folderPath = folder.getPath();
        if (!folderPath.equalsIgnoreCase(initialPath) && !folderPath.startsWith(initialPath + "/")) {
          functionalities.add(folderId);
        }
      }
    }
    // CHECK IF THE LABEL IS ALREADY ASSIGNED TO AN EXISTING OBJECT
    BIObject aBIObject = DAOFactory.getBIObjectDAO().loadBIObjectByLabel(label);
    if (aBIObject != null && !aBIObject.getId().equals(id)) {
      EMFValidationError error = new EMFValidationError(EMFErrorSeverity.ERROR, "label", "1056");
      this.respCont.getErrorHandler().addError(error);
    }

    // SET DATA INTO OBJECT
    obj.setFunctionalities(functionalities);
    obj.setBiObjectTypeCode(typeCode);
    obj.setBiObjectTypeID(typeIdInt);
    obj.setDescription(description);
    obj.setEncrypt(encrypt);
    obj.setVisible(visible);
    obj.setProfiledVisibility(profiledVisibilityStr);
    obj.setEngine(engine);
    obj.setDataSourceId(ds == null ? null : new Integer(ds.getDsId()));
    obj.setDataSetId(dataset == null ? null : new Integer(dataset.getId()));
    obj.setId(id);
    obj.setName(name);
    obj.setLabel(label);
    obj.setRelName(relname);
View Full Code Here

TOP

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

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.