@Override public Component createComponent(String projectKey, ComponentInput componentInput, ProgressMonitor progressMonitor) { final ComponentInputWithProjectKey helper = new ComponentInputWithProjectKey(projectKey, componentInput); return postAndParse(componentUri, InputGeneratorCallable.create(new ComponentInputWithProjectKeyJsonGenerator(), helper), new ComponentJsonParser(), progressMonitor); }
@Override public Component parse(JSONObject json) throws JSONException { final BasicComponent basicComponent = BasicComponentJsonParser.parseBasicComponent(json); final JSONObject leadJson = json.optJSONObject("lead"); final BasicUser lead = leadJson != null ? JsonParseUtil.parseBasicUser(leadJson) : null; final String assigneeTypeStr = JsonParseUtil.getOptionalString(json, "assigneeType"); final Component.AssigneeInfo assigneeInfo; if (assigneeTypeStr != null) { final AssigneeType assigneeType = parseAssigneeType(assigneeTypeStr); final JSONObject assigneeJson = json.optJSONObject("assignee"); final BasicUser assignee = assigneeJson != null ? JsonParseUtil.parseBasicUser(assigneeJson) : null; final AssigneeType realAssigneeType = parseAssigneeType(json.getString("realAssigneeType")); final JSONObject realAssigneeJson = json.optJSONObject("realAssignee"); final BasicUser realAssignee = realAssigneeJson != null ? JsonParseUtil.parseBasicUser(realAssigneeJson) : null; final boolean isAssigneeTypeValid = json.getBoolean("isAssigneeTypeValid"); assigneeInfo = new Component.AssigneeInfo(assignee, assigneeType, realAssignee, realAssigneeType, isAssigneeTypeValid); } else { assigneeInfo = null; } return new Component(basicComponent.getSelf(), basicComponent.getId(), basicComponent.getName(), basicComponent.getDescription(), lead, assigneeInfo); }
@Override public Component parse(JSONObject json) throws JSONException { final BasicComponent basicComponent = BasicComponentJsonParser.parseBasicComponent(json); final JSONObject leadJson = json.optJSONObject("lead"); final BasicUser lead = leadJson != null ? JsonParseUtil.parseBasicUser(leadJson) : null; final String assigneeTypeStr = JsonParseUtil.getOptionalString(json, "assigneeType"); final Component.AssigneeInfo assigneeInfo; if (assigneeTypeStr != null) { final AssigneeType assigneeType = parseAssigneeType(assigneeTypeStr); final JSONObject assigneeJson = json.optJSONObject("assignee"); final BasicUser assignee = assigneeJson != null ? JsonParseUtil.parseBasicUser(assigneeJson) : null; final AssigneeType realAssigneeType = parseAssigneeType(json.getString("realAssigneeType")); final JSONObject realAssigneeJson = json.optJSONObject("realAssignee"); final BasicUser realAssignee = realAssigneeJson != null ? JsonParseUtil.parseBasicUser(realAssigneeJson) : null; final boolean isAssigneeTypeValid = json.getBoolean("isAssigneeTypeValid"); assigneeInfo = new Component.AssigneeInfo(assignee, assigneeType, realAssignee, realAssigneeType, isAssigneeTypeValid); } else { assigneeInfo = null; } return new Component(basicComponent.getSelf(), basicComponent.getId(), basicComponent.getName(), basicComponent.getDescription(), lead, assigneeInfo); }
@Override public Component parse(JSONObject json) throws JSONException { final BasicComponent basicComponent = BasicComponentJsonParser.parseBasicComponent(json); final JSONObject leadJson = json.optJSONObject("lead"); final BasicUser lead = leadJson != null ? JsonParseUtil.parseBasicUser(leadJson) : null; final String assigneeTypeStr = JsonParseUtil.getOptionalString(json, "assigneeType"); final Component.AssigneeInfo assigneeInfo; if (assigneeTypeStr != null) { final AssigneeType assigneeType = parseAssigneeType(assigneeTypeStr); final JSONObject assigneeJson = json.optJSONObject("assignee"); final BasicUser assignee = assigneeJson != null ? JsonParseUtil.parseBasicUser(assigneeJson) : null; final AssigneeType realAssigneeType = parseAssigneeType(json.getString("realAssigneeType")); final JSONObject realAssigneeJson = json.optJSONObject("realAssignee"); final BasicUser realAssignee = realAssigneeJson != null ? JsonParseUtil.parseBasicUser(realAssigneeJson) : null; final boolean isAssigneeTypeValid = json.getBoolean("isAssigneeTypeValid"); assigneeInfo = new Component.AssigneeInfo(assignee, assigneeType, realAssignee, realAssigneeType, isAssigneeTypeValid); } else { assigneeInfo = null; } return new Component(basicComponent.getSelf(), basicComponent.getId(), basicComponent.getName(), basicComponent .getDescription(), lead, assigneeInfo); }
@Override public Component updateComponent(URI componentUri, ComponentInput componentInput, ProgressMonitor progressMonitor) { final ComponentInputWithProjectKey helper = new ComponentInputWithProjectKey(null, componentInput); return putAndParse(componentUri, InputGeneratorCallable.create(new ComponentInputWithProjectKeyJsonGenerator(), helper), new ComponentJsonParser(), progressMonitor); }
@Override public Component parse(JSONObject json) throws JSONException { final BasicComponent basicComponent = BasicComponentJsonParser.parseBasicComponent(json); final JSONObject leadJson = json.optJSONObject("lead"); final BasicUser lead = leadJson != null ? JsonParseUtil.parseBasicUser(leadJson) : null; final String assigneeTypeStr = JsonParseUtil.getOptionalString(json, "assigneeType"); final Component.AssigneeInfo assigneeInfo; if (assigneeTypeStr != null) { final AssigneeType assigneeType = parseAssigneeType(assigneeTypeStr); final JSONObject assigneeJson = json.optJSONObject("assignee"); final BasicUser assignee = assigneeJson != null ? JsonParseUtil.parseBasicUser(assigneeJson) : null; final AssigneeType realAssigneeType = parseAssigneeType(json.getString("realAssigneeType")); final JSONObject realAssigneeJson = json.optJSONObject("realAssignee"); final BasicUser realAssignee = realAssigneeJson != null ? JsonParseUtil.parseBasicUser(realAssigneeJson) : null; final boolean isAssigneeTypeValid = json.getBoolean("isAssigneeTypeValid"); assigneeInfo = new Component.AssigneeInfo(assignee, assigneeType, realAssignee, realAssigneeType, isAssigneeTypeValid); } else { assigneeInfo = null; } return new Component(basicComponent.getSelf(), basicComponent.getId(), basicComponent.getName(), basicComponent .getDescription(), lead, assigneeInfo); }
@Override public Component updateComponent(URI componentUri, ComponentInput componentInput, ProgressMonitor progressMonitor) { final ComponentInputWithProjectKey helper = new ComponentInputWithProjectKey(null, componentInput); return putAndParse(componentUri, InputGeneratorCallable.create(new ComponentInputWithProjectKeyJsonGenerator(), helper), new ComponentJsonParser(), progressMonitor); }
@Override public Component createComponent(String projectKey, ComponentInput componentInput, ProgressMonitor progressMonitor) { final ComponentInputWithProjectKey helper = new ComponentInputWithProjectKey(projectKey, componentInput); return postAndParse(componentUri, InputGeneratorCallable.create(new ComponentInputWithProjectKeyJsonGenerator(), helper), new ComponentJsonParser(), progressMonitor); }
@Override public Promise<Component> createComponent(String projectKey, ComponentInput componentInput) { final ComponentInputWithProjectKey helper = new ComponentInputWithProjectKey(projectKey, componentInput); return callAndParse( client.newRequest(componentUri) .setEntity(toEntity(new ComponentInputWithProjectKeyJsonGenerator(), helper)).post(), new ComponentJsonParser()); }
@Override public Promise<Component> updateComponent(URI componentUri, ComponentInput componentInput) { final ComponentInputWithProjectKey helper = new ComponentInputWithProjectKey(null, componentInput); return callAndParse(client.newRequest(componentUri) .setEntity(toEntity(new ComponentInputWithProjectKeyJsonGenerator(), helper)) .put(), new ComponentJsonParser()); }