示例#1
0
    public void toJson(JsonGenerator gen) throws IOException {
      gen.writeStartObject();

      gen.writeBooleanField("old", oldRecordExists);
      gen.writeBooleanField("new", newRecordExists);
      gen.writeBooleanField("includeSubscriptions", includeSubscriptions);

      if (newRecordType != null) {
        gen.writeBinaryField("newRecordType", newRecordType.getBytes());
      }

      if (oldRecordType != null) {
        gen.writeBinaryField("oldRecordType", oldRecordType.getBytes());
      }

      if (fieldChanges != null) {
        gen.writeArrayFieldStart("fields");

        for (FieldChange fieldChange : fieldChanges) {
          fieldChange.toJson(gen);
        }

        gen.writeEndArray();
      }

      if (indexSubscriptionIds != null) {
        gen.writeArrayFieldStart("subscriptions");
        for (String subscriptionId : indexSubscriptionIds) {
          gen.writeString(subscriptionId);
        }
        gen.writeEndArray();
      }

      gen.writeEndObject();
    }
示例#2
0
  public void toJson(JsonGenerator gen) throws IOException {

    gen.writeStartObject();

    if (type != null) {
      gen.writeStringField("type", type.getName());
    }

    if (tableName != null) {
      gen.writeStringField("tableName", tableName);
    }

    if (versionUpdated != -1) {
      gen.writeNumberField("versionUpdated", versionUpdated);
    }

    if (versionCreated != -1) {
      gen.writeNumberField("versionCreated", versionCreated);
    }

    if (recordTypeChanged) {
      gen.writeBooleanField("recordTypeChanged", true);
    }

    if (updatedFields != null && updatedFields.size() > 0) {
      gen.writeArrayFieldStart("updatedFields");
      for (SchemaId updatedField : updatedFields) {
        gen.writeBinary(updatedField.getBytes());
      }
      gen.writeEndArray();
    }

    if (vtagsToIndex != null && vtagsToIndex.size() > 0) {
      gen.writeArrayFieldStart("vtagsToIndex");
      for (SchemaId vtag : vtagsToIndex) {
        gen.writeBinary(vtag.getBytes());
      }
      gen.writeEndArray();
    }

    if (attributes != null && attributes.size() > 0) {
      gen.writeObjectFieldStart("attributes");
      for (String key : attributes.keySet()) {
        gen.writeStringField(key, attributes.get(key));
      }
      gen.writeEndObject();
    }

    if (indexRecordFilterData != null) {
      gen.writeFieldName("indexFilterData");
      indexRecordFilterData.toJson(gen);
    }

    gen.writeEndObject();
    gen.flush();
  }
 public SolrInputDocument build() throws InterruptedException, RepositoryException {
   solrDoc.setField("lily.id", recordId.toString());
   solrDoc.setField("lily.table", table);
   solrDoc.setField("lily.key", key);
   solrDoc.setField("lily.vtagId", vtag.toString());
   solrDoc.setField("lily.vtag", typeManager.getFieldTypeById(vtag).getName().getName());
   solrDoc.setField("lily.version", version);
   return solrDoc;
 }
示例#4
0
    public void toJson(JsonGenerator gen) throws IOException {
      gen.writeStartObject();

      gen.writeBinaryField("id", id.getBytes());

      if (oldValue != null) {
        gen.writeBinaryField("old", oldValue);
      }

      if (newValue != null) {
        gen.writeBinaryField("new", newValue);
      }

      gen.writeEndObject();
    }