public Result onLabel() {
    long millis = System.currentTimeMillis() % 1000;
    long result = millis - currentTimestamp;
    currentTimestamp = System.currentTimeMillis() % 1000;

    String label = request().getQueryString("action");
    String id = request().getQueryString("id");
    String reason =
        request()
            .getQueryString(
                "reason"); // remove the cluster header from Tweets and add it to labelled at the
                           // end.
    String databaseName = request().getQueryString("databaseName");
    String timestamp = Long.toString(result);

    DataAccess.labelTweet(databaseName, id, label, timestamp);

    TweetDTO tweetDTO = DataAccess.getNextTweet(databaseName);
    return ok(labelling.render(tweetDTO, databaseName));
  }
Beispiel #2
0
@Entity
public class Squad extends Model {

  @Unique("school")
  @Required
  public String name;

  @Required @ManyToOne public School school;

  public Long reservedTill = (System.currentTimeMillis() + 7200000);
  public User reservedFor = NoLoginRequired.userLogged;

  public Squad(String name, School school) {
    this.name = name;
    this.school = school;
  }

  public void deleteReservation() {
    this.reservedFor = null;
    this.reservedTill = null;
  }

  public void addAdmin(User admin) {
    this.admins.add(admin);
    this.users.add(admin);
  }

  public void addUser(User user) {
    this.users.add(user);
  }

  public Boolean dropAdmin(User admin) {
    this.users.remove(admin);
    return this.admins.remove(admin);
  }

  public Boolean dropUser(User user) {
    return this.admins.remove(user);
  }

  @ManyToMany
  @JoinTable(name = "SQUAD_USER")
  public List<User> users;

  @ManyToMany
  @JoinTable(name = "SQUAD_ADMIN")
  public List<User> admins;

  @ManyToMany
  @JoinTable(name = "SQUAD_APPLYER")
  public List<User> appliers;
}