Examples of ArrayNode


Examples of org.codehaus.jackson.node.ArrayNode

        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

Examples of org.codehaus.jackson.node.ArrayNode

        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

Examples of org.codehaus.jackson.node.ArrayNode

        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

Examples of org.codehaus.jackson.node.ArrayNode

        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

Examples of org.codehaus.jackson.node.ArrayNode

        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

Examples of org.codehaus.jackson.node.ArrayNode

        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

Examples of org.codehaus.jackson.node.ArrayNode

        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

Examples of org.codehaus.jackson.node.ArrayNode

        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

Examples of org.codehaus.jackson.node.ArrayNode

    }

    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

Examples of org.codehaus.jackson.node.ArrayNode

        if (params.containsKey("relatedEventIds[]")) {
            Set<String> visitedIds = new HashSet<String>();
            String[] relatedEventIds = getStrings("relatedEventIds[]");

            List<String> eventIds = new ArrayList<String>();
            ArrayNode array = new ArrayNode(JsonNodeFactory.instance);
            for (String relatedEventId : relatedEventIds) {
                if (!Util.isUUID(relatedEventId))
                    continue;

                if (eventId.equals(relatedEventId))
                    continue;

                if (visitedIds.contains(relatedEventId))
                    continue;

                visitedIds.add(relatedEventId);

                Event relatedEvent = daos.getEventAccess().find(con, relatedEventId);
                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.
            json.put("relatedEvents", array);
        }

        if (params.containsKey("editorIds[]")) {
            ArrayNode array = new ArrayNode(JsonNodeFactory.instance);
            List<String> editorIds = new ArrayList<String>();
            Set<String> visitedIds = new HashSet<String>();
            for (String editorId : getStrings("editorIds[]")) {
                // Skips invalid users here.
                if (!Util.isUUID(editorId))
                    continue;

                if (visitedIds.contains(editorId))
                    continue;
                visitedIds.add(editorId);

                UserEx editor = UserDAOFacade.getUserEx(con, daos, editorId);
                if (editor == null)
                    continue;

                // OK.
                editorIds.add(editor.getId());
                array.add(editor.toSafeJSON());
            }

            event.setEditorIds(editorIds);
            json.put("editors", array);
        }
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.