in src/main/java/org/apache/sling/jcr/contentloader/internal/readers/OrderedJsonReader.java [55:102]
protected void writeChildren(JsonObject obj, ContentCreator contentCreator) throws RepositoryException {
if (! obj.containsKey(PN_ORDEREDCHILDREN)) {
super.writeChildren(obj, contentCreator);
} else {
for (Map.Entry<String, JsonValue> entry : obj.entrySet()) {
final String n = entry.getKey();
// skip well known objects
if (!ignoredNames.contains(n)) {
Object o = entry.getValue();
if (!handleSecurity(n, o, contentCreator)) {
if (n.equals(PN_ORDEREDCHILDREN)) {
if (o instanceof JsonArray) {
JsonArray children = (JsonArray) o;
for (int childIndex = 0; childIndex < children.size(); childIndex++) {
Object oc = children.get(childIndex);
if (oc instanceof JsonObject) {
JsonObject child = (JsonObject) oc;
String childName = child.getString(PN_ORDEREDCHILDNAME, null);
if (childName != null && !childName.isEmpty() ) {
JsonObjectBuilder builder = Json.createObjectBuilder();
for (Map.Entry<String, JsonValue> e : child.entrySet())
{
if (!PN_ORDEREDCHILDNAME.equals(e.getKey()))
{
builder.add(e.getKey(), e.getValue());
}
}
child = builder.build();
this.createNode(childName, child, contentCreator);
} else {
throw new JsonException(PN_ORDEREDCHILDREN + " children must have a name whose key is " + PN_ORDEREDCHILDNAME);
}
} else {
throw new JsonException(PN_ORDEREDCHILDREN + " array must only have JSONObject items");
}
}
} else {
throw new JsonException(PN_ORDEREDCHILDREN + " value must be a JSON array");
}
}
} else {
this.createProperty(n, o, contentCreator);
}
}
}
}
}