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);
  }
예제 #2
0
  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);
  }
예제 #3
0
  public void go(SystemEnvironment sysEnv) throws SDMSException {
    Long sgId = null;
    Long ZERO = new Long(0);

    if (!sysEnv.cEnv.gid().contains(SDMSObject.adminGId)) {
      SDMSPrivilege p = new SDMSPrivilege();
      Vector v = SDMSMemberTable.idx_uId.getVector(sysEnv, sysEnv.cEnv.uid());
      for (int i = 0; i < v.size(); i++) {
        SDMSMember m = (SDMSMember) v.get(i);
        try {
          SDMSGrant gr =
              SDMSGrantTable.idx_objectId_gId_getUnique(
                  sysEnv, new SDMSKey(ZERO, m.getGId(sysEnv)));
          p.addPriv(sysEnv, gr.getPrivs(sysEnv).longValue());
        } catch (NotFoundException nfe) {

        }
      }
      try {
        if (sysEnv.selectGroup != null) {
          SDMSGroup sg = SDMSGroupTable.idx_name_getUnique(sysEnv, sysEnv.selectGroup);
          sgId = sg.getId(sysEnv);
        }
      } catch (NotFoundException nfe) {

      }
      if (!(p.can(SDMSPrivilege.MANAGE_SEL) || (sgId != null && sysEnv.cEnv.gid().contains(sgId))))
        throw new AccessViolationException(
            new SDMSMessage(sysEnv, "03003081235", "Insufficient Privileges"));
    }

    int read = 0;
    SDMSOutputContainer d_container = null;

    if (cl_size > 0) {
      clist = new int[cl_size];
      ctype = new int[cl_size];
    }

    try {
      Statement stmt = sysEnv.dbConnection.createStatement();
      ResultSet rset = stmt.executeQuery(selectCmd);
      ResultSetMetaData mdset = rset.getMetaData();
      Vector desc = collist(mdset);
      d_container = new SDMSOutputContainer(sysEnv, "Selected Values", desc);
      while (rset.next()) {
        Vector data = new Vector();
        int j = 0;
        for (int i = 1; i <= desc.size(); i++) {
          Object o = rset.getObject(i);
          if (cl_size > 0 && j < cl_size && i == clist[j]) {
            o = convert(sysEnv, o, j);
            j++;
          }
          data.addElement((rset.wasNull() ? null : o));
        }
        d_container.addData(sysEnv, data);
        read++;
      }
      stmt.close();
      sysEnv.dbConnection.commit();
    } catch (SQLException sqle) {

      try {

        sysEnv.dbConnection.rollback();
      } catch (SQLException sqle2) {

        throw new RecoverableException(new SDMSMessage(sysEnv, "03310281524", "Connection lost"));
      }

      throw new CommonErrorException(
          new SDMSMessage(sysEnv, "03204170024", "SQL Error : $1", sqle.toString()));
    }

    if (sv != null && sv.size() > 0) {
      int sca[] = new int[sv.size()];
      for (int i = 0; i < sv.size(); i++) {
        sca[i] = ((Integer) sv.get(i)).intValue();
        if (sca[i] >= d_container.columns)
          throw new CommonErrorException(
              new SDMSMessage(
                  sysEnv,
                  "03003081227",
                  "The sort column specified ($1) exceeds the number of columns in the output",
                  new Integer(sca[i])));
      }
      Collections.sort(d_container.dataset, d_container.getComparator(sysEnv, sca));
    }

    result.setOutputContainer(d_container);
    result.setFeedback(
        new SDMSMessage(sysEnv, "03204112153", "$1 Row(s) selected", new Integer(read)));
  }