Package org.codehaus.jettison.json

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


        assertNotNull("Result Query is missing the 'selected' property",jSelected);
        assertTrue("Result Query is expected to have at least a single selected field",
            jSelected.length() > 0);
        boolean found = false;
        for(int i=0;i<jSelected.length() && !found;i++){
            String selectedField = jSelected.optString(i,null);
            assertNotNull("Selected array contains a NULL element \n"+jSelected.toString(4),
                selectedField);
            selectedSet.remove(selectedField);
        }
        assertTrue("Fields "+selectedSet+" are not selected by\n"+jSelected.toString(4),
View Full Code Here


                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");
                    value[1] = null;
                    assertNotNull("All Field-values MUST have the 'value' property",value[0]);
View Full Code Here

        JSONArray addFields = jConstraint.optJSONArray("addFields");
        final List<String> fields;
        if(addFields != null && addFields.length() > 0){
            fields = new ArrayList<String>(addFields.length());
            for(int i=0;i<addFields.length();i++){
                String field = addFields.optString(i);
                field = field != null ? nsPrefixService.getFullName(field) : null;
                if(field != null && !field.isEmpty()){
                    fields.add(field);
                }
            }
View Full Code Here

        if(!jQuery.has("type")){
            types = Collections.emptySet();
        } else if((jTypes = jQuery.optJSONArray("type")) != null){
            types = new HashSet<String>(jTypes.length());
            for(int i=0;i<jTypes.length();i++){
                String type = nsPrefixService.getFullName(jTypes.optString(i));
                if(type != null && !type.isEmpty()){
                    types.add(type);
                } else {
                    log.warn("Unable to parse entity type from parsed type {}",jTypes.optString(i));
                }
View Full Code Here

            for(int i=0;i<jTypes.length();i++){
                String type = nsPrefixService.getFullName(jTypes.optString(i));
                if(type != null && !type.isEmpty()){
                    types.add(type);
                } else {
                    log.warn("Unable to parse entity type from parsed type {}",jTypes.optString(i));
                }
            }
        } else {
            String type = jQuery.optString("type");
            if(type != null && !type.isEmpty()){
View Full Code Here

        assertNotNull("Result Query is missing the 'selected' property",jSelected);
        assertTrue("Result Query is expected to have at least a single selected field",
            jSelected.length() > 0);
        boolean found = false;
        for(int i=0;i<jSelected.length() && !found;i++){
            String selectedField = jSelected.optString(i,null);
            assertNotNull("Selected array contains a NULL element \n"+jSelected.toString(4),
                selectedField);
            selectedSet.remove(selectedField);
        }
        assertTrue("Fields "+selectedSet+" are not selected by\n"+jSelected.toString(4),
View Full Code Here

                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");
                    value[1] = null;
                    assertNotNull("All Field-values MUST have the 'value' property",value[0]);
View Full Code Here

        JSONArray addFields = jConstraint.optJSONArray("addFields");
        final List<String> fields;
        if(addFields != null && addFields.length() > 0){
            fields = new ArrayList<String>(addFields.length());
            for(int i=0;i<addFields.length();i++){
                String field = addFields.optString(i);
                field = field != null ? nsPrefixService.getFullName(field) : null;
                if(field != null && !field.isEmpty()){
                    fields.add(field);
                }
            }
View Full Code Here

        final String c = getKeyIndexClass(elementClass);
        final JSONArray jsonArray = RestHelper.getResultArray(this.graphURI + RexsterTokens.SLASH_KEY_INDICES_SLASH + c);

        final HashSet<String> keys = new HashSet<String>();
        for (int ix = 0; ix < jsonArray.length(); ix++) {
            keys.add(jsonArray.optString(ix));
        }

        return keys;
    }
View Full Code Here

        assertNotNull("Result Query is missing the 'selected' property",jSelected);
        assertTrue("Result Query is expected to have at least a single selected field",
            jSelected.length() > 0);
        boolean found = false;
        for(int i=0;i<jSelected.length() && !found;i++){
            String selectedField = jSelected.optString(i,null);
            assertNotNull("Selected array contains a NULL element \n"+jSelected.toString(4),
                selectedField);
            selectedSet.remove(selectedField);
        }
        assertTrue("Fields "+selectedSet+" are not selected by\n"+jSelected.toString(4),
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.