Package org.codehaus.jackson.node

Examples of org.codehaus.jackson.node.ObjectNode


        loginAs(proxy, TestDataProvider.DEFAULT_USER_ID);
        proxy.execute();

        assertResultOK(proxy);

        ObjectNode obj = getJSON(proxy);

        assertThat(obj.get("count").asInt(), is(10));
        JsonNode ids = obj.get("imageIds");
        for (int i = 0; i < ids.size(); ++i)
            assertThat(ids.get(i).asText(), is(TestDataProvider.IMAGE_OWNED_BY_DEFAULT_USER_ID[i]));
    }
View Full Code Here


        loginAs(proxy, TestDataProvider.DEFAULT_USER_ID);
        proxy.execute();

        assertResultOK(proxy);

        ObjectNode obj = getJSON(proxy);

        assertThat(obj.get("count").asInt(), is(10));
        JsonNode ids = obj.get("imageIds");
        for (int i = 0; i < ids.size(); ++i)
            assertThat(ids.get(i).asText(), is(TestDataProvider.IMAGE_OWNED_BY_DEFAULT_USER_ID[i + 3]));
    }
View Full Code Here

        if (passcode == null)
            passcode = session().get("event:" + eventId);

        EventEx event = new GetTransaction(user, eventId, passcode).execute();

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

        return renderOK();
    }

    private Map<UUID, List<String>> convertToMap(String jsonStr) throws PartakeException {
        try {
            ObjectNode map;
            if (jsonStr == null) {
                map = new ObjectNode(JsonNodeFactory.instance);
            } else {
                ObjectMapper mapper = new ObjectMapper();
                map = mapper.readValue(jsonStr, ObjectNode.class);
            }
            return Util.parseEnqueteAnswers(map);
View Full Code Here

            embryo.setEndDate(endDate);
        }

        String eventId = new CreateTransaction(embryo).execute();
        ObjectNode obj = new ObjectNode(JsonNodeFactory.instance);
        obj.put("eventId", eventId);
        return renderOK(obj);
    }
View Full Code Here

        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

  if (running.get()) {

      RemoteDependencyDeclaration remoteDep = new RemoteDependencyDeclaration(
        dependency, this.getURLRoot());

      ObjectNode jsonObject = remoteDep.toJson();

      String json = jsonObject.toString();

      Instance instance = createClientProxy(json, client, dependency);

      if (instance == null) {
View Full Code Here

    return stringBuffer.toString();
  }

  public static Map<String, Object> parseAsJSONValue(String src) {
    ObjectMapper mapper = new ObjectMapper();
    ObjectNode rootNode;
    try {
      rootNode = (ObjectNode) mapper.readValue(src, JsonNode.class);
    } catch (JsonParseException e) {
      throw new RuntimeException(e);
    } catch (JsonMappingException e) {
      throw new RuntimeException(e);
    } catch (IOException e) {
      throw new RuntimeException(e);
    }
    HashMap<String, Object> map = new HashMap<String, Object>();
    for (Iterator<Entry<String, JsonNode>> iter = rootNode.getFields(); iter
        .hasNext();) {
      Entry<String, JsonNode> field = iter.next();
      JsonNode value = field.getValue();
      Object o = jsonNodeAsSimpleObject(value);
      map.put(field.getKey(), o);
View Full Code Here

    public ObjectNode toJson() {

  ObjectMapper om = new ObjectMapper();

  ObjectNode root = om.createObjectNode();

  root.put(JSON_ID, getIdentifier());
  root.put(JSON_IS_MULTIPLE, isMultiple());
  root.put(JSON_COMP_REF_NAME, getComponent().getName());
  root.put(JSON_PROVIDER_URL, providerURL);

  ObjectNode json_rr = om.createObjectNode();

  json_rr.put(JSON_RESOLVABLE_REF_NAME, getTarget().getName());

  // Set RRTYPE
  if (getTarget() instanceof InterfaceReference) {
      json_rr.put(JSON_RESOLVABLE_REF_TYPE, RRTYPE.itf.toString());
  } else if (getTarget() instanceof MessageReference) {
      json_rr.put(JSON_RESOLVABLE_REF_TYPE, RRTYPE.message.toString());
  } else if (getTarget() instanceof InstanceReference) {
      json_rr.put(JSON_RESOLVABLE_REF_TYPE, RRTYPE.instance.toString());
  }

  // Set the ResolvableReference
  root.put(JSON_RESOLVABLE_REF, json_rr);
View Full Code Here

    private String toJson(EndpointRegistration registration)
      throws JsonGenerationException, JsonMappingException, IOException {

  ObjectMapper root = new ObjectMapper();

  ObjectNode node = root.createObjectNode();

  ObjectNode nodeendpoint = root.createObjectNode();

  for (Map.Entry<String, String> entry : registration.getEndpoint()
    .entrySet()) {
      nodeendpoint.put(entry.getKey(), entry.getValue());
  }

  node.put("endpoint_entry", nodeendpoint);
  node.put("protocol", registration.getProtocol());
  node.put("instance_name", registration.getInstance().getName());

  ObjectNode constraints = root.createObjectNode();

  // @distriman: add contraints

  for (Map.Entry<String, String> entry : registration.getInstance()
    .getAllPropertiesString().entrySet()) {
      constraints.put(entry.getKey(), entry.getValue());
  }

  node.put("properties", constraints);

  return node.toString();
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.