protected SDMSObject rowToObject(SystemEnvironment env, ResultSet r) throws SDMSException {
    Long id;
    Long smeId;
    Long trId;
    Long nextTriggerTime;
    Integer timesChecked;
    Integer timesTriggered;
    Long creatorUId;
    Long createTs;
    Long changerUId;
    Long changeTs;
    long validFrom;
    long validTo;

    try {
      id = new Long(r.getLong(1));
      smeId = new Long(r.getLong(2));
      trId = new Long(r.getLong(3));
      nextTriggerTime = new Long(r.getLong(4));
      timesChecked = new Integer(r.getInt(5));
      timesTriggered = new Integer(r.getInt(6));
      creatorUId = new Long(r.getLong(7));
      createTs = new Long(r.getLong(8));
      changerUId = new Long(r.getLong(9));
      changeTs = new Long(r.getLong(10));
      validFrom = 0;
      validTo = Long.MAX_VALUE;
    } catch (SQLException sqle) {
      SDMSThread.doTrace(null, "SQL Error : " + sqle.getMessage(), SDMSThread.SEVERITY_ERROR);

      throw new FatalException(
          new SDMSMessage(
              env,
              "01110182045",
              "TriggerQueue: $1 $2",
              new Integer(sqle.getErrorCode()),
              sqle.getMessage()));
    }
    if (validTo < env.lowestActiveVersion) return null;
    return new SDMSTriggerQueueGeneric(
        id,
        smeId,
        trId,
        nextTriggerTime,
        timesChecked,
        timesTriggered,
        creatorUId,
        createTs,
        changerUId,
        changeTs,
        validFrom,
        validTo);
  }
  protected void loadTable(SystemEnvironment env) throws SQLException, SDMSException {
    int read = 0;
    int loaded = 0;

    final boolean postgres = SystemEnvironment.isPostgreSQL;
    String squote = SystemEnvironment.SQUOTE;
    String equote = SystemEnvironment.EQUOTE;
    Statement stmt = env.dbConnection.createStatement();

    ResultSet rset =
        stmt.executeQuery(
            "SELECT "
                + tableName()
                + ".ID"
                + ", "
                + squote
                + "NAME"
                + equote
                + ", "
                + squote
                + "DELETE_VERSION"
                + equote
                + ", "
                + squote
                + "CREATOR_U_ID"
                + equote
                + ", "
                + squote
                + "CREATE_TS"
                + equote
                + ", "
                + squote
                + "CHANGER_U_ID"
                + equote
                + ", "
                + squote
                + "CHANGE_TS"
                + equote
                + " FROM "
                + tableName()
                + "");
    while (rset.next()) {
      if (loadObject(env, rset)) ++loaded;
      ++read;
    }
    stmt.close();
    SDMSThread.doTrace(
        null,
        "Read " + read + ", Loaded " + loaded + " rows for " + tableName(),
        SDMSThread.SEVERITY_INFO);
  }
  protected SDMSObject rowToObject(SystemEnvironment env, ResultSet r) throws SDMSException {
    Long id;
    String name;
    Long deleteVersion;
    Long creatorUId;
    Long createTs;
    Long changerUId;
    Long changeTs;
    long validFrom;
    long validTo;

    try {
      id = new Long(r.getLong(1));
      name = r.getString(2);
      deleteVersion = new Long(r.getLong(3));
      creatorUId = new Long(r.getLong(4));
      createTs = new Long(r.getLong(5));
      changerUId = new Long(r.getLong(6));
      changeTs = new Long(r.getLong(7));
      validFrom = 0;
      validTo = Long.MAX_VALUE;
    } catch (SQLException sqle) {
      SDMSThread.doTrace(null, "SQL Error : " + sqle.getMessage(), SDMSThread.SEVERITY_ERROR);

      throw new FatalException(
          new SDMSMessage(
              env,
              "01110182045",
              "Group: $1 $2",
              new Integer(sqle.getErrorCode()),
              sqle.getMessage()));
    }
    if (validTo < env.lowestActiveVersion) return null;
    return new SDMSGroupGeneric(
        id, name, deleteVersion, creatorUId, createTs, changerUId, changeTs, validFrom, validTo);
  }
Esempio n. 4
0
 public void go(SystemEnvironment sysEnv) throws SDMSException {
   SDMSMessage m = new SDMSMessage(sysEnv, "01111281413", exp_message, env.actstmt, message);
   SDMSThread.doTrace(env, m.toString(), SDMSThread.SEVERITY_WARNING);
   throw new CommonErrorException(m);
 }