use of org.apache.jackrabbit.oak.commons.json.JsopBuilder in project jackrabbit-oak by apache.
the class NodeDocument method asString.
public String asString() {
JsopWriter json = new JsopBuilder();
toJson(json, data);
return json.toString();
}
use of org.apache.jackrabbit.oak.commons.json.JsopBuilder in project jackrabbit-oak by apache.
the class DocumentNodeState method asString.
public String asString() {
JsopWriter json = new JsopBuilder();
json.key("path").value(path);
json.key("rev").value(rootRevision.toString());
if (lastRevision != null) {
json.key("lastRev").value(lastRevision.toString());
}
if (hasChildren) {
json.key("hasChildren").value(true);
}
if (properties.size() > 0) {
json.key("prop").object();
for (Map.Entry<String, PropertyState> e : bundlingContext.getAllProperties().entrySet()) {
json.key(e.getKey()).value(asString(e.getValue()));
}
json.endObject();
}
return json.toString();
}
use of org.apache.jackrabbit.oak.commons.json.JsopBuilder in project jackrabbit-oak by apache.
the class DocumentNodeState method asString.
private String asString(PropertyState prop) {
if (prop == null) {
return null;
} else if (prop instanceof DocumentPropertyState) {
return ((DocumentPropertyState) prop).getValue();
}
JsopBuilder builder = new JsopBuilder();
new JsonSerializer(builder, store.getBlobSerializer()).serialize(prop);
return builder.toString();
}
use of org.apache.jackrabbit.oak.commons.json.JsopBuilder in project jackrabbit-oak by apache.
the class JournalEntry method getChanges.
private static String getChanges(TreeNode node) {
JsopBuilder builder = new JsopBuilder();
for (String name : node.keySet()) {
builder.tag('^');
builder.key(name);
builder.object().endObject();
}
return builder.toString();
}
use of org.apache.jackrabbit.oak.commons.json.JsopBuilder in project jackrabbit-oak by apache.
the class ClusterViewDocument method asHistoryEntry.
/** Converts a previous clusterView document into a history 'string' **/
private static String asHistoryEntry(final ClusterViewDocument previousView, int retiringClusterNodeId, Date retireTime) {
if (previousView == null) {
throw new IllegalArgumentException("previousView must not be null");
}
String h;
JsopBuilder b = new JsopBuilder();
b.object();
b.key(VIEW_SEQ_NUM_KEY);
b.value(previousView.getViewSeqNum());
b.key(CREATED_KEY);
b.value(String.valueOf(previousView.getCreatedAt()));
b.key(CREATOR_KEY);
b.value(previousView.getCreatedBy());
b.key(RETIRED_KEY);
b.value(String.valueOf(standardDateFormat.format(retireTime)));
b.key(RETIRER_KEY);
b.value(retiringClusterNodeId);
b.key(ACTIVE_KEY);
b.value(setToCsv(previousView.getActiveIds()));
b.key(RECOVERING_KEY);
b.value(setToCsv(previousView.getRecoveringIds()));
b.key(INACTIVE_KEY);
b.value(setToCsv(previousView.getInactiveIds()));
b.endObject();
h = b.toString();
return h;
}
Aggregations