Examples of optJSONObject()


Examples of net.sf.json.JSONObject.optJSONObject()

                logRotator = LogRotator.DESCRIPTOR.newInstance(req,json.getJSONObject("logrotate"));
            else
                logRotator = null;

            DescribableList<JobProperty<?>, JobPropertyDescriptor> t = new DescribableList<JobProperty<?>, JobPropertyDescriptor>(NOOP,getAllProperties());
            t.rebuild(req,json.optJSONObject("properties"),JobPropertyDescriptor.getPropertyDescriptors(Job.this.getClass()));
            properties.clear();
            for (JobProperty p : t) {
                p.setOwner(this);
                properties.add(p);
            }
View Full Code Here

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

        headers.put("user-agent", "curl/7.25.0");
        mapProps.put("headers", headers);
        Event mapEvent = new Event("my/simple/topic", mapToDictionary(mapProps));
        JSONObject jMapProps = new JSONObject(JsonEventLogger.constructMessage(mapEvent));

        assertNotNull("complex event, map not null", jMapProps.optJSONObject("headers"));
        assertEquals("complex event, map value in props", "curl/7.25.0", jMapProps.getJSONObject("headers").getString("user-agent"));

        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));
View Full Code Here

Examples of org.codehaus.jettison.json.JSONArray.optJSONObject()

            if(!"id".equals(key)){
                Set<List<String>> values = new HashSet<List<String>>();
                JSONArray jValues = jRepresentation.getJSONArray(key.toString());
                assertTrue("Fields MUST contain at least a single value!",jValues.length() > 0);
                for(int i=0;i<jValues.length();i++){
                    JSONObject fieldValue = jValues.optJSONObject(i);
                    assertNotNull("Values for field "+key+" does contain an value " +
                        "that is not an JSONObject "+jValues.optString(i),
                        fieldValue);
                    String[] value = new String[2];
                    value[0] = fieldValue.optString("value");
View Full Code Here

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

    final ImmutableList.Builder<ErrorCollection> results = ImmutableList.builder();
    if (issues != null && issues.length() == 0) {
      final JSONArray errors = jsonObject.optJSONArray("errors");
      for (int i = 0; i < errors.length(); i++) {
        final JSONObject currentJsonObject = errors.getJSONObject(i);
        results.add(getErrorsFromJson(currentJsonObject.getInt("status"), currentJsonObject
            .optJSONObject("elementErrors")));
      }
    } else {
      results.add(getErrorsFromJson(status, jsonObject));
    }
View Full Code Here

Examples of org.json.JSONArray.optJSONObject()

        }

        JSONArray streamsJson = json.optJSONArray("streams");
        if (streamsJson != null) {
            for (int i = 0; i < streamsJson.length(); i++) {
                JSONObject streamsIndexJson = streamsJson.optJSONObject(i);
                if (streamsIndexJson != null) {
                    JSONObject tagsJson = streamsIndexJson.optJSONObject("tags");
                    if (tagsJson != null) {
                        Double optionalRotate = tagsJson.optDouble("rotate");
                        if (!Double.isNaN(optionalRotate)) {
View Full Code Here

Examples of org.json.JSONArray.optJSONObject()

        }

        JSONArray streamsJson = json.optJSONArray("streams");
        if (streamsJson != null) {
            for (int i = 0; i < streamsJson.length(); i++) {
                JSONObject streamsIndexJson = streamsJson.optJSONObject(i);
                if (streamsIndexJson != null) {
                    Double optionalDimension = streamsIndexJson.optDouble(dimension);
                    if (!Double.isNaN(optionalDimension)) {
                        return optionalDimension.intValue();
                    }
View Full Code Here

Examples of org.json.JSONArray.optJSONObject()

        if (1 != array.length()) {
            return null;
        }

        return array.optJSONObject(0);
    }

    @Override
    public JSONObject getByOrder(final int order) throws RepositoryException {
        final Query query = new Query().addFilter(Page.PAGE_ORDER, FilterOperator.EQUAL, order).
View Full Code Here

Examples of org.json.JSONArray.optJSONObject()

        if (0 == array.length()) {
            return null;
        }

        return array.optJSONObject(0);
    }

    @Override
    public List<JSONObject> getPages() throws RepositoryException {
        final Query query = new Query().addSort(
View Full Code Here

Examples of org.json.JSONArray.optJSONObject()

        if (0 == array.length()) {
            return null;
        }

        return array.optJSONObject(0);
    }

    @Override
    public JSONObject getAdmin() throws RepositoryException {
        final Query query = new Query().setFilter(new PropertyFilter(User.USER_ROLE, FilterOperator.EQUAL, Role.ADMIN_ROLE)).setPageCount(1);
View Full Code Here

Examples of org.json.JSONArray.optJSONObject()

        if (0 == array.length()) {
            return null;
        }

        return array.optJSONObject(0);
    }

    @Override
    public boolean isAdminEmail(final String email) throws RepositoryException {
        final JSONObject user = getByEmail(email);
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.