Beispiel #1
0
  @Override
  public boolean postEvent(Project project, EventType type, String user, String message) {
    QueryRunner runner = createQueryRunner();

    final String INSERT_PROJECT_EVENTS =
        "INSERT INTO project_events (project_id, event_type, event_time, username, message) values (?,?,?,?,?)";
    long updateTime = System.currentTimeMillis();
    try {
      runner.update(
          INSERT_PROJECT_EVENTS, project.getId(), type.getNumVal(), updateTime, user, message);
    } catch (SQLException e) {
      e.printStackTrace();
      return false;
    }

    return true;
  }
Beispiel #2
0
    @Override
    public List<ProjectLogEvent> handle(ResultSet rs) throws SQLException {
      if (!rs.next()) {
        return Collections.<ProjectLogEvent>emptyList();
      }

      ArrayList<ProjectLogEvent> events = new ArrayList<ProjectLogEvent>();
      do {
        int projectId = rs.getInt(1);
        int eventType = rs.getInt(2);
        long eventTime = rs.getLong(3);
        String username = rs.getString(4);
        String message = rs.getString(5);

        ProjectLogEvent event =
            new ProjectLogEvent(
                projectId, EventType.fromInteger(eventType), eventTime, username, message);
        events.add(event);
      } while (rs.next());

      return events;
    }