Package com.ibm.sbt.util

Examples of com.ibm.sbt.util.JsonNavigator


    }

    //Utilities
    //TODO - Add utility methods for all profile attributes
    public static String getURL(Object json){
        JsonNavigator nav = new JsonNavigator(json);
        DataNavigator entry = nav.get("entry");
        entry = entry.get("photos");
        entry = entry.selectEq("type", "Photo");
        return entry.stringValue("value");
    }
View Full Code Here


        entry = entry.selectEq("type", "Photo");
        return entry.stringValue("value");
    }

    public static String getEMail(Object json){
        JsonNavigator nav = new JsonNavigator(json);
        DataNavigator entry = nav.get("entry");
        return entry.stringValue("emailAddress");
    }
View Full Code Here

        DataNavigator entry = nav.get("entry");
        return entry.stringValue("emailAddress");
    }

    public static String getPrimaryAddress(Object json){
        JsonNavigator nav = new JsonNavigator(json);
        DataNavigator entry = nav.get("entry");
        entry = entry.get("addresses");
        entry = entry.selectEq("title", "Primary Address");
        return entry.stringValue("address");
    }
View Full Code Here

        entry = entry.selectEq("title", "Primary Address");
        return entry.stringValue("address");
    }

    public static String getPrimaryPhone(Object json){
        JsonNavigator nav = new JsonNavigator(json);
        DataNavigator entry = nav.get("entry");
        entry = entry.get("phoneNumbers");
        entry = entry.selectEq("title", "Primary Telephone");
        return entry.stringValue("phone");
    }
View Full Code Here

    public SmartCLoudContactsService(Endpoint endpoint, String serviceUrl) {
        super(endpoint.getLabel());
    }
   
    public static LLContact[] parseContacts(Object json){
        DataNavigator navigator  = new JsonNavigator(json).get("entry");
        List<LLContact> contacts = new ArrayList<LLContact>();
        if(navigator != null){
            for(int i = 0; i < navigator.getCount(); i++){
                DataNavigator nav = navigator.get(i);
                DataNavigator photo = nav.get("photos").selectEq("type", "Photo");
View Full Code Here

       
      HandlerJson json= new HandlerJson();   
      Object jsonObject = (Object) svc.get(serviceUrl,params, json).getData();
        ArrayList<FileEntry> entries = new ArrayList<FileEntry>();
        String epName = accessor.findEndpointName();
        JsonNavigator navigator = new JsonNavigator(jsonObject);
        DataNavigator contentsNav = navigator.get("contents");
        for (int i = 0; i < contentsNav.getCount(); ++i) {
            FileEntry entry = new FileEntry();
            DataNavigator nav = contentsNav.get(i);
            try {
                String title = nav.stringValue("path");
View Full Code Here

//                   
          //TODO - Padraic
         HandlerJson json= new HandlerJson();
         Object result = service.get("/manage/oauth/getUserIdentity", json).getData();
          if(result instanceof JsonJavaObject){
              JsonNavigator jsonUtil = new JsonNavigator(result);
              PeopleData data = new PeopleData();
              data.smartCloudSubscriberId = jsonUtil.stringValue("subscriberid");
              data.smartCloudSubscriberEmail=jsonUtil.stringValue("email");
              data.smartCloudDisplayName=jsonUtil.stringValue("name");
             
              return data;
          }
      }
        }
View Full Code Here

                Object[] data = null;
                HandlerJson json= new HandlerJson();
                JsonJavaObject result = (JsonJavaObject)svc.get(getServiceUrl(),parameters,json).getData();
                if(result!=null) {
                    if(StringUtil.isNotEmpty(splitPath)) {
                        JsonNavigator nav = new JsonNavigator(result);
                        List<Object> nodes = nav.nodes(splitPath);
                        if(nodes!=null) {
                            data=nodes.toArray();
                        }
                    }
                }
View Full Code Here

                    if(collection != null){
                        int vc = collection.size();
                        for(int i = 0; i < vc; i++) {
                            Object o = collection.get(i);
                            if(o != null){
                                JsonNavigator nav = new JsonNavigator(o);
                                TwitterEntry entry = new TwitterEntry();
                                //entry.setTweetContent(nav.stringValue("text"));
                                entry.setTitle(nav.stringValue("text"));
                                entry.setAuthor(nav.get("user").stringValue("name"));
                                entries.add(entry);
                            }
                        }
                    }
                }
                else{
                    //TODO change this to JSON to be consistent
                    //http://search.twitter.com/search.json?q=%40twitterapi
                    ClientService svc = createClientService(provider, "search.json");
                    if(hashTag.indexOf('#') != 0){
                        hashTag = "#" + hashTag;
                    }
                    params.put("q", hashTag);
                   
                    //TODO - Padraic
                    HandlerJson json= new HandlerJson();
                    ArrayList collection = (ArrayList)svc.get(null,params, json).getData();
       
                    if(collection != null){
                        int vc = collection.size();
                        for(int i = 0; i < vc; i++) {
                            Object o = collection.get(i);
                            if(o != null){
                                JsonNavigator nav = new JsonNavigator(o);
                                TwitterEntry entry = new TwitterEntry();
                                //entry.setTweetContent(nav.stringValue("text"));
                                entry.setTitle(nav.stringValue("text"));
                                entry.setAuthor(nav.get("user").stringValue("name"));
                                entries.add(entry);
                            }
                        }
                    }
                   
View Full Code Here

   */
  public static DataNavigator getNavigator(Object data, Handler dataFormat) {
    if (dataFormat == ClientService.FORMAT_XML) {
      return new XmlNavigator((Node)data);
    } else if (dataFormat == ClientService.FORMAT_JSON) {
      return new JsonNavigator(data);
    } else {
      return null;
    }
  }
View Full Code Here

TOP

Related Classes of com.ibm.sbt.util.JsonNavigator

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.