Search in sources :

Example 1 with BoxComment

use of com.box.sdk.BoxComment in project camel by apache.

the class BoxCommentsManager method replyToComment.

/**
     * Reply to a comment.
     * 
     * @param commentId
     *            - the id of comment to reply to.
     * @param message
     *            - the message for the reply.
     * @return The newly created reply comment.
     */
public BoxComment replyToComment(String commentId, String message) {
    try {
        LOG.debug("Replying to comment(id=" + commentId + ") with message=" + message);
        if (commentId == null) {
            throw new IllegalArgumentException("Parameter 'commentId' can not be null");
        }
        if (message == null) {
            throw new IllegalArgumentException("Parameter 'message' can not be null");
        }
        BoxComment comment = new BoxComment(boxConnection, commentId);
        return comment.reply(message).getResource();
    } catch (BoxAPIException e) {
        throw new RuntimeException(String.format("Box API returned the error code %d\n\n%s", e.getResponseCode(), e.getResponse()), e);
    }
}
Also used : BoxComment(com.box.sdk.BoxComment) BoxAPIException(com.box.sdk.BoxAPIException)

Example 2 with BoxComment

use of com.box.sdk.BoxComment in project camel by apache.

the class BoxCommentsManager method getCommentInfo.

/**
     * Get comment information.
     * 
     * @param commentId
     *            - the id of comment.
     * @return The comment information.
     */
public BoxComment.Info getCommentInfo(String commentId) {
    try {
        LOG.debug("Getting info for comment(id=" + commentId + ")");
        if (commentId == null) {
            throw new IllegalArgumentException("Parameter 'commentId' can not be null");
        }
        BoxComment comment = new BoxComment(boxConnection, commentId);
        return comment.getInfo();
    } catch (BoxAPIException e) {
        throw new RuntimeException(String.format("Box API returned the error code %d\n\n%s", e.getResponseCode(), e.getResponse()), e);
    }
}
Also used : BoxComment(com.box.sdk.BoxComment) BoxAPIException(com.box.sdk.BoxAPIException)

Example 3 with BoxComment

use of com.box.sdk.BoxComment in project camel by apache.

the class BoxCommentsManager method changeCommentMessage.

/**
     * Change comment message.
     * 
     * @param commentId
     *            - the id of comment to change.
     * @param message
     *            - the new message for the comment.
     * @return The comment with changed message.
     */
public BoxComment changeCommentMessage(String commentId, String message) {
    try {
        LOG.debug("Changing comment(id=" + commentId + ") message=" + message);
        if (commentId == null) {
            throw new IllegalArgumentException("Parameter 'commentId' can not be null");
        }
        if (message == null) {
            throw new IllegalArgumentException("Parameter 'message' can not be null");
        }
        BoxComment comment = new BoxComment(boxConnection, commentId);
        return comment.changeMessage(message).getResource();
    } catch (BoxAPIException e) {
        throw new RuntimeException(String.format("Box API returned the error code %d\n\n%s", e.getResponseCode(), e.getResponse()), e);
    }
}
Also used : BoxComment(com.box.sdk.BoxComment) BoxAPIException(com.box.sdk.BoxAPIException)

Example 4 with BoxComment

use of com.box.sdk.BoxComment in project camel by apache.

the class BoxCommentsManager method deleteComment.

/**
     * Delete comment.
     * 
     * @param commentId
     *            - the id of comment to delete.
     */
public void deleteComment(String commentId) {
    try {
        LOG.debug("Deleting comment(id=" + commentId + ")");
        if (commentId == null) {
            throw new IllegalArgumentException("Parameter 'commentId' can not be null");
        }
        BoxComment comment = new BoxComment(boxConnection, commentId);
        comment.delete();
    } catch (BoxAPIException e) {
        throw new RuntimeException(String.format("Box API returned the error code %d\n\n%s", e.getResponseCode(), e.getResponse()), e);
    }
}
Also used : BoxComment(com.box.sdk.BoxComment) BoxAPIException(com.box.sdk.BoxAPIException)

Aggregations

BoxAPIException (com.box.sdk.BoxAPIException)4 BoxComment (com.box.sdk.BoxComment)4