Examples of ArrayNode


Examples of org.codehaus.jackson.node.ArrayNode

     
      throw new JsonParseException("The Object '" + path + "' could not be found.", null);
     
    } else if (pathNode.isArray()){
     
      ArrayNode urls = (ArrayNode) rootNode.path(path);
      for(JsonNode currentUrl: urls){
        url.add(currentUrl.getTextValue());
      }
     
    } else if (pathNode.isTextual()){
View Full Code Here

Examples of org.codehaus.jackson.node.ArrayNode

        e.printStackTrace();
        logger.error("Class Key not defined for this layer.");
        throw new Exception("Class Key not defined for this layer.");
      }
    }
    ArrayNode jsonArray = (ArrayNode) institutions.path(record.getInstitution());
    Iterator<JsonNode> institutionIterator = jsonArray.getElements();
    String classKey = null;
    while (institutionIterator.hasNext()){
      JsonNode currentNode = institutionIterator.next();
      logger.debug("trying matches...");
      Boolean accessMatch = matchNode(currentNode, "accessLevel", record.getAccess().toLowerCase());
View Full Code Here

Examples of org.codehaus.jackson.node.ArrayNode

 
  private static Boolean matchNode(JsonNode parentNode, String path, String value){
    Boolean match = false;
    JsonNode matchNode = parentNode.path(path);
    if (matchNode.isArray()){
      ArrayNode arrayNode = (ArrayNode) matchNode;
      Iterator<JsonNode> iterator = arrayNode.iterator();
      while (iterator.hasNext()){
        JsonNode currentNode = iterator.next();
        slogger.debug("node value:" + currentNode.getTextValue());
        if (currentNode.getTextValue().equalsIgnoreCase(value.trim())){
          match = true;
View Full Code Here

Examples of org.codehaus.jackson.node.ArrayNode

    logger.info("Trying default method...");
    JsonNode defaultNode = institutions.path("default");
    if (!defaultNode.isArray()){
      throw new Exception("No default defined!");
    }
    ArrayNode jsonArray = (ArrayNode) defaultNode;
    Iterator<JsonNode> iterator = jsonArray.getElements();
    SortedMap<Integer, String> classKeys = new TreeMap<Integer, String>();
    while (iterator.hasNext()){
      JsonNode currentNode = iterator.next();
      Boolean outputFormatMatch = matchNode(currentNode, "outputFormats", layer.getRequestedFormat().toLowerCase());
      if (outputFormatMatch){
View Full Code Here

Examples of org.codehaus.jackson.node.ArrayNode

        List<X> xs = new ArrayList<X>();
        xs.add(new X("0"));
        xs.add(new X("1"));
        xs.add(new X("2"));

        ArrayNode array = Util.toJSONArray(xs);
        ArrayNode safes = Util.toSafeJSONArray(xs);

        assertThat(array.size(), is(3));
        assertThat(array.get(0).get("value").asText(), is("0"));
        assertThat(array.get(1).get("value").asText(), is("1"));
        assertThat(array.get(2).get("value").asText(), is("2"));

        assertThat(safes.size(), is(3));
        assertThat(safes.get(0).get("safe").asText(), is("0"));
        assertThat(safes.get(1).get("safe").asText(), is("1"));
        assertThat(safes.get(2).get("safe").asText(), is("2"));
    }
View Full Code Here

Examples of org.codehaus.jackson.node.ArrayNode

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

        List<EventTicketNotification> notifications = new GetNotificationsAccess(user, eventId, offset, limit).execute();
        ArrayNode array = Util.toJSONArray(notifications);

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

Examples of org.codehaus.jackson.node.ArrayNode

        List<EnqueteQuestion> enquetes = new ArrayList<EnqueteQuestion>();
        try {
            for (int i = 0; i < questions.length; ++i) {
                List<String> optionValues = new ArrayList<String>();
                ArrayNode array;
                    array = new ObjectMapper().readValue(options[i], ArrayNode.class);
                for (int j = 0; j < array.size(); ++j)
                    optionValues.add(array.get(j).asText());
   
                UUID enqueteId = Util.isUUID(ids[i]) ? UUID.fromString(ids[i]) : UUID.randomUUID();
                EnqueteQuestion question = new EnqueteQuestion(
                        enqueteId, questions[i], EnqueteAnswerType.safeValueOf(types[i]), optionValues);
                enquetes.add(question);
View Full Code Here

Examples of org.codehaus.jackson.node.ArrayNode

  }

  // Set the ResolvableReference
  root.put(JSON_RESOLVABLE_REF, json_rr);

  ArrayNode instanceconstraints = om.createArrayNode();
  ArrayNode implementationconstraints = om.createArrayNode();

  for (String filter : this.getInstanceConstraints()) {
      instanceconstraints.add(filter);
  }

  for (String filter : this.getImplementationConstraints()) {
      implementationconstraints.add(filter);
  }

  root.put(JSON_INSTANCE_CONSTRAINT, instanceconstraints);
  root.put(JSON_IMPLEMENTATION_CONSTRAINT, implementationconstraints);
  // json.put(JSON_INSTANCE_CONSTRAINT, new
View Full Code Here

Examples of org.codehaus.jackson.node.ArrayNode

            return renderInvalid(UserErrorCode.INVALID_ARGUMENT);

        List<Event> events = new SearchTransaction(query, category, sortOrder, beforeDeadlineOnly, offset, maxNum).execute();

        ObjectNode obj = new ObjectNode(JsonNodeFactory.instance);
        ArrayNode jsonEventsArray = obj.putArray("events");
        for (Event event : events) {
            jsonEventsArray.add(event.toSafeJSON());
        }

        return renderOK(obj);
    }
View Full Code Here

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
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.