Examples of optJSONArray()


Examples of org.apache.sling.commons.json.JSONObject.optJSONArray()

        Map<String, Object> stringArrayProps = new LinkedHashMap<String, Object>();
        stringArrayProps.put("resourceChangedAttributes", new String[]{"first", "second"});
        Event stringArrayEvent = new Event("my/simple/topic", mapToDictionary(stringArrayProps));
        JSONObject jStringArray = new JSONObject(JsonEventLogger.constructMessage(stringArrayEvent));

        assertNotNull("complex event, string array not null", jStringArray.optJSONArray("resourceChangedAttributes"));
        assertEquals("complex event, string array props", "first", jStringArray.getJSONArray("resourceChangedAttributes").getString(0));
        assertEquals("complex event, string array props", "second", jStringArray.getJSONArray("resourceChangedAttributes").getString(1));

        Map<String, Object> intArrayProps = new LinkedHashMap<String, Object>();
        intArrayProps.put("numbers", new Integer[]{0, 1, 2});
View Full Code Here

Examples of org.apache.sling.commons.json.JSONObject.optJSONArray()

        Map<String, Object> intArrayProps = new LinkedHashMap<String, Object>();
        intArrayProps.put("numbers", new Integer[]{0, 1, 2});
        Event intArrayEvent = new Event("my/simple/topic", mapToDictionary(intArrayProps));
        JSONObject jIntArray = new JSONObject(JsonEventLogger.constructMessage(intArrayEvent));

        assertNotNull("complex event, int array not null", jIntArray.optJSONArray("numbers"));
        assertEquals("complex event, int array props", 0, jIntArray.getJSONArray("numbers").getInt(0));
        assertEquals("complex event, int array props", 1, jIntArray.getJSONArray("numbers").getInt(1));
        assertEquals("complex event, int array props", 2, jIntArray.getJSONArray("numbers").getInt(2));

        Map<String, Object> mapProps = new LinkedHashMap<String, Object>();
View Full Code Here

Examples of org.apache.sling.commons.json.JSONObject.optJSONArray()

        Map<String, Object> stringSetProps = new LinkedHashMap<String, Object>();
        stringSetProps.put("resourceChangedAttributes", new LinkedHashSet<String>(Arrays.asList("first", "second")));
        Event stringSetEvent = new Event("my/simple/topic", mapToDictionary(stringSetProps));
        JSONObject jStringSet = new JSONObject(JsonEventLogger.constructMessage(stringSetEvent));

        assertNotNull("complex event, string set not null", jStringSet.optJSONArray("resourceChangedAttributes"));
        assertEquals("complex event, string set props", "first", jStringSet.getJSONArray("resourceChangedAttributes").getString(0));
        assertEquals("complex event, string set props", "second", jStringSet.getJSONArray("resourceChangedAttributes").getString(1));

    }
View Full Code Here

Examples of org.apache.wink.json4j.JSONObject.optJSONArray()

        } else if (OAuth2Message.PUBLIC_CLIENT_TYPE.equals(typeS)) {
          type = OAuth2Accessor.Type.PUBLIC;
        }
        client.setType(type);

        final JSONArray dArray = settings.optJSONArray(ALLOWED_DOMAINS);
        if (dArray != null) {
          final ArrayList<String> domains = new ArrayList<String>();
          for (int i = 0; i < dArray.length(); i++) {
            domains.add(dArray.optString(i));
          }
View Full Code Here

Examples of org.codehaus.jettison.json.JSONObject.optJSONArray()

                playableElement.setLastUpdated(currentTime);
                playableElement.setLastUpdatedBy(SPOTIFY_SOURCE);
                playableElementRepository.create(playableElement);
                track.getPlayableElements().add(playableElement);

                JSONArray jsonArtists = jsonTrack.optJSONArray("artists");
                if (jsonArtists != null && jsonArtists.length() > 0) {
                    for (int j = 0; j < jsonArtists.length(); j++) {
                        JSONObject jsonArtist = jsonArtists.getJSONObject(j);
                        String name = jsonArtist.getString("name");
                        Collection<ArtistEntity> artists = artistRepository.findByName(name);
View Full Code Here

Examples of org.json.JSONObject.optJSONArray()

            JSONObject permissionsJson = json.optJSONObject("permissions");
            if (permissionsJson == null) {
                return new BroadcastAction(message);
            }

            JSONArray users = permissionsJson.optJSONArray("users");
            if (users != null) {
                String currentUserId = CurrentUser.get(r.getRequest().getSession());
                if (!isUserInList(users, currentUserId)) {
                    return new BroadcastAction(BroadcastAction.ACTION.ABORT, message);
                }
View Full Code Here

Examples of org.json.JSONObject.optJSONArray()

                if (!isUserInList(users, currentUserId)) {
                    return new BroadcastAction(BroadcastAction.ACTION.ABORT, message);
                }
            }

            JSONArray workspaces = permissionsJson.optJSONArray("workspaces");
            if (workspaces != null) {
                String currentUserId = CurrentUser.get(r.getRequest().getSession());
                if (!isWorkspaceInList(workspaces, userRepository.getCurrentWorkspaceId(currentUserId))) {
                    return new BroadcastAction(BroadcastAction.ACTION.ABORT, message);
                }
View Full Code Here

Examples of org.json.JSONObject.optJSONArray()

        JSONObject entitiesJson = json.optJSONObject("entities");
        if (entitiesJson == null) {
            return;
        }

        JSONArray hashtagsJson = entitiesJson.optJSONArray("hashtags");
        if (hashtagsJson != null) {
            processHashtags(tweetVertex, hashtagsJson);
        }

        JSONArray urlsJson = entitiesJson.optJSONArray("urls");
View Full Code Here

Examples of org.json.JSONObject.optJSONArray()

        JSONArray hashtagsJson = entitiesJson.optJSONArray("hashtags");
        if (hashtagsJson != null) {
            processHashtags(tweetVertex, hashtagsJson);
        }

        JSONArray urlsJson = entitiesJson.optJSONArray("urls");
        if (urlsJson != null) {
            processUrls(tweetVertex, urlsJson);
        }

        JSONArray userMentionsJson = entitiesJson.optJSONArray("user_mentions");
View Full Code Here

Examples of org.json.JSONObject.optJSONArray()

        JSONArray urlsJson = entitiesJson.optJSONArray("urls");
        if (urlsJson != null) {
            processUrls(tweetVertex, urlsJson);
        }

        JSONArray userMentionsJson = entitiesJson.optJSONArray("user_mentions");
        if (userMentionsJson != null) {
            processUserMentions(tweetVertex, userMentionsJson);
        }
    }
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.