com.google.appraise.eclipse.core.client.data.ReviewCommentResult

Here are the examples of the java api class com.google.appraise.eclipse.core.client.data.ReviewCommentResult taken from open source projects.

1. AppraiseReviewsTaskDataHandler#populateComments()

Project: git-appraise-eclipse
File: AppraiseReviewsTaskDataHandler.java
/**
   * Fills the comments into the given task data.
   */
private void populateComments(TaskRepository repository, List<ReviewCommentResult> comments, TaskData taskData, long reviewTimestamp) {
    int commentCount = 1;
    long maxCommentTimestamp = reviewTimestamp;
    for (ReviewCommentResult comment : comments) {
        TaskCommentMapper commentMapper = new TaskCommentMapper();
        ReviewComment commentData = comment.getComment();
        if (commentData.getAuthor() != null) {
            commentMapper.setAuthor(createPerson(commentData.getAuthor(), repository));
        }
        Date timestamp = new Date(commentData.getTimestamp() * 1000);
        commentMapper.setCreationDate(timestamp);
        maxCommentTimestamp = Math.max(maxCommentTimestamp, commentData.getTimestamp());
        if (commentData.getDescription() != null) {
            commentMapper.setText(commentData.getDescription());
        } else {
            // Null comments seem to not be allowed.
            commentMapper.setText("");
        }
        commentMapper.setCommentId("" + commentCount);
        commentMapper.setNumber(commentCount);
        TaskAttribute commentAttribute = taskData.getRoot().createAttribute(TaskAttribute.PREFIX_COMMENT + commentCount);
        if (commentData.getResolved() != null) {
            TaskAttribute resolvedAttribute = commentAttribute.createAttribute(AppraiseReviewTaskSchema.COMMENT_RESOLVED_ATTRIBUTE);
            setAttributeValue(resolvedAttribute, Boolean.toString(commentData.getResolved()));
        }
        TaskAttribute idAttribute = commentAttribute.createAttribute(AppraiseReviewTaskSchema.COMMENT_ID_ATTRIBUTE);
        setAttributeValue(idAttribute, comment.getId());
        if (commentData.getParent() != null) {
            TaskAttribute parentAttribute = commentAttribute.createAttribute(AppraiseReviewTaskSchema.COMMENT_PARENT_ATTRIBUTE);
            setAttributeValue(parentAttribute, commentData.getParent());
        }
        if (commentData.getLocation() != null) {
            TaskAttribute locationFileAttr = commentAttribute.createAttribute(AppraiseReviewTaskSchema.COMMENT_LOCATION_FILE);
            setAttributeValue(locationFileAttr, commentData.getLocation().getPath());
            TaskAttribute locationLineAttr = commentAttribute.createAttribute(AppraiseReviewTaskSchema.COMMENT_LOCATION_LINE);
            if (commentData.getLocation().getRange() != null) {
                setAttributeValue(locationLineAttr, "" + commentData.getLocation().getRange().getStartLine());
            }
            TaskAttribute locationCommitAttr = commentAttribute.createAttribute(AppraiseReviewTaskSchema.COMMENT_LOCATION_COMMIT);
            setAttributeValue(locationCommitAttr, commentData.getLocation().getCommit());
        }
        commentMapper.applyTo(commentAttribute);
        commentCount++;
    }
    Date date = new Date(maxCommentTimestamp * 1000);
    setAttributeValue(taskData, schema.MODIFIED, Long.toString(date.getTime()));
}