Package org.codehaus.jackson.node

Examples of org.codehaus.jackson.node.ArrayNode


    accessLevel = accessLevel.trim();
    JsonNode allInstitutionsObject = this.configContents.path("institutions");
    JsonNode institutionObject = allInstitutionsObject.path(institution);
    if (institutionObject.has("proxy")) {
      JsonNode proxyObject = institutionObject.path("proxy");
      ArrayNode accessNode = (ArrayNode) proxyObject.path("accessLevel");
      Iterator<JsonNode> accessIterator = accessNode.getElements();
      while (accessIterator.hasNext()){
        String currentValue = accessIterator.next().getTextValue();
        if (currentValue.equalsIgnoreCase(accessLevel)){
          return proxyObject.path(serviceKey).getTextValue();
        }
View Full Code Here


        return object;
    }

    private Object toArray(JsonNode node)
    {
        ArrayNode arrayNode = (ArrayNode) node;
        Object[] array = new Object[arrayNode.size()];
        Iterator<JsonNode> elements = arrayNode.getElements();
        for (int i = 0; i < array.length; i++)
        {
            array[i] = toObject(elements.next());
        }
        return array;
View Full Code Here

    {
        JsonData jsonData = readJsonData("flickr-response.json");

        assertEquals("4136507840", jsonData.getAsString("photos/photo[0]/id"));

        ArrayNode photos = (ArrayNode) jsonData.get("photos/photo");
        assertNotNull(photos);
        assertEquals(10, photos.size());

        Object o = jsonData.get("photos");
        assertNotNull(o);
        assertTrue(o instanceof ObjectNode);
    }
View Full Code Here

    @Transformer(sourceTypes = {InputStream.class})
    public List<Item> toItemList(@Payload String in, ObjectMapper mapper) throws IOException
    {
        List<Item> items = new ArrayList<Item>();
        ArrayNode nodes = (ArrayNode) mapper.readTree(in);
        for (Iterator<JsonNode> iterator = nodes.getElements(); iterator.hasNext();)
        {
            //TODO, we're reparsing content here
            items.add(mapper.readValue(iterator.next().toString(), Item.class));
        }
View Full Code Here

    @Transformer(sourceTypes = {InputStream.class})
    public List<Person> toPeople(@Payload String in, ObjectMapper mapper) throws IOException
    {
        List<Person> people = new ArrayList<Person>();
        ArrayNode nodes = (ArrayNode) mapper.readTree(in);
        for (Iterator<JsonNode> iterator = nodes.getElements(); iterator.hasNext();)
        {
            //TODO, we're reparsing content here
             people.add(mapper.readValue(iterator.next().toString(), Person.class));
        }
View Full Code Here

    // find matches for this client with these identifiers
    Match match = new Match();
    BigInteger[] matchResults = match.find(personalIdentifiers);
   
    // create JSON response of matching client ids
    ArrayNode matchedClientIDs = mapper.createArrayNode();
    System.out.println("matchResults are: " );
    for (int i=0; i<matchResults.length; i++) {
      log.info(matchResults[i].toString());
      matchedClientIDs.add(matchResults[i].toString())
    }
    return matchedClientIDs.toString();
  }
View Full Code Here

    //log.info("testinfo");
    //log.warning("testwarning");
    AppEngineDriver a = new AppEngineDriver();
    ObjectMapper mapper = new ObjectMapper();
    JsonNode rootNode = mapper.createObjectNode(); // will be of type ObjectNode
    ArrayNode records = ((ObjectNode)rootNode).putArray("Shelters");
    try {
      Connection conn = null;
      DriverManager.registerDriver(a);
      conn = DriverManager.getConnection("jdbc:google:rdbms://pcni.org:openhmis:openciss/compass");
      Statement st = conn.createStatement();
      ResultSet rs = st.executeQuery("SELECT program_key, program_name FROM compass.program_profile_info WHERE program_type_code='1';");
      int i = 0;
      while (rs.next()) {
        //System.out.println(rs.getString("program_key") + "," + rs.getString("program_name"));       
        JsonNode recordNode = mapper.createObjectNode(); // will be of type ObjectNode
        ((ObjectNode)recordNode).put("ProgramKey", rs.getString("program_key"));
        ((ObjectNode)recordNode).put("ProgramName", rs.getString("program_name"));
        records.insert(i++, recordNode);
      }
   
    } catch (SQLException e) {e.printStackTrace();}
   
    return rootNode.toString();
View Full Code Here

    // start with just retrieving based on combination of first and last name
       
    AppEngineDriver a = new AppEngineDriver();
    ObjectMapper mapper = new ObjectMapper();
    JsonNode rootNode = mapper.createObjectNode(); // will be of type ObjectNode
    ArrayNode records = ((ObjectNode)rootNode).putArray("records");
 
    try {
      Connection conn = null;
      DriverManager.registerDriver(a);
      conn = DriverManager.getConnection("jdbc:google:rdbms://pcni.org:openhmis:openciss/compass");
      Statement st = conn.createStatement();
      System.out.println();
      ResultSet rs = st.executeQuery("SELECT name_first, name_last, date_of_birth, gender_code FROM compass.path_client WHERE name_first='"+firstName+"' AND name_last='"+lastName+"';");
      int i = 0;
      while (rs.next()) {
        System.out.println("got record: " + rs.toString());
        System.out.println(rs.getString("name_first") + "," + rs.getString("date_of_birth"));       
       
        JsonNode recordNode = mapper.createObjectNode(); // will be of type ObjectNode
        ((ObjectNode)recordNode).put("FirstName", rs.getString("name_first"));
        ((ObjectNode)recordNode).put("LastName", rs.getString("name_last"));
        ((ObjectNode)recordNode).put("DOB", rs.getString("date_of_birth"));
        ((ObjectNode)recordNode).put("Gender", rs.getString("gender_code"));
        records.insert(i++, recordNode);
      }
   
    } catch (SQLException e) {e.printStackTrace();}
   
    return rootNode.toString();
View Full Code Here

   public String getProgramList() {
    System.out.println("inside /programList method");
    AppEngineDriver a = new AppEngineDriver();
    ObjectMapper mapper = new ObjectMapper();
    JsonNode rootNode = mapper.createObjectNode(); // will be of type ObjectNode
    ArrayNode records = ((ObjectNode)rootNode).putArray("Programs");
    try {
      Connection conn = null;
      DriverManager.registerDriver(a);
      conn = DriverManager.getConnection("jdbc:google:rdbms://pcni.org:openhmis:openciss/compass");
      Statement st = conn.createStatement();
      ResultSet rs = st.executeQuery("SELECT program_key, program_name FROM compass.program_profile_info;");
      int i = 0;
      while (rs.next()) {
        //System.out.println(rs.getString("program_key") + "," + rs.getString("program_name"));       
        JsonNode recordNode = mapper.createObjectNode(); // will be of type ObjectNode
        ((ObjectNode)recordNode).put("ProgramKey", rs.getString("program_key"));
        ((ObjectNode)recordNode).put("ProgramName", rs.getString("program_name"));
        records.insert(i++, recordNode);
      }
   
    } catch (SQLException e) {e.printStackTrace();}
   
    return rootNode.toString();
View Full Code Here

    //make response (this isn't really being used right now by the client, because of the long/unknown processing time and shutdowns
    resp.setHeader("Content-Type", "application/json");
    //create JSON response of blobStoreURL contents
    ObjectMapper mapper = new ObjectMapper();
    ArrayNode blobStoreURLs = mapper.createArrayNode();
    for (int i=0; i<blobStoreURL.length; i++) {
      blobStoreURLs.add(blobStoreURL[i])
    }
    log.info("Responding with blobStoreURLs.toString()" + blobStoreURLs.toString());
    resp.getOutputStream().println(blobStoreURLs.toString())
  }
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.