public AsynchronousProjectRolesRestClient(final URI serverUri, final HttpClient client) { super(client); this.projectRoleJsonParser = new ProjectRoleJsonParser(serverUri); this.basicRoleJsonParser = new BasicProjectRoleJsonParser(); }
@Override public Iterable<User> parse(JSONArray json) throws JSONException { return JsonParseUtil.parseJsonArray(json, new UserJsonParser()); } }
@Override public FieldSchema parse(JSONObject json) throws JSONException { final String type = JsonParseUtil.getOptionalString(json, "type"); final String items = JsonParseUtil.getOptionalString(json, "items"); final String system = JsonParseUtil.getOptionalString(json, "system"); final String custom = JsonParseUtil.getOptionalString(json, "custom"); final Long customId = JsonParseUtil.getOptionalLong(json, "customId"); return new FieldSchema(type, items, system, custom, customId); } }
@Nullable private <T> T getOptionalNestedField(final JSONObject s, final String fieldId, final JsonObjectParser<T> jsonParser) throws JSONException { final JSONObject fieldJson = JsonParseUtil.getNestedOptionalObject(s, FIELDS, fieldId); // for fields like assignee (when unassigned) value attribute may be missing completely if (fieldJson != null) { return jsonParser.parse(fieldJson); } return null; }
public static <T> T parseOptionalJsonObject(final JSONObject json, final String attributeName, final JsonObjectParser<T> jsonParser) throws JSONException { JSONObject attributeObject = getOptionalJsonObject(json, attributeName); return attributeObject != null ? jsonParser.parse(attributeObject) : null; }
public static JsonArrayParser<Iterable<Field>> createFieldsArrayParser() { return GenericJsonArrayParser.create(new FieldJsonParser()); } }
public static JsonObjectParser<Watchers> createWatchersParser() { return new JsonObjectParser<Watchers>() { private final BasicUserJsonParser userJsonParser = new BasicUserJsonParser(); @Override public Watchers parse(JSONObject json) throws JSONException { final Collection<BasicUser> watchers = JsonParseUtil.parseJsonArray(json.getJSONArray("watchers"), userJsonParser); return new Watchers(parseValueImpl(json), watchers); } }; }
@Override public BasicUser parse(JSONObject jsonObject) throws JSONException { return JsonParseUtil.parseBasicUser(jsonObject); } }
@SuppressWarnings("UnusedDeclaration") public static <T> ExpandableProperty<T> parseExpandableProperty(final JSONObject json, final JsonObjectParser<T> expandablePropertyBuilder) throws JSONException { return parseExpandableProperty(json, false, expandablePropertyBuilder); }
@Override public String parse(JSONObject jsonObject) throws JSONException { return JsonParseUtil.getNullableString(jsonObject, VALUE_ATTRIBUTE); } }
@Override public FieldSchema parse(JSONObject json) throws JSONException { final String type = JsonParseUtil.getOptionalString(json, "type"); final String items = JsonParseUtil.getOptionalString(json, "items"); final String system = JsonParseUtil.getOptionalString(json, "system"); final String custom = JsonParseUtil.getOptionalString(json, "custom"); final Long customId = JsonParseUtil.getOptionalLong(json, "customId"); return new FieldSchema(type, items, system, custom, customId); } }
@Nullable private <T> T getOptionalNestedField(final JSONObject s, final String fieldId, final JsonObjectParser<T> jsonParser) throws JSONException { final JSONObject fieldJson = JsonParseUtil.getNestedOptionalObject(s, FIELDS, fieldId); // for fields like assignee (when unassigned) value attribute may be missing completely if (fieldJson != null) { return jsonParser.parse(fieldJson); } return null; }
public JerseyProjectRolesRestClient( final URI baseUri, final ApacheHttpClient client, final URI serverUri) { super(baseUri, client); this.projectRoleJsonParser = new ProjectRoleJsonParser(serverUri); this.basicRoleJsonParser = new BasicProjectRoleJsonParser(); }
public static <T> T parseOptionalJsonObject(final JSONObject json, final String attributeName, final JsonObjectParser<T> jsonParser) throws JSONException { JSONObject attributeObject = getOptionalJsonObject(json, attributeName); return attributeObject != null ? jsonParser.parse(attributeObject) : null; }
public static JsonArrayParser<Iterable<Field>> createFieldsArrayParser() { return GenericJsonArrayParser.create(new FieldJsonParser()); } }
public AsynchronousProjectRolesRestClient(final URI serverUri, final HttpClient client) { super(client); this.projectRoleJsonParser = new ProjectRoleJsonParser(serverUri); this.basicRoleJsonParser = new BasicProjectRoleJsonParser(); }