Search in sources :

Example 1 with BoxTaskAssignment

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

the class BoxTasksManager method getTaskAssignmentInfo.

/**
     * Get task assignment information.
     * 
     * @param taskAssignmentId
     *            - the id of task assignment.
     * @return The task assignment information.
     */
public BoxTaskAssignment.Info getTaskAssignmentInfo(String taskAssignmentId) {
    try {
        LOG.debug("Getting info for task(id=" + taskAssignmentId + ")");
        if (taskAssignmentId == null) {
            throw new IllegalArgumentException("Parameter 'taskAssignmentId' can not be null");
        }
        BoxTaskAssignment taskAssignment = new BoxTaskAssignment(boxConnection, taskAssignmentId);
        return taskAssignment.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 : BoxTaskAssignment(com.box.sdk.BoxTaskAssignment) BoxAPIException(com.box.sdk.BoxAPIException)

Example 2 with BoxTaskAssignment

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

the class BoxTasksManager method deleteTaskAssignment.

// TODO Add this method when BoxTaskAssignment API fixed:
// BoxTaskAssignment.update method currently
// takes BoxTask.Info instead of BoxTaskAssignment.Info
// /**
// * Update task assignment information.
// *
// * @param taskAssignmentId
// * - the id of task assignment.
// * @param info
// * - the updated information
// * @return The updated task assignment.
// */
// public BoxTaskAssignment updateTaskAssignmentInfo(String
// taskAssignmentId, BoxTaskAssignment.Info info) {
// try {
// LOG.debug("Updating info for task(id=" + taskAssignmentId + ")");
// if (taskAssignmentId == null) {
// throw new IllegalArgumentException("Parameter 'taskAssignmentId' can not
// be null");
// }
// if (info == null) {
// throw new IllegalArgumentException("Parameter 'info' can not be null");
// }
//
// BoxTaskAssignment taskAssignment = new BoxTaskAssignment(boxConnection,
// taskAssignmentId);
// taskAssignment.updateInfo(info);
//
// return taskAssignment;
// } catch (BoxAPIException e) {
// throw new RuntimeException(
// String.format("Box API returned the error code %d\n\n%s",
// e.getResponseCode(), e.getResponse()), e);
// }
// }
/**
     * Delete task assignment.
     * 
     * @param taskAssignmentId
     *            - the id of task assignment to delete.
     */
public void deleteTaskAssignment(String taskAssignmentId) {
    try {
        LOG.debug("Deleting task(id=" + taskAssignmentId + ")");
        if (taskAssignmentId == null) {
            throw new IllegalArgumentException("Parameter 'taskAssignmentId' can not be null");
        }
        BoxTaskAssignment taskAssignment = new BoxTaskAssignment(boxConnection, taskAssignmentId);
        taskAssignment.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 : BoxTaskAssignment(com.box.sdk.BoxTaskAssignment) BoxAPIException(com.box.sdk.BoxAPIException)

Aggregations

BoxAPIException (com.box.sdk.BoxAPIException)2 BoxTaskAssignment (com.box.sdk.BoxTaskAssignment)2