Package org.lilyproject.tools.import_.json

Examples of org.lilyproject.tools.import_.json.EntityWriter.toJson()


            ArrayNode resultsNode = listNode.putArray("results");

            EntityWriter writer = getEntityWriter(genericType);
            for (Object entity : entityList.getEntities()) {
                // Multiple repositories: ok to use public repo since only non-repository-specific things are needed
                resultsNode.add(writer.toJson(entity, entityList.getWriteOptions(),
                        repositoryMgr.getDefaultRepository()));
            }

            JsonFormat.serialize(listNode, new CloseShieldOutputStream(entityStream));
        } catch (Throwable e) {
View Full Code Here


            MediaType mediaType, MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream)
            throws IOException, WebApplicationException {
        try {
            EntityWriter writer = EntityRegistry.findWriter(object.getEntity().getClass());
            // Multiple repositories: ok to use public repo since only non-repository-specific things are needed
            ObjectNode json = writer.toJson(object.getEntity(), object.getWriteOptions(),
                    repositoryMgr.getDefaultRepository());
            JsonFormat.serialize(json, new CloseShieldOutputStream(entityStream));
        } catch (Throwable e) {
            // We catch every throwable, since otherwise no one does it and we will not have any trace
            // of Errors that happened.
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.