public static Comment valueOf(String body) { return new Comment(null, body, null, null, null, null, null, null); }
private void setIssueComments(Issue issue, com.atlassian.jira.rest.client.api.domain.Issue jiraIssue) { List<Comment> comments = new ArrayList<>(); jiraIssue.getComments() .forEach(c -> comments.add(new Comment(issue.getTrackerId().get(), Long.toString(c.getId()), c.getBody(), false))); issue.getComments().addAll(comments); }
public void addComment(String issueId, String commentBody, String groupVisibility, String roleVisibility) { final URIBuilder builder = new URIBuilder(uri) .setPath(String.format("%s/issue/%s/comment", baseApiPath, issueId)); final Comment comment; if (StringUtils.isNotBlank(groupVisibility)) { comment = Comment.createWithGroupLevel(commentBody, groupVisibility); } else if (StringUtils.isNotBlank(roleVisibility)) { comment = Comment.createWithRoleLevel(commentBody, roleVisibility); } else { comment = Comment.valueOf(commentBody); } try { jiraRestClient.getIssueClient().addComment(builder.build(), comment).get(timeout, TimeUnit.SECONDS); } catch (Exception e) { LOGGER.log(WARNING, "jira rest client add comment error. cause: " + e.getMessage(), e); } }
@Override public JSONObject generate(Comment comment) throws JSONException { JSONObject res = new JSONObject(); if (comment.getBody() != null) { res.put("body", comment.getBody()); final Visibility commentVisibility = comment.getVisibility(); if (commentVisibility != null) {
private void postComment(Issue issue, Comment comment) throws NotFoundException { if (comment.isPrivate()) Utils.logWarnMessage(LOG, "Private comments are not currently supported by " + getClass().getName()); com.atlassian.jira.rest.client.api.domain.Issue jiraIssue = getIssue(issue); com.atlassian.jira.rest.client.api.domain.Comment c = com.atlassian.jira.rest.client.api.domain.Comment.valueOf(comment.getBody()); restClient.getIssueClient().addComment(jiraIssue.getCommentsUri(), c).claim(); }
@Override public JSONObject generate(Comment comment) throws JSONException { JSONObject res = new JSONObject(); if (comment.getBody() != null) { res.put("body", comment.getBody()); final Visibility commentVisibility = comment.getVisibility(); if (commentVisibility != null) {
Comment comment = Comment.valueOf("Issue resolved by OpenNMS."); for (Transition transition : transitions) { if (config.getResolveTransitionName().equals(transition.getName())) { Comment comment = Comment.valueOf("Issue reopened by OpenNMS."); for (Transition transition : transitions) { if (getConfig().getReopentransitionName().equals(transition.getName())) {
public static Comment valueOf(String body) { return new Comment(null, body, null, null, null, null, null, null); }
Comment comment = Comment.valueOf("Issue resolved by OpenNMS."); for (Transition transition : transitions) { if (config.getResolveTransitionName().equals(transition.getName())) { Comment comment = Comment.valueOf("Issue reopened by OpenNMS."); for (Transition transition : transitions) { if (getConfig().getReopentransitionName().equals(transition.getName())) {
public static Comment createWithGroupLevel(String body, String groupLevel) { return new Comment(null, body, null, null, null, null, Visibility.group(groupLevel), null); }
public static Comment createWithRoleLevel(String body, String roleLevel) { return new Comment(null, body, null, null, null, null, Visibility.role(roleLevel), null); }
public static Comment createWithRoleLevel(String body, String roleLevel) { return new Comment(null, body, null, null, null, null, Visibility.role(roleLevel), null); }
public static Comment createWithGroupLevel(String body, String groupLevel) { return new Comment(null, body, null, null, null, null, Visibility.group(groupLevel), null); }
@Override public Comment parse(JSONObject json) throws JSONException { final URI selfUri = JsonParseUtil.getSelfUri(json); final Long id = JsonParseUtil.getOptionalLong(json, "id"); final String body = json.getString("body"); final BasicUser author = JsonParseUtil.parseBasicUser(json.optJSONObject("author")); final BasicUser updateAuthor = JsonParseUtil.parseBasicUser(json.optJSONObject("updateAuthor")); final Visibility visibility = visibilityJsonParser.parseVisibility(json); return new Comment(selfUri, body, author, updateAuthor, JsonParseUtil.parseDateTime(json.getString("created")), JsonParseUtil.parseDateTime(json.getString("updated")), visibility, id); } }
@Override public Comment parse(JSONObject json) throws JSONException { final URI selfUri = JsonParseUtil.getSelfUri(json); final Long id = JsonParseUtil.getOptionalLong(json, "id"); final String body = json.getString("body"); final BasicUser author = JsonParseUtil.parseBasicUser(json.optJSONObject("author")); final BasicUser updateAuthor = JsonParseUtil.parseBasicUser(json.optJSONObject("updateAuthor")); final Visibility visibility = visibilityJsonParser.parseVisibility(json); return new Comment(selfUri, body, author, updateAuthor, JsonParseUtil.parseDateTime(json.getString("created")), JsonParseUtil.parseDateTime(json.getString("updated")), visibility, id); } }