Package com.ibm.sbt.util

Examples of com.ibm.sbt.util.DataNavigator$Xml


    private XmlParser _parser;

    XmlSAXParser(XmlSAXParserFactory factory)
    {
      _factory = factory;
      _parser = new Xml();
      _parser.setNamespaceAware(_factory.isNamespaceAware());
      _parser.setNamespacePrefixes(_factory.isNamespacePrefixes());
      // _parser.setValidating(_factory.isValidating());
      _parser.setValidating(true);
    }
View Full Code Here


    private XmlParser _parser;

    XmlSAXParser(XmlSAXParserFactory factory)
    {
      _factory = factory;
      _parser = new Xml();
      _parser.setNamespaceAware(_factory.isNamespaceAware());
      _parser.setNamespacePrefixes(_factory.isNamespacePrefixes());
      // _parser.setValidating(_factory.isValidating());
      _parser.setValidating(true);
    }
View Full Code Here

                    Map<String, String> p = Collections.singletonMap(key, lcid);
                    HandlerXml xml = new HandlerXml();
                    Document doc = (Document)svc.get("/profiles/atom/profile.do",p,xml).getData();
                    XmlNavigator nav = new XmlNavigator(doc);
                    ProfilesData data = new ProfilesData();
                    DataNavigator entry = nav.get("feed/entry/content/div/span/div");
                    data.privateData = privateData;
                    data.lcname = nav.get("feed/entry/contributor/name").stringValue(".");
                    data.lcid = entry.selectEq("@class","x-lconn-userid").stringValue(".");
                    data.lckey = entry.selectEq("@class","x-profile-key").stringValue(".");
                    data.thumbnailUrl = entry.get("img").selectEq("@class","photo").stringValue("@src");
                    data.email = entry.get("a").selectEq("@class","email").stringValue(".");                   
                    data.groupwareMail = entry.selectEq("@class","x-groupwareMail").stringValue(".");
                    data.role = entry.selectEq("@class","role").stringValue(".");
                    data.title = entry.selectEq("@class","TITLE").stringValue(".");
                    return data;
                }
            } catch(ClientServicesException ex) {
                // Ok, leave the profile empty...
                // But we return a profile withe an error in it
View Full Code Here

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

        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

        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

        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");
                String val = photo.stringValue("value");
                LLContact contact = new LLContact();
                contact.setPhoto(val);
                val = nav.stringValue("displayName");
                contact.setName(val);
                val = nav.stringValue("emailAddress");
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");
                String[] result = title.split("/");
                entry.setTitle(result[result.length - 1]);
                entry.setUpdated(nav.dateValue("modified"));
                entry.setBytes(nav.intValue("bytes"));
                entry.setSize(nav.stringValue("size"));
                entry.setAuthorName(params.get("subscriberId"));
                entry.setVersion(String.valueOf( nav.doubleValue("revision")));
                boolean isDir = nav.booleanValue("is_dir");
                entry.setIsDirectory(isDir);
                if(!isDir){
                    entry.setMimeType(nav.stringValue("mime_type"));
                }
                else{
                    entry.setMimeType("undefined");
                }
                entry.setIcon(MimeIconRegistry.getInstance().get(entry.getMimeType()));
                entry.setPath(nav.stringValue("path"));
                String proxyUrl = "xsp/.proxy/files/" + title + "?" + PARAM_TYPE + "=" + TYPE + "&path=" + entry.getPath() + "&mimeType=" + entry.getMimeType() + "&" + PARAM_ENDPOINT_NAME + "=";
                if(StringUtil.isNotEmpty(epName)){
                    proxyUrl = proxyUrl + epName;
                }
                else{
View Full Code Here

          HandlerXml xml = new HandlerXml();
          Object result = svc.get("/files/basic/api/introspection",params, xml).getData();
           
            if (result instanceof Document) {
                XmlNavigator workspacesNavigator = new XmlNavigator((Document) result);
                DataNavigator filesNavigator = workspacesNavigator.get(TAG_SERVICE + "/" + TAG_WORKSPACE).selectEq(TAG_TITLE, ATTR_VAL_FILES);
                String href = filesNavigator.get(TAG_COLLECTION).selectEq(TAG_TITLE, ATTR_VAL_MY_FILES).stringValue(ATTR_HREF);
                if (StringUtil.isNotEmpty(href)) {
                    String start = svc.getEndpoint().getUrl();
                    if (href.indexOf(start) > -1) {
                        href = href.substring(href.indexOf(start) + start.length());
                    }
                    ClientService filesService = createClientService(svc.getEndpoint(), href);
                    result = filesService.get(href, ClientService.FORMAT_XML).getData();
                    if (result instanceof Document) {
                        Document entriesDocument = (Document) result;
                        XmlNavigator entriesNavigator = new XmlNavigator(entriesDocument);
                        DataNavigator entries = entriesNavigator.get(TAG_FEED + "/" + TAG_ENTRY);
                        String repId = entriesNavigator.stringValue(TAG_FEED + "/" + TAG_ID);
                        if (StringUtil.isNotEmpty(repId)) {
                            repId = repId.substring(repId.lastIndexOf(':') + 1);
                        }
                        if (entries != null) {
                            String epName = accessor.findEndpointName();
                            for (int i = 0; i < entries.getCount(); i++) {
                                DataNavigator navigator = entries.get(i);
                                FileEntry fe = new FileEntry();
                                fe.setRepository(repId);
                                fe.setTitle(navigator.stringValue(TAG_LABEL));
                                fe.setUpdated(navigator.dateValue(TAG_MODIFIED));
                                fe.setAuthorName(navigator.stringValue(TAG_AUTHOR + "/" + TAG_NAME));
                                fe.setDescription(navigator.stringValue(TAG_SUMMARY));
                                fe.setFileId(navigator.stringValue(TAG_UUID));
                                fe.setUniqueId(fe.getFileId());
                                fe.setMimeType(getMimeType(navigator.stringValue(TAG_LABEL)));
                                fe.setIcon(MimeIconRegistry.getInstance().get(fe.getMimeType()));
                                String proxyUrl = "xsp/.proxy/files/"+accessor.findEndpointName()+"/connections/" + fe.getTitle() + "?" + PARAM_TYPE + "=" + TYPE + "&" + PARAM_ID
                                        + "=" + fe.getUniqueId() + "&" + PARAM_REPOSITORY_ID + "=" + repId + "&"+"fileName="+fe.getTitle()+"&" + PARAM_ENDPOINT_NAME
                                        + "=";
                                if (StringUtil.isNotEmpty(epName)) {
                                    proxyUrl = proxyUrl + epName;
                                }
                                else {
                                    proxyUrl = proxyUrl + TYPE;
                                }
                                fe.setProxyURL(proxyUrl);

                                fe.setPublished(navigator.dateValue(TAG_PUBLISHED));
                                fe.setVersion(navigator.stringValue(TAG_VERSION));
                                fe.setVisibility(navigator.stringValue(TAG_VISIBILITY));
                                fileEntries.add(fe);
                            }
                        }
                    }
                }
View Full Code Here

TOP

Related Classes of com.ibm.sbt.util.DataNavigator$Xml

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.