Example #1
0
  /**
   * Construct a row for updating. This is used by the remote client (ODK Tables) to construct a
   * REST request to modify the row.
   *
   * @param rowId
   * @param rowETag
   * @param values
   */
  public static Row forUpdate(
      String rowId,
      String rowETag,
      String formId,
      String locale,
      String savepointType,
      String savepointTimestamp,
      String savepointCreator,
      RowFilterScope filterScope,
      ArrayList<DataKeyValue> values) {
    Row row = new Row();
    row.rowId = rowId;
    row.rowETag = rowETag;
    row.formId = formId;
    row.locale = locale;
    row.savepointType = savepointType;
    row.savepointTimestamp = savepointTimestamp;
    row.savepointCreator = savepointCreator;
    row.rowFilterScope = filterScope;
    if (values == null) {
      row.orderedColumns = new ArrayList<DataKeyValue>();
    } else {
      Collections.sort(
          values,
          new Comparator<DataKeyValue>() {

            @Override
            public int compare(DataKeyValue arg0, DataKeyValue arg1) {
              return arg0.column.compareTo(arg1.column);
            }
          });

      row.orderedColumns = values;
    }
    return row;
  }