Package org.codehaus.jackson.node

Examples of org.codehaus.jackson.node.ArrayNode


        List<String> imageIds = new CreateImageAPITransaction(user, file, contentType, limit).execute();

        ObjectNode obj = new ObjectNode(JsonNodeFactory.instance);
        obj.put("imageId", imageIds.get(0));
        ArrayNode imageIdArray = obj.putArray("imageIds");
        for (String imageId : imageIds) {
            imageIdArray.add(imageId);
        }

        // We should return text/plain or text/html for MS-IE here.
        // TODO: Should use Accept header instead of this.
        if (optBooleanParameter("ensureTextPlain", false))
View Full Code Here


        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

        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);
        }
        obj.put("appliedAt", appliedAt.getTime());
        obj.put("createdAt", createdAt.getTime());
View Full Code Here

        limit = Util.ensureRange(limit, 0, 100);

        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);
View Full Code Here

        limit = Util.ensureRange(limit, 0, 100);

        GetEnrollmentsTransaction transaction = new GetEnrollmentsTransaction(userId, offset, limit);
        transaction.execute();

        ArrayNode statuses = new ArrayNode(JsonNodeFactory.instance);
        for (TicketAndStatus ticketAndStatus : transaction.getStatuses()) {
            // TODO: We should consider how to join EventEntities and EnrollmentEntities.
            // 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);
View Full Code Here

        limit = Util.ensureRange(limit, 1, 100);

        GetMessagesTransaction transaction = new GetMessagesTransaction(user, offset, limit);
        transaction.execute();

        ArrayNode messages = Util.toSafeJSONArray(transaction.getUserMessageExs());

        ObjectNode obj = new ObjectNode(JsonNodeFactory.instance);
        obj.put("messages", messages);
        obj.put("totalMessagesCount", transaction.getCount());
        return renderOK(obj);
View Full Code Here

        int limit = optIntegerParameter("limit", 10);
        limit = Util.ensureRange(limit, 1, 100);

        List<UserEx> users = new SearchUserAccess(userNamePrefix, limit).execute();

        ArrayNode array = Util.toSafeJSONArray(users);

        ObjectNode obj = new ObjectNode(JsonNodeFactory.instance);
        obj.put("users", array);
        return renderOK(obj);
    }
View Full Code Here

        limit = Util.ensureRange(limit, 1, 100);

        GetImagesTransaction transaction = new GetImagesTransaction(user, offset, limit);
        transaction.execute();

        ArrayNode imageIds = new ArrayNode(JsonNodeFactory.instance);
        for (String imageId : transaction.getImageIds())
            imageIds.add(imageId);

        ObjectNode obj = new ObjectNode(JsonNodeFactory.instance);
        obj.put("imageIds", imageIds);
        obj.put("count", transaction.getCountImages());
        return renderOK(obj);
View Full Code Here

        limit = Util.ensureRange(limit, 0, 100);

        GetEventsTransaction transaction = new GetEventsTransaction(userId, queryType, offset, limit);
        transaction.execute();

        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);
View Full Code Here

    }

    public ObjectNode toSafeJSON() {
        ObjectNode obj = new ObjectNode(JsonNodeFactory.instance);
        obj.put("numEvents", numEvents);
        ArrayNode events = obj.putArray("participations");

        for (EventParticipation participation : participations)
            events.add(participation.toSafeJSON());

        return obj;
    }
View Full Code Here

TOP

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

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.