Package com.google.gwt.json.client

Examples of com.google.gwt.json.client.JSONObject.containsKey()


      JSONObject o = JSONParser.parseStrict(json).isObject();

      // Test
      assertThat(o.containsKey("string")).isTrue();
      assertThat(o.containsKey("int")).isTrue();
      assertThat(o.containsKey("does-not-exist")).isFalse();

   }

   @Test
   public void parseLenient() {
View Full Code Here


     */
    private static void initEntity(final String key, final JSONObject json)
    {
        JSONObject query = json.get("query").isObject();

        if (!query.containsKey(key))
        {
            JSONArray entityArray = new JSONArray();
            query.put(key, entityArray);
        }
    }
View Full Code Here

                        String titleLinkUrl = null;
                        String updatedJson = jsonQuery;
                        JSONObject queryObject = JSONParser.parse(updatedJson).isObject().get("query").isObject();

                        // Only show cancel option if search is not part of the view.
                        Boolean canChange = !queryObject.containsKey("keywords");

                        if (queryObject.containsKey("keywords"))
                        {
                            final String streamSearchText = queryObject.get("keywords").isString().stringValue();
View Full Code Here

                        JSONObject queryObject = JSONParser.parse(updatedJson).isObject().get("query").isObject();

                        // Only show cancel option if search is not part of the view.
                        Boolean canChange = !queryObject.containsKey("keywords");

                        if (queryObject.containsKey("keywords"))
                        {
                            final String streamSearchText = queryObject.get("keywords").isString().stringValue();

                            searchBoxWidget.setSearchTerm(streamSearchText);
                            searchStatusWidget.setSearchTerm(streamSearchText);
View Full Code Here

                            updatedJson = StreamJsonRequestFactory.setSearchTerm(search,
                                    StreamJsonRequestFactory.getJSONRequest(updatedJson)).toString();

                        }
                        // see if the stream belongs to a group and set up the stream title as a link
                        else if (queryObject.containsKey("recipient")
                                && queryObject.get("recipient").isArray().size() == 1)
                        {
                            JSONArray recipientArr = queryObject.get("recipient").isArray();
                            JSONObject recipientObj = recipientArr.get(0).isObject();
View Full Code Here

                }
                else
                {
                    JSONObject query = JSONParser.parse(event.getJson()).isObject().get("query").isObject();

                    if (query.containsKey("organization"))
                    {
                        atomLink.setHref("/resources/atom/stream/query/organization/"
                                + query.get("organization").isString().stringValue());
                    }
                    else if (query.containsKey("recipient"))
View Full Code Here

                    if (query.containsKey("organization"))
                    {
                        atomLink.setHref("/resources/atom/stream/query/organization/"
                                + query.get("organization").isString().stringValue());
                    }
                    else if (query.containsKey("recipient"))
                    {
                        JSONArray recipients = query.get("recipient").isArray();
                        StringBuilder recipientLink = new StringBuilder();
                        recipientLink.append("/resources/atom/stream/query/recipient/");
View Full Code Here

    {
        try
        {
            JSONObject request = StreamJsonRequestFactory.getJSONRequest(jsonRequestString);
            JSONObject query = request.get("query").isObject();
            if (!query.containsKey("keywords"))
            {
                JSONValue value = query.get("recipient");
                if (value != null)
                {
                    JSONArray recipients = value.isArray();
View Full Code Here

                    String uniqueId = null;
                    String entityType = null;

                    String imgUrl = "";

                    if (req.containsKey("query"))
                    {
                        JSONObject query = req.get("query").isObject();
                        if (query.containsKey(StreamJsonRequestFactory.RECIPIENT_KEY))
                        {
                            JSONArray recipient = query.get(StreamJsonRequestFactory.RECIPIENT_KEY).isArray();
View Full Code Here

                    String imgUrl = "";

                    if (req.containsKey("query"))
                    {
                        JSONObject query = req.get("query").isObject();
                        if (query.containsKey(StreamJsonRequestFactory.RECIPIENT_KEY))
                        {
                            JSONArray recipient = query.get(StreamJsonRequestFactory.RECIPIENT_KEY).isArray();
                            if (recipient.size() > 0)
                            {
                                JSONObject recipientObj = recipient.get(0).isObject();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.