hasMore = jsonObjectNext.getBoolean(KEY_HAS_MORE); if (jsonObjectNext.has(KEY_NEXT_PARENT) && jsonObjectNext.getJSONObject(KEY_NEXT_PARENT)
public static Boolean extractBoolean(JSONObject record, String key) { //this should not happen if (record.isNull(key)) { return null; } try { return record.getBoolean(key); } catch (JSONException e) { throw new RuntimeException("Error extracting boolean from json", e); } }
@SuppressWarnings("unused") public static boolean getNestedBoolean(JSONObject json, final String... path) throws JSONException { for (int i = 0; i < path.length - 1; i++) { String s = path[i]; json = json.getJSONObject(s); } return json.getBoolean(path[path.length - 1]); }
@SuppressWarnings("unused") public static boolean getNestedBoolean(JSONObject json, String... path) throws JSONException { for (int i = 0; i < path.length - 1; i++) { String s = path[i]; json = json.getJSONObject(s); } return json.getBoolean(path[path.length - 1]); }
sServiceDescriptor.setReadRevision(rights.has("readRevision") && rights.getBoolean("readRevision")); sServiceDescriptor.setReadExtendedData(rights.has("readExtendedData") ? rights.getString("readExtendedData") : null); sServiceDescriptor.setWriteRevision(rights.has("writeRevision") && rights.getBoolean("writeRevision")); sServiceDescriptor.setWriteExtendedData(rights.has("writeExtendedData") ? rights.getString("writeExtendedData") : null); sServiceDescriptors.add(sServiceDescriptor);
@Override public Field parse(final JSONObject jsonObject) throws JSONException { final String id = jsonObject.getString("id"); final String name = jsonObject.getString("name"); final Boolean orderable = jsonObject.getBoolean("orderable"); final Boolean navigable = jsonObject.getBoolean("navigable"); final Boolean searchable = jsonObject.getBoolean("searchable"); final FieldType custom = jsonObject.getBoolean("custom") ? FieldType.CUSTOM : FieldType.JIRA; final FieldSchema schema = jsonObject.has("schema") ? schemaJsonParser.parse(jsonObject.getJSONObject("schema")) : null; return new Field(id, name, custom, orderable, navigable, searchable, schema); }
public static AttributeDefinition fromJson(String jsonStr) throws JSONException { JSONObject json = new JSONObject(jsonStr); String reverseAttr = null; if (json.has("reverseAttributeName")) { reverseAttr = json.getString("reverseAttributeName"); } return new AttributeDefinition(json.getString("name"), json.getString("dataType"), Multiplicity.fromJson(json.getString("multiplicity")), json.getBoolean("isComposite"), json.getBoolean("isUnique"), json.getBoolean("isIndexable"), reverseAttr); } }
@Override public Transition.Field parse(JSONObject json) throws JSONException { final String name = json.getString("id"); final boolean isRequired = json.getBoolean("required"); final String type = json.getString("type"); return new Transition.Field(name, isRequired, type); } }
public Transition.Field parse(JSONObject json, final String id) throws JSONException { final boolean isRequired = json.getBoolean("required"); final String type = json.getJSONObject("schema").getString("type"); return new Transition.Field(id, isRequired, type); } }
private static BasicWatchers parseValueImpl(JSONObject json) throws JSONException { final URI self = JsonParseUtil.getSelfUri(json); final boolean isWatching = json.getBoolean("isWatching"); final int numWatchers = json.getInt("watchCount"); return new BasicWatchers(self, isWatching, numWatchers); }
private static BasicWatchers parseValueImpl(JSONObject json) throws JSONException { final URI self = JsonParseUtil.getSelfUri(json); final boolean isWatching = json.getBoolean("isWatching"); final int numWatchers = json.getInt("watchCount"); return new BasicWatchers(self, isWatching, numWatchers); }
@Override public BasicVotes parse(JSONObject json) throws JSONException { final URI self = JsonParseUtil.getSelfUri(json); final int voteCount = json.getInt("votes"); final boolean hasVoted = json.getBoolean("hasVoted"); return new BasicVotes(self, voteCount, hasVoted); } }
public Transition.Field parse(JSONObject json, final String id) throws JSONException { final boolean isRequired = json.getBoolean("required"); final String type = json.getJSONObject("schema").getString("type"); return new Transition.Field(id, isRequired, type); } }
@Override public BasicVotes parse(JSONObject json) throws JSONException { final URI self = JsonParseUtil.getSelfUri(json); final int voteCount = json.getInt("votes"); final boolean hasVoted = json.getBoolean("hasVoted"); return new BasicVotes(self, voteCount, hasVoted); } }
@Override public Version parse(JSONObject json) throws JSONException { final URI self = JsonParseUtil.getSelfUri(json); final Long id = JsonParseUtil.getOptionalLong(json, "id"); final String name = json.getString("name"); final String description = JsonParseUtil.getOptionalString(json, "description"); final boolean isArchived = json.getBoolean("archived"); final boolean isReleased = json.getBoolean("released"); final String releaseDateStr = JsonParseUtil.getOptionalString(json, "releaseDate"); final DateTime releaseDate = parseReleaseDate(releaseDateStr); return new Version(self, id, name, description, isArchived, isReleased, releaseDate); }
@Override public Permission parse(final JSONObject json) throws JSONException { final Integer id = json.getInt("id"); final String key = json.getString("key"); final String name = json.getString("name"); final String description = json.getString("description"); final boolean havePermission = json.getBoolean("havePermission"); return new Permission(id, key, name, description, havePermission); } }
private CimFieldInfo parseIssueFieldInfo(JSONObject json, String id) throws JSONException { final boolean required = json.getBoolean("required"); final String name = JsonParseUtil.getOptionalString(json, "name"); final FieldSchema schema = fieldSchemaJsonParser.parse(json.getJSONObject("schema")); final Set<StandardOperation> operations = parseOperations(json.getJSONArray("operations")); final Iterable<Object> allowedValues = parseAllowedValues(json.optJSONArray("allowedValues"), schema); final URI autoCompleteUri = JsonParseUtil.parseOptionalURI(json, "autoCompleteUrl"); return new CimFieldInfo(id, required, name, schema, operations, allowedValues, autoCompleteUri); }
private CimFieldInfo parseIssueFieldInfo(JSONObject json, String id) throws JSONException { final boolean required = json.getBoolean("required"); final String name = JsonParseUtil.getOptionalString(json, "name"); final FieldSchema schema = fieldSchemaJsonParser.parse(json.getJSONObject("schema")); final Set<StandardOperation> operations = parseOperations(json.getJSONArray("operations")); final Iterable<Object> allowedValues = parseAllowedValues(json.optJSONArray("allowedValues"), schema); final URI autoCompleteUri = JsonParseUtil.parseOptionalURI(json, "autoCompleteUrl"); return new CimFieldInfo(id, required, name, schema, operations, allowedValues, autoCompleteUri); }
private CimFieldInfo parseIssueFieldInfo(JSONObject json, String id) throws JSONException { final boolean required = json.getBoolean("required"); final String name = JsonParseUtil.getOptionalString(json, "name"); final FieldSchema schema = fieldSchemaJsonParser.parse(json.getJSONObject("schema")); final Set<StandardOperation> operations = parseOperations(json.getJSONArray("operations")); final Iterable<Object> allowedValues = parseAllowedValues(json.optJSONArray("allowedValues"), schema); final URI autoCompleteUri = JsonParseUtil.parseOptionalURI(json, "autoCompleteUrl"); return new CimFieldInfo(id, required, name, schema, operations, allowedValues, autoCompleteUri); }
private CimFieldInfo parseIssueFieldInfo(JSONObject json, String id) throws JSONException { final boolean required = json.getBoolean("required"); final String name = JsonParseUtil.getOptionalString(json, "name"); final FieldSchema schema = fieldSchemaJsonParser.parse(json.getJSONObject("schema")); final Set<StandardOperation> operations = parseOperations(json.getJSONArray("operations")); final Iterable<Object> allowedValues = parseAllowedValues(json.optJSONArray("allowedValues"), schema); final URI autoCompleteUri = JsonParseUtil.parseOptionalURI(json, "autoCompleteUrl"); return new CimFieldInfo(id, required, name, schema, operations, allowedValues, autoCompleteUri); }