Esempio n. 1
0
  public DbRecordRequest withUpdateField(String name, Object value) {
    if (value instanceof ConditionalValue) {
      if (!((ConditionalValue) value).set) return this;

      value = ((ConditionalValue) value).value;
    }

    divconq.schema.DbField fld = OperationContext.get().getSchema().getDbField(this.table, name);

    if (fld == null) return this;

    FieldRequest dfld = new FieldRequest().withName(name).withValue(value).withUpdateOnly();

    this.withFields(dfld);

    if (fld.isDynamic()) dfld.withRandomSubKey().withFrom(this.when);
    else if (fld.isList()) dfld.withRandomSubKey();

    return this;
  }
Esempio n. 2
0
  public DbRecordRequest withSetField(
      String name, String subkey, Object value, BigDateTime from, BigDateTime to) {
    if (value instanceof ConditionalValue) {
      if (!((ConditionalValue) value).set) return this;

      value = ((ConditionalValue) value).value;
    }

    divconq.schema.DbField fld = OperationContext.get().getSchema().getDbField(this.table, name);

    if ((fld == null) || !fld.isDynamic() || !fld.isList()) return this;

    FieldRequest dfld =
        new FieldRequest()
            .withName(name)
            .withValue(value)
            .withSubKey(subkey)
            .withFrom(from)
            .withTo(to);

    this.withFields(dfld);

    return this;
  }