Package org.codehaus.jackson.node

Examples of org.codehaus.jackson.node.ObjectNode


        this.eventId = eventId;
        this.params = params;

        // When event information is changed, you can add the editted value here to return to the client.
        // For example, you can filter script tag for event description, and so on.
        this.json = new ObjectNode(JsonNodeFactory.instance);
    }
View Full Code Here


                if (relatedEvent == null)
                    continue;

                eventIds.add(relatedEventId);

                ObjectNode obj = new ObjectNode(JsonNodeFactory.instance);
                obj.put("id", relatedEvent.getId());
                obj.put("title", relatedEvent.getTitle());
                array.add(obj);
            }
            event.setRelatedEventIds(eventIds);

            // OK. We want to return event.id and event.title.
View Full Code Here

        UserEx user = ensureLogin();

        GetAPITransaction transaction = new GetAPITransaction(user.getId());
        transaction.execute();

        ObjectNode obj = user.toSafeJSON();
        obj.put("preference", transaction.getPreference().toSafeJSON());
        obj.put("openIds", Util.toJSONArray(transaction.getOpenIds()));
        return renderOK(obj);
    }
View Full Code Here

        return adminScreenNames.contains(screenName);
    }


    public ObjectNode toSafeJSON() {
        ObjectNode obj = super.toSafeJSON();

        if (twitterLinkage != null)
            obj.put("twitter", twitterLinkage.toSafeJSON());

        return obj;
    }
View Full Code Here

        ArrayNode statuses = new ArrayNode(JsonNodeFactory.instance);
        for (EventStatus status : transaction.getEventStatuses())
            statuses.add(status.toSafeJSON());

        ObjectNode obj = new ObjectNode(JsonNodeFactory.instance);
        obj.put("totalEventCount", transaction.getNumTotalEvents());
        obj.put("eventStatuses", statuses);

        return renderOK(obj);
    }
View Full Code Here

class EntityImageMapper extends Postgres9EntityDataMapper<UserImage> {
    public UserImage map(Postgres9Entity entity) throws DAOException {
        if (entity == null)
            return null;
        ObjectNode obj;
        try {
            obj = new ObjectMapper().readValue(new String(entity.getBody(), UTF8), ObjectNode.class);
        } catch (JsonParseException e) {
            throw new IllegalArgumentException(e);
        } catch (JsonMappingException e) {
View Full Code Here

     * <code>{ "result": "ok" }</code> をレスポンスとして返す。
     * with status code 200.
     * @return
     */
    protected Result renderOK() {
        return renderOK(new ObjectNode(JsonNodeFactory.instance));
    }
View Full Code Here

        final String reasonString = errorCode.toString() + ":" + errorCode.getReasonString();
        if (e != null) { Logger.error(reasonString, e); }
        else { Logger.error(reasonString); }

        ObjectNode obj = new ObjectNode(JsonNodeFactory.instance);
        obj.put("result", "error");
        obj.put("reason", errorCode.getReasonString());
        if (additionalInfo != null) {
            ObjectNode info = new ObjectNode(JsonNodeFactory.instance);
            for (Entry<String, String> entry : additionalInfo.entrySet())
                info.put(entry.getKey(), entry.getValue());
            obj.put("additional", info);
        }

        return renderJSON(obj, INTERNAL_SERVER_ERROR);
    }
View Full Code Here

        assert ec != null;

        if (e != null)
            Logger.info("renderInvalid", e);

        ObjectNode obj = new ObjectNode(JsonNodeFactory.instance);
        obj.put("result", "invalid");
        obj.put("reason", ec.getReasonString());
        if (additionalInfo != null) {
            ObjectNode info = new ObjectNode(JsonNodeFactory.instance);
            for (Entry<String, String> entry : additionalInfo.entrySet())
                info.put(entry.getKey(), entry.getValue());
            obj.put("additional", info);
        }

        return renderJSON(obj, BAD_REQUEST);
    }
View Full Code Here

        return renderJSON(obj, BAD_REQUEST);
    }

    protected Result renderLoginRequired() {
        ObjectNode obj = new ObjectNode(JsonNodeFactory.instance);
        obj.put("result", "auth");
        obj.put("reason", "login is required");

        addHeader("WWW-Authenticate", "OAuth");
        return renderJSON(obj, UNAUTHORIZED);
    }
View Full Code Here

TOP

Related Classes of org.codehaus.jackson.node.ObjectNode

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.