Package org.json.jdk5.simple

Examples of org.json.jdk5.simple.JSONObject


    return object;
  }
 
 
  protected JSONObject jsonOther(Map<String, Map<String, Collection<String>>> triples, String resource, String serverAddress){
    JSONObject object = new JSONObject();
   
    object.put("type", "Resource");
    object.put("label", resource);
    object.put("uri", resource);
   
    this.addProperties(object, triples.get(resource));
   
    return object;
  }
View Full Code Here


        }
    },     
   */
  protected void setStaticContent(JSONObject obj){
   
    JSONObject types = new JSONObject();
   
    JSONObject tmpobj = new JSONObject();
    tmpobj.put("pluralLabel", "Books"); //TODO-i18n
    types.put("Book", tmpobj);
   
    tmpobj = new JSONObject();
    tmpobj.put("pluralLabel", "Categories"); //TODO-i18n
    types.put("Category", tmpobj);
   
    tmpobj = new JSONObject();
    tmpobj.put("pluralLabel", "Keywords"); //TODO-i18n
    types.put("Keyword", tmpobj);

    tmpobj = new JSONObject();
    tmpobj.put("pluralLabel", "People"); //TODO-i18n
    types.put("Person", tmpobj);

    tmpobj = new JSONObject();
    tmpobj.put("pluralLabel", "events"); //TODO-i18n
    types.put("event", tmpobj);

    tmpobj = new JSONObject();
    tmpobj.put("pluralLabel", "venues"); //TODO-i18n
    types.put("venue", tmpobj);

    tmpobj = new JSONObject();
    tmpobj.put("pluralLabel", "conferences"); //TODO-i18n
    types.put("conference", tmpobj);
   
    obj.put("types", types);

    JSONObject properties = new JSONObject();
   
    tmpobj = new JSONObject();
    tmpobj.put("valueType", "item");
    properties.put("creator", tmpobj);
   
    tmpobj = new JSONObject();
    tmpobj.put("valueType", "item");
    properties.put("editor", tmpobj);
   
    tmpobj = new JSONObject();
    tmpobj.put("valueType", "item");
    properties.put("contributor", tmpobj);
   
    tmpobj = new JSONObject();
    tmpobj.put("valueType", "item");
    properties.put("category", tmpobj);
   
    tmpobj = new JSONObject();
    tmpobj.put("valueType", "item");
    properties.put("keyword", tmpobj);
   
    tmpobj = new JSONObject();
    tmpobj.put("valueType", "item");
    properties.put("conference", tmpobj);
   
    tmpobj = new JSONObject();
    tmpobj.put("valueType", "item");
    properties.put("event", tmpobj);

    tmpobj = new JSONObject();
    tmpobj.put("valueType", "item");
    properties.put("venue", tmpobj);
   
    obj.put("properties", properties);
   
  }
View Full Code Here

       
      ChangeSender cs = new ChangeSender(uri,changeValue.toString(),change);
      cs.start();
     
      //return just name (as it is the only element that can be seen by user
      JSONObject jo = new JSONObject();
      jo.put("name", name);
      return jo.toString();
    }

    return null;
  }
View Full Code Here

      }
    }
   
    if(empty)
    {
      JSONObject jo = new JSONObject();
      jo.put("count",0);
      sendJSONResponse(resp, jo.toString());
    }
  }
View Full Code Here

        inbox.setType(S3B_SSCF.Directory);
        inbox.setIssueDate(new Date());
        inbox.setLabel("Inbox");
      }
    }
    JSONObject result = new JSONObject();
    JSONArray ja = new JSONArray();
   
    int i = 0;
   
    if(inbox!=null) {
      Iterator<XResource> it = inbox.listContent();
     
      while(it.hasNext())
      {
        XResource br = it.next();
        JSONObject jo = new JSONObject();
        jo.put("label", br.getLabel());
        jo.put("uri", br.getStringURI());
       
        ja.add(jo);
        i++;
     
    }
View Full Code Here

      if(uri!=null) {
        uri = uri.replaceAll("::", "#");
        uri = uri.replaceAll("!!","?");
      }
      String count = req.getParameter("count");
      JSONObject jomain = new JSONObject();
      int results = 0;
     
     
      if(uri!=null&&!"".equals(uri.trim())&&count!=null&&!"".equals(count.trim()))
      {
        if(recom!=null&&!"".equals(recom))
          withRecom = true;
        ResultsForUri rfu = new ResultsForUri();
        int inDb = rfu.getNestedCount(uri,withRecom,person);
     
        int inJs = 0;
        try
        {
          inJs = Integer.parseInt(count);
        }
        catch (NumberFormatException e)
        {
          //inJs will be 0
        }
       
        if(inDb>0)
        {
          if((inJs<inDb))
          {
            results=inDb-inJs;
           
            if(this.serviceAddr==null)
            {
              String port = null;
              if(req.getLocalPort()!=80)
                port = ":"+req.getLocalPort();
             
              this.serviceAddr = req.getScheme()+"://"+req.getServerName()+port+req.getContextPath();
            }
             
            nodes = rfu.getHiddenResults(req, person,this.serviceAddr,uri);
           
            jomain.put("nodes", "[%s]")
          }
        }
      }
      jomain.put("count",results);
      jomain.put("person",person.substring(person.lastIndexOf('/')+1));
      //replace is needed due because of the fact that we recieve the nodes as a one string
      // not an object
      if(nodes!=null) {
        StringBuilder sbtmp = new StringBuilder(String.format(jomain.toString(),nodes));
        sbtmp.deleteCharAt(sbtmp.indexOf("[")-1);
        sbtmp.deleteCharAt(sbtmp.lastIndexOf("]")+1);
        sendJSONResponse(resp, sbtmp.toString());
      }
      else
        sendJSONResponse(resp, jomain.toString());
     
     
    }
    //===================
    // filtering process
View Full Code Here

TOP

Related Classes of org.json.jdk5.simple.JSONObject

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.