Package org.json

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


                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

        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

        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

        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

    @Override
    public void execute(InputStream in, GraphPropertyWorkData data) throws Exception {
        JSONObject metadataJson = getMetadataJson(data);

        JSONArray propertiesJson = metadataJson.optJSONArray("properties");
        if (propertiesJson == null) {
            return;
        }

        for (int i = 0; i < propertiesJson.length(); i++) {
View Full Code Here

            final JSONObject requestJSONObject = Requests.buildPaginationRequest(path);

            final JSONObject result = pageQueryService.getPages(requestJSONObject);

            final JSONArray pages = result.optJSONArray(Page.PAGES);

            // Site-internal URLs process
            for (int i = 0; i < pages.length(); i++) {
                final JSONObject page = pages.getJSONObject(i);
View Full Code Here

        excludes.put(Article.ARTICLE_RANDOM_DOUBLE);

        requestJSONObject.put(Keys.EXCLUDES, excludes);

        final JSONObject result = articleQueryService.getArticles(requestJSONObject);
        final JSONArray articles = result.optJSONArray(Article.ARTICLES);

        final JSONRenderer renderer = new JSONRenderer();

        context.setRenderer(renderer);
View Full Code Here

    @Override
    public JSONObject getByPermalink(final String permalink) throws RepositoryException {
        final Query query = new Query().addFilter(Page.PAGE_PERMALINK, FilterOperator.EQUAL, permalink).
                setPageCount(1);
        final JSONObject result = get(query);
        final JSONArray array = result.optJSONArray(Keys.RESULTS);

        if (0 == array.length()) {
            return null;
        }
View Full Code Here

    @Override
    public int getMaxOrder() throws RepositoryException {
        final Query query = new Query().addSort(Page.PAGE_ORDER, SortDirection.DESCENDING).
                setPageCount(1);
        final JSONObject result = get(query);
        final JSONArray array = result.optJSONArray(Keys.RESULTS);

        if (0 == array.length()) {
            return -1;
        }
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.