Ejemplo n.º 1
0
  public void setInstances(List<Integer> instanceIds, String collectionPid, String coder) {
    StringBuilder query = new StringBuilder();

    query.append(
        "INSERT INTO Annotation (pid, size, last_visited_index, coder, collection_pid, status) VALUES (");
    query.append("'").append(getPid()).append("',");
    query.append("'").append(instanceIds.size()).append("',");
    query.append("'").append(0).append("',");
    query.append("'").append(coder).append("',");
    query.append("'").append(collectionPid).append("',");
    query.append("'").append(Status.CREATED.toString()).append("')");

    DbManager.executeUpdate(query.toString());

    int index = 0;
    for (int instanceId : instanceIds) {
      query = new StringBuilder();

      query.append("INSERT INTO AnnotationInstance (pid,instance_id,`index`,time_spent) VALUES (");
      query.append("'").append(getPid()).append("',");
      query.append("'").append(instanceId).append("',");
      query.append("'").append(index).append("',");
      query.append("'").append(0).append("')");

      DbManager.executeUpdate(query.toString());

      index++;
    }
  }
Ejemplo n.º 2
0
  public void updateStatus(Status status) {
    StringBuilder query = new StringBuilder();
    query.append("UPDATE Annotation SET status='").append(status.toString()).append("' ");
    query.append("WHERE pid='").append(getPid()).append("' ");

    DbManager.executeUpdate(query.toString());
  }
Ejemplo n.º 3
0
  public void updateTimeSpent(int index, int seconds) {
    StringBuilder query = new StringBuilder();
    query.append("UPDATE AnnotationInstance SET time_spent='").append(seconds).append("' ");
    query.append("WHERE pid='").append(getPid()).append("' ");
    query.append("AND `index`='").append(index).append("'");

    DbManager.executeUpdate(query.toString());
  }
Ejemplo n.º 4
0
  public void updateDbLastVisitedIndex(int lastVisitedIndex) {
    StringBuilder query = new StringBuilder();
    query
        .append("UPDATE Annotation SET last_visited_index='")
        .append(lastVisitedIndex)
        .append("' ");
    query.append("WHERE pid='").append(getPid()).append("'");

    DbManager.executeUpdate(query.toString());
  }
Ejemplo n.º 5
0
  public void updateDbInstance(int index, String[] codes) {
    StringBuilder query = new StringBuilder();
    query
        .append("UPDATE AnnotationInstance SET codes='")
        .append(toDbCodesValue(codes))
        .append("' ");
    query.append("WHERE pid='").append(getPid()).append("' ");
    query.append("AND `index`='").append(index).append("' ");

    DbManager.executeUpdate(query.toString());
  }