Exemple #1
0
  public DbRecordRequest withSetField(String name, String subkey, Object value, BigDateTime from) {
    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()) return this;

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

    this.withFields(dfld);

    return this;
  }
Exemple #2
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;
  }