Package org.codehaus.jackson.node

Examples of org.codehaus.jackson.node.ObjectNode


        return key;
    }

    @Override
    public ObjectNode toJSON() {
        ObjectNode obj = new ObjectNode(JsonNodeFactory.instance);
        obj.put(key, value);
        return obj;
    }
View Full Code Here


        return id;
    }

    @Override
    public ObjectNode toJSON() {
        ObjectNode obj = new ObjectNode(JsonNodeFactory.instance);
        obj.put("id", id.toString());
        obj.put("senderId", senderId);
        obj.put("receiverId", receiverId);
        if (eventId != null)
            obj.put("eventId", eventId);
        obj.put("messageId", messageId);
        obj.put("opened", opened);
        obj.put("delivery", delivery.toString());

        if (openedAt != null)
            obj.put("openedAt", openedAt.getTime());
        if (deliveredAt != null)
            obj.put("deliveredAt", deliveredAt.getTime());

        obj.put("createdAt", createdAt.getTime());
        if (modifiedAt != null)
            obj.put("modifiedAt", modifiedAt.getTime());
        return obj;
    }
View Full Code Here

    }

    public ObjectNode toSafeJSON() {
        DateFormat format = new SimpleDateFormat(Constants.READABLE_DATE_FORMAT, Locale.getDefault());

        ObjectNode obj = toJSON();
        if (this.deliveredAt != null) {
            obj.put("deliveredAtText", format.format(deliveredAt.toDate()));
            obj.put("deliveredAtTime", format.format(deliveredAt.getTime()));
        }

        return obj;
    }
View Full Code Here

        return id;
    }

    @Override
    public ObjectNode toJSON() {
        ObjectNode obj = new ObjectNode(JsonNodeFactory.instance);
        obj.put("id", id);
        obj.put("ticketId", ticketId.toString());
        obj.put("eventId", eventId);

        ArrayNode array = obj.putArray("userIds");
        for (String userId : userIds)
            array.add(userId);

        obj.put("notificationType", notificationType.toString());
        if (createdAt != null)
            obj.put("createdAt", createdAt.getTime());
        return obj;
    }
View Full Code Here

        return id;
    }

    @Override
    public ObjectNode toJSON() {
        ObjectNode json = new ObjectNode(JsonNodeFactory.instance);

        json.put("id", id);
        json.put("eventId", eventId);
        json.put("userId", userId);
        json.put("comment", comment);
        json.put("isHTML", isHTML);
        if (createdAt != null)
            json.put("createdAt", createdAt.getTime());

        return json;
    }
View Full Code Here

        return id;
    }

    @Override
    public ObjectNode toJSON() {
        ObjectNode obj = new ObjectNode(JsonNodeFactory.instance);
        obj.put("id", id);
        obj.put("userId", userId);
        obj.put("ticketId", ticketId.toString());
        obj.put("eventId", eventId);
        obj.put("comment", comment);
        obj.put("status", status.toString());
        obj.put("modificationStatus", modificationStatus.toString());
        obj.put("attendanceStatus", attendanceStatus.toString());
        if (enqueteAnswers != null && !enqueteAnswers.isEmpty()) {
            ObjectNode enqueteAnswers = new ObjectNode(JsonNodeFactory.instance);
            for (Map.Entry<UUID, List<String>> entry : this.enqueteAnswers.entrySet()) {
                ArrayNode array = enqueteAnswers.putArray(entry.getKey().toString());
                for (String s : entry.getValue())
                    array.add(s);
            }
            obj.put("enqueteAnswers", enqueteAnswers);
        }
View Full Code Here

        return renderJSON(obj, FORBIDDEN);
    }

    protected Result renderForbidden(UserErrorCode ec) {
        ObjectNode obj = new ObjectNode(JsonNodeFactory.instance);
        obj.put("result", "forbidden");
        obj.put("reason", ec.getReasonString());
        obj.put("errorCode", ec.toString());

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

        return renderJSON(obj, FORBIDDEN);
    }

    protected Result renderNotFound() {
        ObjectNode obj = new ObjectNode(JsonNodeFactory.instance);
        obj.put("result", "notfound");
        obj.put("reason", "not found");
        return renderJSON(obj, NOT_FOUND);
    }
View Full Code Here

        GetEnrollmentsTransaction transaction = new GetEnrollmentsTransaction(user.getId(), queryType, offset, limit);
        transaction.execute();

        ArrayNode statuses = new ArrayNode(JsonNodeFactory.instance);
        for (TicketAndStatus ticketAndStatus : transaction.getStatuses()) {
            ObjectNode obj = new ObjectNode(JsonNodeFactory.instance);
            obj.put("ticket", ticketAndStatus.ticket.toSafeJSON());
            obj.put("event", ticketAndStatus.event.toSafeJSON());
            obj.put("status", ticketAndStatus.status.toString());
            statuses.add(obj);
        }

        ObjectNode obj = new ObjectNode(JsonNodeFactory.instance);
        obj.put("totalTicketCount", transaction.getTotalTicketCount());
        obj.put("ticketStatuses", statuses);

        return renderOK(obj);
    }
View Full Code Here

            // If the event is private (or draft), its information does not be fed.
            // However, we show the existence of the event now.
            if (ticketAndStatus.event == null || !ticketAndStatus.event.isSearchable())
                continue;

            ObjectNode obj = new ObjectNode(JsonNodeFactory.instance);
            obj.put("ticket", ticketAndStatus.ticket.toSafeJSON());
            obj.put("event", ticketAndStatus.event.toSafeJSON());
            obj.put("status", ticketAndStatus.status.toString());
            statuses.add(obj);
        }

        ObjectNode obj = new ObjectNode(JsonNodeFactory.instance);
        obj.put("totalTicketCount", transaction.getTotalTicketCount());
        obj.put("ticketStatuses", statuses);

        return renderOK(obj);
    }
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.