Exemplo n.º 1
0
  int getCount() {
    int count = 0;

    ResultSet rs = null;

    PreparedStatementWrapper pstatForMo = null;
    PreparedStatement pstatementForMo = null;
    try {
      pstatForMo = agentName.rlAPI.fetchPreparedStatement(psSelectCount);
      pstatementForMo = pstatForMo.getPreparedStatement();
      rs = agentName.rlAPI.executeQuery(pstatementForMo);
      rs.next();
      count = rs.getInt(1);
      return count;

    } catch (Exception e) {
      return -1;
    } finally {
      try {
        rs.close();
      } catch (Exception e) {
      }
      agentName.rlAPI.returnPreparedStatement(pstatForMo);
    }
  }
Exemplo n.º 2
0
  CompositeData getNextMo(String[] name) {
    ResultSet rs = null;
    PreparedStatementWrapper pstatForMo = null;
    PreparedStatement pstatementForMo = null;
    try {
      pstatForMo = agentName.rlAPI.fetchPreparedStatement(psSelectMoID2);
      pstatementForMo = pstatForMo.getPreparedStatement();
      pstatementForMo.setString(1, name[0]);
      rs = agentName.rlAPI.executeQuery(pstatementForMo);
      rs.next();
      name[0] = rs.getString(1);
      return getNetwork(name);

    } catch (Exception e) {
      return null;
    } finally {
      try {
        if (rs != null) {
          rs.close();
        }
      } catch (Exception e) {

      }
      agentName.rlAPI.returnPreparedStatement(pstatForMo);
    }
  }
Exemplo n.º 3
0
  private String[] getNextAlert(String[] previousKeys) {
    String[] keysForNextAlert = new String[2];

    keysForNextAlert[0] = previousKeys[0];

    keysForNextAlert[1] = previousKeys[1];

    ResultSet rs = null;

    PreparedStatementWrapper pstat = null;

    PreparedStatement pstatement = null;

    try {
      // Next ENTITY
      try {
        // SELECT MIN(ENTITY) WHERE OWNERNAME="" AND SOURCE="" AND ENTITY>""//No I18N

        pstat = agentName.rlAPI.fetchPreparedStatement(psForSelectNEXTEntity);

        pstatement = pstat.getPreparedStatement();

        pstatement.setString(1, previousKeys[0]);

        pstatement.setString(2, previousKeys[1]);

        //	pstatement.setString(3, previousKeys[2]);

        rs = agentName.rlAPI.executeQuery(pstatement);

        rs.next();

        keysForNextAlert[1] = (String) rs.getObject(1);
      } finally {
        try {
          rs.close();
        } catch (Exception e) {
        }

        agentName.rlAPI.returnPreparedStatement(pstat);
      }

      if (keysForNextAlert[1] == null) {
        // Next SOURCE
        try {
          // SELECT MIN(SOURCE) WHERE OWNERNAME="" AND SOURCE>"";//No I18N

          pstat = agentName.rlAPI.fetchPreparedStatement(psForSelectNEXTSource);

          pstatement = pstat.getPreparedStatement();

          pstatement.setString(1, previousKeys[0]);

          // pstatement.setString(2, previousKeys[0]);

          rs = agentName.rlAPI.executeQuery(pstatement);

          rs.next();

          keysForNextAlert[0] = (String) rs.getObject(1);

        } finally {
          try {
            rs.close();
          } catch (Exception e) {
          }

          agentName.rlAPI.returnPreparedStatement(pstat);
        }

        if (keysForNextAlert[0] == null) {
          // Next OWNERNAME
          /* try
             {

          //SELECT MIN(OWNERNAME) WHERE OWNERNAME>"";//No I18N

          pstat = agentName.rlAPI.fetchPreparedStatement(psForSelectNEXTOwnerName);

          pstatement = pstat.getPreparedStatement();

          pstatement.setString(1, previousKeys[1]);

          rs = agentName.rlAPI.executeQuery(pstatement);

          rs.next();

          keysForNextAlert[1] = (String)rs.getObject(1);

          if(keysForNextAlert[1] == null)
              return null;
             }
             finally
             {
          try{
              rs.close();
          }catch(Exception e){}

          agentName.rlAPI.returnPreparedStatement(pstat);
             }*/

          try {
            // SELECT MIN(SOURCE) WHERE OWNERNAME="";//No I18N

            pstat = agentName.rlAPI.fetchPreparedStatement(psForSelectMINSource);

            pstatement = pstat.getPreparedStatement();

            pstatement.setString(1, keysForNextAlert[1]);

            rs = agentName.rlAPI.executeQuery(pstatement);

            rs.next();

            keysForNextAlert[0] = (String) rs.getObject(1);

          } finally {
            try {
              rs.close();
            } catch (Exception e) {
            }

            agentName.rlAPI.returnPreparedStatement(pstat);
          }
        }

        try {
          // SELECT MIN(ENETITY) WHERE OWNERNAME="" AND SOURCE="";//No I18N

          pstat = agentName.rlAPI.fetchPreparedStatement(psForSelectMINEntity);

          pstatement = pstat.getPreparedStatement();

          pstatement.setString(1, keysForNextAlert[0]);

          rs = agentName.rlAPI.executeQuery(pstatement);

          rs.next();

          keysForNextAlert[1] = (String) rs.getObject(1);
        } finally {
          try {
            rs.close();
          } catch (Exception e) {
          }

          agentName.rlAPI.returnPreparedStatement(pstat);
        }
      }
    } catch (Exception e) {
      return null;
    }

    return keysForNextAlert;
  }
Exemplo n.º 4
0
  private String[] getFirstAlert() {
    String[] keysForFirstAlert = new String[2];

    ResultSet rs = null;

    PreparedStatementWrapper pstat = null;

    PreparedStatement pstatement = null;

    try {
      try {
        /*try
        		{
        		    //SELECT MIN(ONWERNAME)

        		    pstat = agentName.rlAPI.fetchPreparedStatement(psForSelectMINOwnerName);

        		    pstatement = pstat.getPreparedStatement();

        		    rs = agentName.rlAPI.executeQuery(pstatement);

        		    rs.next();

        		    keysForFirstAlert[1] = (String)rs.getObject(1);
        		}
        		finally
        		{
        		    try{
        			rs.close();
        		    }catch(Exception e){}
        http://ismp-build/php/download/1466f836f17657/AlarmTable.java
        		    agentName.rlAPI.returnPreparedStatement(pstat);
        		}*/

        // SELECT MIN(SOURCE) WHERE OWNERNAME=""//No I18N

        pstat = agentName.rlAPI.fetchPreparedStatement(psForSelectMINSource);

        pstatement = pstat.getPreparedStatement();

        // pstatement.setString(1, keysForFirstAlert[1]);

        rs = agentName.rlAPI.executeQuery(pstatement);

        rs.next();

        keysForFirstAlert[0] = (String) rs.getObject(1);
      } finally {
        try {
          rs.close();
        } catch (Exception e) {
        }

        agentName.rlAPI.returnPreparedStatement(pstat);
      }

      // SELECT MIN(ENTITY) WHERE OWNERNAME="" AND SOURCE=""//No I18N

      pstat = agentName.rlAPI.fetchPreparedStatement(psForSelectMINEntity);

      pstatement = pstat.getPreparedStatement();

      pstatement.setString(1, keysForFirstAlert[0]);

      // pstatement.setString(2, keysForFirstAlert[0]);

      rs = agentName.rlAPI.executeQuery(pstatement);

      rs.next();

      keysForFirstAlert[1] = (String) rs.getObject(1);
    } catch (Exception e) {
      return null;
    } finally {
      try {
        rs.close();
      } catch (Exception e) {
      }

      agentName.rlAPI.returnPreparedStatement(pstat);
    }

    return keysForFirstAlert;
  }