private void populateGenericValueFromComment(Comment updatedComment, GenericValue commentGV) { ApplicationUser updateAuthor = updatedComment.getUpdateAuthorApplicationUser(); commentGV.setString("updateauthor", updateAuthor == null ? null : updateAuthor.getKey()); commentGV.setString("body", updatedComment.getBody()); commentGV.setString("level", updatedComment.getGroupLevel()); commentGV.set("rolelevel", updatedComment.getRoleLevelId()); commentGV.set( "updated", JiraDateUtils.copyOrCreateTimestampNullsafe(updatedComment.getUpdated())); }
/** * Constructs an issue update bean for a comment delete. The comment text will be masked if the * security levels are set */ ChangeItemBean constructChangeItemBeanForCommentDelete(Comment comment) { // Check the level of the comment, if the level is not null we need to override the comment // This is necessary as part of JRA-9394 to remove comment text from the change history for // security (or lack thereof) String message; final String groupLevel = comment.getGroupLevel(); final String roleLevel = (comment.getRoleLevel() == null) ? null : comment.getRoleLevel().getName(); final String actionLevel = groupLevel == null ? roleLevel : groupLevel; if (actionLevel != null) { message = getText("comment.manager.deleted.comment.with.restricted.level", actionLevel); } else { message = comment.getBody(); } return new ChangeItemBean(ChangeItemBean.STATIC_FIELD, "Comment", message, null); }
/** * Returns true if both comments have equal bodies, group levels and role level ids, false * otherwise. * * @param comment1 comment to compare * @param comment2 comment to compare * @return true if both comments have equal bodies, group levels and role level ids, false * otherwise */ private boolean areCommentsEquivalent(Comment comment1, Comment comment2) { return ObjectUtils.equalsNullSafe(comment1.getBody(), comment2.getBody()) && ObjectUtils.equalsNullSafe(comment1.getGroupLevel(), comment2.getGroupLevel()) && ObjectUtils.equalsNullSafe(comment1.getRoleLevelId(), comment2.getRoleLevelId()); }