Examples of optString()


Examples of org.json.JSONArray.optString()

                // Markdown to HTML for content and abstract
                markdown(article);

                // Remove unused properties
                for (int j = 0; j < excludes.length(); j++) {
                    article.remove(excludes.optString(j));
                }
            }

            ret.put(ARTICLES, articles);
View Full Code Here

Examples of org.json.JSONObject.optString()

                return failureResultForStatusCode(responseStatus);

            ResourceProxy resource = new ResourceProxy(path);

            JSONObject json = new JSONObject(get.getResponseBodyAsString());
            String primaryType = json.optString(Repository.JCR_PRIMARY_TYPE);
            if (primaryType != null) { // TODO - needed?
                resource.addProperty(Repository.JCR_PRIMARY_TYPE, primaryType);
            }

            // TODO - populate all properties
View Full Code Here

Examples of org.json.JSONObject.optString()

                String key = (String) keyIterator.next();
                JSONObject value = json.optJSONObject(key);
                if (value != null) {
                    ResourceProxy child = new ResourceProxy(PathUtil.join(path, key));
                    child.addProperty(Repository.JCR_PRIMARY_TYPE, value.optString(Repository.JCR_PRIMARY_TYPE));
                    resource.addChild(child);
                }
            }
       
            return AbstractResult.success(resource);
View Full Code Here

Examples of org.json.JSONObject.optString()

  public WebWorkspace createWorkspace(String workspaceName) throws CoreException {
    // see org.eclipse.orion.server.servlets.WorkspaceServlet.doCreateWorkspace()
    WebWorkspace workspace =  webuser.createWorkspace(workspaceName);
    URI loc = URI.create(Activator.LOCATION_WORKSPACE_SERVLET);
    JSONObject result = WorkspaceResourceHandler.toJSON(workspace, loc, loc);
    String resultLocation = result.optString(ProtocolConstants.KEY_LOCATION);

    // add user rights for the workspace
    AuthorizationService.addUserRight(this.getUserID(), URI.create(resultLocation).getPath());
    AuthorizationService.addUserRight(this.getUserID(), URI.create(resultLocation).getPath() + "/*"); //$NON-NLS-1$
    // add user rights for file servlet location
View Full Code Here

Examples of org.json.JSONObject.optString()

            JSONObject tweetJson = tweetStreamReader.read();
            if (tweetJson == null) {
                Utils.sleep(10000);
                return;
            }
            String messageId = tweetJson.optString("id");
            if (messageId == null) {
                return;
            }
            this.collector.emit(new Values(tweetJson.toString()), messageId);
        } catch (IOException e) {
View Full Code Here

Examples of org.json.JSONObject.optString()

            }
            int movieId = movieJson.getInt("id");
            VertexBuilder movieMutation = prepareVertex(TheMovieDbOntology.getMovieVertexId(movieId), visibility);
            LumifyProperties.CONCEPT_TYPE.addPropertyValue(movieMutation, MULTI_VALUE_KEY, TheMovieDbOntology.CONCEPT_TYPE_MOVIE, visibility);
            LumifyProperties.SOURCE.addPropertyValue(movieMutation, MULTI_VALUE_KEY, SOURCE, visibility);
            String title = movieJson.optString("title");
            if (title != null && title.length() > 0) {
                LumifyProperties.TITLE.addPropertyValue(movieMutation, MULTI_VALUE_KEY, title, visibility);
            }
            Vertex movieVertex = movieMutation.save(authorizations);
View Full Code Here

Examples of org.json.JSONObject.optString()

                String sourceUrl = "http://www.themoviedb.org/company/" + productionCompanyId;
                VertexBuilder productionCompanyMutation = prepareVertex(TheMovieDbOntology.getProductionCompanyVertexId(productionCompanyId), visibility);
                LumifyProperties.CONCEPT_TYPE.addPropertyValue(productionCompanyMutation, MULTI_VALUE_KEY, TheMovieDbOntology.CONCEPT_TYPE_PRODUCTION_COMPANY, visibility);
                LumifyProperties.SOURCE.addPropertyValue(productionCompanyMutation, MULTI_VALUE_KEY, SOURCE, visibility);
                LumifyProperties.SOURCE_URL.addPropertyValue(productionCompanyMutation, MULTI_VALUE_KEY, sourceUrl, visibility);
                String name = productionCompany.optString("name");
                if (name != null && name.length() > 0) {
                    LumifyProperties.TITLE.addPropertyValue(productionCompanyMutation, MULTI_VALUE_KEY, name, visibility);
                }
                Vertex productionCompanyVertex = productionCompanyMutation.save(authorizations);
                addEdge(TheMovieDbOntology.getProductionCompanyProducedEdgeId(productionCompanyId, movieId), productionCompanyVertex, movieVertex, TheMovieDbOntology.EDGE_LABEL_PRODUCED, visibility, authorizations);
View Full Code Here

Examples of org.json.JSONObject.optString()

            String sourceUrl = "http://www.themoviedb.org/person/" + personId;
            VertexBuilder personMutation = prepareVertex(TheMovieDbOntology.getPersonVertexId(personId), visibility);
            LumifyProperties.CONCEPT_TYPE.addPropertyValue(personMutation, MULTI_VALUE_KEY, TheMovieDbOntology.CONCEPT_TYPE_PERSON, visibility);
            LumifyProperties.SOURCE.addPropertyValue(personMutation, MULTI_VALUE_KEY, SOURCE, visibility);
            LumifyProperties.SOURCE_URL.addPropertyValue(personMutation, MULTI_VALUE_KEY, sourceUrl, visibility);
            String name = castJson.optString("name");
            if (name != null && name.length() > 0) {
                LumifyProperties.TITLE.addPropertyValue(personMutation, MULTI_VALUE_KEY, name, visibility);
            }
            Vertex personVertex = personMutation.save(authorizations);
            addEdge(TheMovieDbOntology.getStarredInEdgeId(personId, movieId), personVertex, movieVertex, TheMovieDbOntology.EDGE_LABEL_STARRED_IN, visibility, authorizations);
View Full Code Here

Examples of org.json.JSONObject.optString()

                LumifyProperties.TITLE.addPropertyValue(personMutation, MULTI_VALUE_KEY, name, visibility);
            }
            Vertex personVertex = personMutation.save(authorizations);
            addEdge(TheMovieDbOntology.getStarredInEdgeId(personId, movieId), personVertex, movieVertex, TheMovieDbOntology.EDGE_LABEL_STARRED_IN, visibility, authorizations);

            String character = castJson.optString("character");
            if (character != null && character.length() > 0) {
                String roleId = TheMovieDbOntology.getRoleId(personId, movieId);
                VertexBuilder roleMutation = prepareVertex(TheMovieDbOntology.getRoleVertexId(roleId), visibility);
                LumifyProperties.CONCEPT_TYPE.addPropertyValue(roleMutation, MULTI_VALUE_KEY, TheMovieDbOntology.CONCEPT_TYPE_ROLE, visibility);
                LumifyProperties.SOURCE.addPropertyValue(roleMutation, MULTI_VALUE_KEY, SOURCE, visibility);
View Full Code Here

Examples of org.json.JSONObject.optString()

    }

    private void processRequestData(AtmosphereResource resource, String message) {
        JSONObject messageJson = new JSONObject(message);

        String type = messageJson.optString("type");
        if (type == null) {
            return;
        }

        JSONObject dataJson = messageJson.optJSONObject("data");
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.