Examples of ArrayNode


Examples of org.codehaus.jackson.node.ArrayNode

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

        GetEventsTransaction transaction = new GetEventsTransaction(user, 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 static <T extends JSONable> ArrayNode toJSONArray(List<T> list) {
        if (list == null)
            return null;

        ArrayNode array = new ArrayNode(JsonNodeFactory.instance);
        for (JSONable jsonable : list)
            array.add(jsonable.toJSON());

        return array;
    }
View Full Code Here

Examples of org.codehaus.jackson.node.ArrayNode

    public static <T extends SafeJSONable> ArrayNode toSafeJSONArray(List<T> list) {
        if (list == null)
            return null;

        ArrayNode array = new ArrayNode(JsonNodeFactory.instance);
        for (SafeJSONable jsonable : list)
            array.add(jsonable.toSafeJSON());

        return array;
    }
View Full Code Here

Examples of org.codehaus.jackson.node.ArrayNode

    if (this.hasLevel()) {
      twig.put(LevelPropertyParser.LEVEL_PROPERTY, this.getLevel());
    }

    if (this.hasRange()) {
      final ArrayNode array = twig.putArray(RangePropertyParser.RANGE_PROPERTY);
      array.add(this.getLowerBound());
      array.add(this.getUpperBound());
    }

    if (this.hasBoost()) {
      twig.put(BoostPropertyParser.BOOST_PROPERTY, this.getBoost());
    }

    ArrayNode childArray = null;
    ArrayNode descendantArray = null;
    for (final QueryClause clause : clauses) {
      if (clause instanceof BasicQueryClause) {
        if (!twig.has(ChildPropertyParser.CHILD_PROPERTY)) { // avoid to create an empty array in the JSON
          childArray = twig.putArray(ChildPropertyParser.CHILD_PROPERTY);
        }
        final ObjectNode e = childArray.addObject();
        e.put(OccurPropertyParser.OCCUR_PROPERTY, clause.getOccur().toString());
        e.putAll(clause.getQuery().toJson());
      }
      else {
        if (!twig.has(DescendantPropertyParser.DESCENDANT_PROPERTY)) { // avoid to create an empty array in the JSON
          descendantArray = twig.putArray(DescendantPropertyParser.DESCENDANT_PROPERTY);
        }
        final ObjectNode e = descendantArray.addObject();
        e.put(OccurPropertyParser.OCCUR_PROPERTY, clause.getOccur().toString());
        e.put(LevelPropertyParser.LEVEL_PROPERTY, ((DescendantQueryClause) clause).getLevel());
        e.putAll(clause.getQuery().toJson());
      }
    }
View Full Code Here

Examples of org.codehaus.jackson.node.ArrayNode

    node.put(QueryPropertyParser.QUERY_PROPERTY, booleanExpression);
    if (this.hasLevel()) {
      node.put(LevelPropertyParser.LEVEL_PROPERTY, this.getLevel());
    }
    if (this.hasRange()) {
      final ArrayNode array = node.putArray(RangePropertyParser.RANGE_PROPERTY);
      array.add(this.getLowerBound());
      array.add(this.getUpperBound());
    }
    if (this.hasBoost()) {
      node.put(BoostPropertyParser.BOOST_PROPERTY, this.getBoost());
    }
    return obj;
View Full Code Here

Examples of org.codehaus.jackson.node.ArrayNode

  }

  @Override
  ObjectNode toJson() {
    final ObjectNode obj = mapper.createObjectNode();
    final ArrayNode bool = obj.putArray(BooleanPropertyParser.BOOLEAN_PROPERTY);

    for (final QueryClause clause : clauses) {
      final ObjectNode e = bool.addObject();
      e.put(OccurPropertyParser.OCCUR_PROPERTY, clause.getOccur().toString());
      e.putAll(clause.getQuery().toJson());
    }

    return obj;
View Full Code Here

Examples of org.codehaus.jackson.node.ArrayNode

        ObjectNode obj = new ObjectNode(JsonNodeFactory.instance);
        obj.put("id", id.toString());
        obj.put("question", question);
        obj.put("type", type.toString());

        ArrayNode array = obj.putArray("options");
        for (String str : options)
            array.add(str);

        return obj;
    }
View Full Code Here

Examples of org.codehaus.jackson.node.ArrayNode

        obj.put("foreImageId", foreImageId);
        obj.put("backImageId", backImageId);
        obj.put("passcode", passcode);
        obj.put("draft", draft);
        if (editorIds != null) {
            ArrayNode editorIdArray = obj.putArray("editorIds");
            for (String editorId : editorIds) {
                editorIdArray.add(editorId);
            }
        }
        if (relatedEventIds != null) {
            ArrayNode relatedEventIdArray = obj.putArray("relatedEventIds");
            for (String relatedEventId : relatedEventIds) {
                relatedEventIdArray.add(relatedEventId);
            }
        }
        if (enquetes != null)
            obj.put("enquetes", Util.toJSONArray(enquetes));
View Full Code Here

Examples of org.codehaus.jackson.node.ArrayNode

            obj.put("backImageId", backImageId);
        obj.put("passcode", passcode);
        obj.put("draft", draft);

        if (editorIds != null) {
            ArrayNode editorIdArray = obj.putArray("editorIds");
            for (String editorId : editorIds)
                editorIdArray.add(editorId);
        }
        if (relatedEventIds != null) {
            ArrayNode relatedEventIdArray = obj.putArray("relatedEventIds");
            for (String relatedEventId : relatedEventIds) {
                relatedEventIdArray.add(relatedEventId);
            }
        }
        if (enquetes != null)
            obj.put("enquetes", Util.toJSONArray(enquetes));
View Full Code Here

Examples of org.codehaus.jackson.node.ArrayNode

    public ObjectNode toJSON() {
        ObjectNode obj = new ObjectNode(JsonNodeFactory.instance);
        obj.put("id", id.toString());
        obj.put("senderId", senderId);

        ArrayNode array = obj.putArray("receiverIds");
        for (String receiverId : receiverIds)
            array.add(receiverId);

        if (eventId != null)
            obj.put("eventId", eventId);
        obj.put("messageId", messageId);
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.