Package it.eng.spago.dbaccess.sql

Examples of it.eng.spago.dbaccess.sql.SQLCommand


   * @param domainCode  The Domain code String
   * @param valueCode  The domain Value Dtring
   * @return  The Domain ID
   */
    private Integer findSBIDomainValueID(String domainCode, String valueCode ){
      SQLCommand cmd = null;
    DataResult dr = null;
    DataConnection dataConnection = null;
    Integer returnValue = null;
    try {
      IDomainDAO domdao = DAOFactory.getDomainDAO();
View Full Code Here


     public static Object executeSelect(RequestContainer requestContainer,
        ResponseContainer responseContainer, String datasource, String statement) throws EMFInternalError {
      Object result = null;
      DataConnectionManager dataConnectionManager = null;
      DataConnection dataConnection = null;
      SQLCommand sqlCommand = null;
      DataResult dataResult = null;
      try {
        //dataConnectionManager = DataConnectionManager.getInstance();
        //dataConnection = dataConnectionManager.getConnection(pool);
        DataSourceUtilities dsUtil = new DataSourceUtilities();
        Connection conn = dsUtil.getConnection(requestContainer,datasource);
        dataConnection = dsUtil.getDataConnection(conn);

        sqlCommand = dataConnection.createSelectCommand(statement);
        dataResult = sqlCommand.execute();
        ScrollableDataResult scrollableDataResult = (ScrollableDataResult) dataResult
            .getDataObject();
        result = scrollableDataResult.getSourceBean();
      } finally {
        Utils.releaseResources(dataConnection, sqlCommand, dataResult);
View Full Code Here

   *
   */
  public boolean executeUpdateQuery(Map<String , Object> params, JSONObject metaParams) throws Throwable, Exception{
    boolean toReturn = true;
    DataConnection dataConnection = null;
    SQLCommand sqlCommand = null;
    DataResult dataResult = null;
   
    logger.debug("IN");
   
    try {

      Connection jdbcConnection = datasource.getConnection();
      jdbcConnection.setAutoCommit(false);
      dataConnection = getDataConnection(jdbcConnection);

      String statement = SQLStatements.getStatement((String)params.get( STMT ));
      logger.debug("Parameter [" + STMT + "] is equals to [" + statement + "]");     
      Assert.assertTrue(!StringUtilities.isEmpty( statement ), "Parameter [" + STMT + "] cannot be null or empty");
     
      String numParsStr = (String) params.get( NUM_PARS );
      int numPars = (numParsStr != null)?Integer.parseInt(numParsStr):0;
      logger.debug("Parameter [ numPars ] is equals to [" + numPars + "]");
     
      sqlCommand = dataConnection.createUpdateCommand(statement);
      dataConnection.initTransaction();
     
      if (numPars > 0){
        List inputParameter = new ArrayList(numPars);

        if (metaParams == null){ 
          Assert.assertTrue(metaParams == null, "Parameter [" + metaParams + "] cannot be null or empty.");         
        }else{
          JSONArray queryPars = (JSONArray)metaParams.get("queryParams");
          //for (int j=0; j<queryPars.length(); j++){
          for (int j=0; j<numPars; j++){
            JSONObject obj = (JSONObject)queryPars.get(j);
            String paramType = (String)obj.get("type");
            String paramName = (String)obj.get("name");
            String paramValue = (String)params.get(paramName);
            //if value isn't valorized, checks the defualt (if it's defined into meta section)
            if (paramValue == null){
              try{
                paramValue =  (String)obj.get("default");
              }catch(JSONException je ){
                logger.error("param " + paramName + "in JSON template not found. Parameter value is null!");
                paramValue = null;
              }
            }
            inputParameter.add(dataConnection.createDataField(paramName,getParamType(paramType), paramValue));             
         
        }
       
        dataResult = sqlCommand.execute(inputParameter);
      }else{
        dataResult = sqlCommand.execute();
      }
      dataConnection.commitTransaction();
    } // try
    catch (Exception ex) {
      toReturn = false;
View Full Code Here

   */

  private String getLovResult(IEngUserProfile profile,String statement) throws Exception {
    String resStr = null;
    DataConnection dataConnection = null;
    SQLCommand sqlCommand = null;
    DataResult dataResult = null;
    try {
      //gets connection
      DataSourceUtilities dsUtil = new DataSourceUtilities();
      Connection conn = dsUtil.getConnection(profile,dataSource);
      dataConnection = dsUtil.getDataConnection(conn);
      sqlCommand = dataConnection.createSelectCommand(statement, false);
      dataResult = sqlCommand.execute();
      ScrollableDataResult scrollableDataResult = (ScrollableDataResult) dataResult.getDataObject();
      SourceBean result = scrollableDataResult.getSourceBean();
      resStr = result.toXML(false);
      resStr = resStr.trim();
      if(resStr.startsWith("<?")) {
View Full Code Here

  public List validateValues(IEngUserProfile profile, BIObjectParameter biparam) throws Exception {
    List toReturn = new ArrayList();
    List<String> values = biparam.getParameterValues();
    List parameterValuesDescription = new ArrayList();
    DataConnection dataConnection = null;
    SQLCommand sqlCommand = null;
    DataResult dataResult = null;
    String statement = null;
    SourceBean result = null;
    try {
      statement = getValidationQuery(profile, biparam, values);
      //gets connection
      DataSourceUtilities dsUtil = new DataSourceUtilities();
      Connection conn = dsUtil.getConnection(profile,dataSource);
      dataConnection = dsUtil.getDataConnection(conn);
      sqlCommand = dataConnection.createSelectCommand(statement, false);
      dataResult = sqlCommand.execute();
      ScrollableDataResult scrollableDataResult = (ScrollableDataResult) dataResult.getDataObject();
      result = scrollableDataResult.getSourceBean();
    } finally {
      Utils.releaseResources(dataConnection, sqlCommand, dataResult);
    }
View Full Code Here

       ResponseContainer responseContainer, String datasource, String statement, List columnsNames) throws EMFInternalError {
      //ResponseContainer responseContainer, String pool, String statement, List columnsNames) throws EMFInternalError {
    Object result = null;
    //DataConnectionManager dataConnectionManager = null;
    DataConnection dataConnection = null;
    SQLCommand sqlCommand = null;
    DataResult dataResult = null;
    try {
      /*dataConnectionManager = DataConnectionManager.getInstance();
      dataConnection = dataConnectionManager.getConnection(pool);
      */
      //gets connection
      DataSourceUtilities dsUtil = new DataSourceUtilities();
      Connection conn = dsUtil.getConnection(requestContainer,datasource);
      dataConnection = dsUtil.getDataConnection(conn);

      sqlCommand = dataConnection.createSelectCommand(statement, false);
      dataResult = sqlCommand.execute();
      ScrollableDataResult scrollableDataResult = (ScrollableDataResult) dataResult
          .getDataObject();
      List temp = Arrays.asList(scrollableDataResult.getColumnNames());
      columnsNames.addAll(temp);
      result = scrollableDataResult.getSourceBean();
View Full Code Here

    // get CHECKED_QUERY statment
    String statement = getQueryStatement("CHECKED_QUERY", parameters);

    // exec CHECKED_QUERY
    ScrollableDataResult scrollableDataResult = null;
    SQLCommand sqlCommand = null;
    DataConnection dataConnection = null;
    DataResult dataResult = null;
    String pool = null;
    try {
      pool = (String) config.getAttribute("POOL");
      dataConnection = DataConnectionManager.getInstance().getConnection(
          pool);
      sqlCommand = dataConnection.createSelectCommand(statement);
      dataResult = sqlCommand.execute();
      scrollableDataResult = (ScrollableDataResult) dataResult
          .getDataObject();
      SourceBean chekedObjectsBean = scrollableDataResult.getSourceBean();
      List checkedObjectsList = chekedObjectsBean
          .getAttributeAsList("ROW");
View Full Code Here

   public static Object executeSelect(RequestContainer requestContainer,
      ResponseContainer responseContainer, String pool, String statement) throws EMFInternalError {
    Object result = null;
    DataConnectionManager dataConnectionManager = null;
    DataConnection dataConnection = null;
    SQLCommand sqlCommand = null;
    DataResult dataResult = null;
    try {
      dataConnectionManager = DataConnectionManager.getInstance();
      dataConnection = dataConnectionManager.getConnection(pool);
      sqlCommand = dataConnection.createSelectCommand(statement);
      dataResult = sqlCommand.execute();
      ScrollableDataResult scrollableDataResult = (ScrollableDataResult) dataResult
          .getDataObject();
      result = scrollableDataResult.getSourceBean();
    } catch (Exception ex) {
      TracerSingleton.log(Constants.NOME_MODULO,
View Full Code Here

    Session aSession = null;
    Transaction tx = null;
   
    // exec CHECKED_QUERY
    ScrollableDataResult scrollableDataResult = null;
    SQLCommand sqlCommand = null;
    DataConnection dataConnection = null;
    DataResult dataResult = null;
    try {
      aSession = HibernateUtil.currentSession();
      tx = aSession.beginTransaction();
      Connection jdbcConnection = aSession.connection();
      dataConnection = DelegatedHibernateConnectionListService.getDataConnection(jdbcConnection);
          sqlCommand = dataConnection.createSelectCommand(statement);
          dataResult = sqlCommand.execute();
          scrollableDataResult = (ScrollableDataResult) dataResult.getDataObject();
      SourceBean chekedObjectsBean = scrollableDataResult.getSourceBean();
      List checkedObjectsList = chekedObjectsBean
          .getAttributeAsList("ROW");
      for (int i = 0; i < checkedObjectsList.size(); i++) {
View Full Code Here

     * @return the SQL command
     */
    public static SQLCommand createStatementSql(final DataConnection dataConnection,
            final String statement, final String type) {
     
        SQLCommand sqlCommand = null;
        if (type.equalsIgnoreCase("INSERT"))
            sqlCommand = dataConnection.createInsertCommand(statement);
        else if (type.equalsIgnoreCase("UPDATE"))
            sqlCommand = dataConnection.createUpdateCommand(statement);
        else if (type.equalsIgnoreCase("DELETE"))
View Full Code Here

TOP

Related Classes of it.eng.spago.dbaccess.sql.SQLCommand

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.