Package org.apache.jackrabbit.oak.commons.json

Examples of org.apache.jackrabbit.oak.commons.json.JsopBuilder


        public String toString() {
            return children.toString();
        }

        public String asString() {
            JsopWriter json = new JsopBuilder();
            if (hasMore) {
                json.key("hasMore").value(true);
            }
            if (children.size() > 0) {
                json.key("children").array();
                for (String c : children) {
                    json.value(c);
                }
                json.endArray();
            }
            return json.toString();           
        }
View Full Code Here


    private Map<Revision, String> getDeleted() {
        return ValueMap.create(this, DELETED);
    }
   
    public String asString() {
        JsopWriter json = new JsopBuilder();
        toJson(json, data);
        return json.toString();
    }
View Full Code Here

                throw new RuntimeException();
            }
        }

        public String asString() {
            JsopWriter json = new JsopBuilder();
            if (isComplete) {
                json.key("isComplete").value(true);
            }
            if (childNames.size() > 0) {
                json.key("children").array();
                for (String c : childNames) {
                    json.value(c);
                }
                json.endArray();
            }
            return json.toString();           
        }
View Full Code Here

    String getPropertyAsString(String propertyName) {
        PropertyState prop = properties.get(propertyName);
        if (prop == null) {
            return null;
        }
        JsopBuilder builder = new JsopBuilder();
        new JsonSerializer(builder, store.getBlobSerializer()).serialize(prop);
        return builder.toString();
    }
View Full Code Here

            }
        });
    }

    public String asString() {
        JsopWriter json = new JsopBuilder();
        json.key("path").value(path);
        json.key("rev").value(rev.toString());
        if (lastRevision != null) {
            json.key("lastRev").value(lastRevision.toString());
        }
        if (hasChildren) {
            json.key("hasChildren").value(hasChildren);
        }
        if (properties.size() > 0) {
            json.key("prop").object();
            for (String k : properties.keySet()) {
                json.key(k).value(getPropertyAsString(k));
            }
            json.endObject();
        }
        return json.toString();
    }
View Full Code Here

                && revision.timestamp >= since) {
            list.addFirst(revision);
            revision = revision.base;
        }

        JsopBuilder json = new JsopBuilder();
        json.array();
        int count = 0;
        for (Revision rev : list) {
            if (!rev.hasPathChanged(path)) {
                if (count++ > maxEntries) {
                    break;
                }
                json.object();
                json.key("id").value(rev.id);
                json.key("ts").value(rev.timestamp);
                json.key("msg").value(rev.message);
                json.endObject();
            }
        }
        json.endArray();
        return json.toString();
    }
View Full Code Here

                break;
            }
            revision = revision.base;
        }

        JsopBuilder json = new JsopBuilder();
        json.array();
        for (Revision rev : list) {
            String jsop = rev.getPathChanges(path, blobSerializer);
            if (!jsop.isEmpty()) {
                json.object();
                json.key("id").value(rev.id);
                json.key("ts").value(rev.timestamp);
                json.key("msg").value(rev.message);
                json.key("changes").value(jsop);
                json.endObject();
            }
        }
        json.endArray();
        return json.toString();
    }
View Full Code Here

                && revision.timestamp >= since) {
            list.addFirst(revision);
            revision = revision.base;
        }

        JsopBuilder json = new JsopBuilder();
        json.array();
        int count = 0;
        for (Revision rev : list) {
            if (!rev.hasPathChanged(path)) {
                if (count++ > maxEntries) {
                    break;
                }
                json.object();
                json.key("id").value(rev.id);
                json.key("ts").value(rev.timestamp);
                json.key("msg").value(rev.message);
                json.endObject();
            }
        }
        json.endArray();
        return json.toString();
    }
View Full Code Here

                break;
            }
            revision = revision.base;
        }

        JsopBuilder json = new JsopBuilder();
        json.array();
        for (Revision rev : list) {
            String jsop = rev.getPathChanges(path, blobSerializer);
            if (!jsop.isEmpty()) {
                json.object();
                json.key("id").value(rev.id);
                json.key("ts").value(rev.timestamp);
                json.key("msg").value(rev.message);
                json.key("changes").value(jsop);
                json.endObject();
            }
        }
        json.endArray();
        return json.toString();
    }
View Full Code Here

   
    private static String normalize(String json) {
        JsopTokenizer t = new JsopTokenizer(json);
        t.read('{');
        JsonObject o = JsonObject.create(t);
        JsopBuilder w = new JsopBuilder();
        o.toJson(w);
        return w.toString();
    }
View Full Code Here

TOP

Related Classes of org.apache.jackrabbit.oak.commons.json.JsopBuilder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.