use of com.box.sdk.BoxTask in project camel by apache.
the class BoxTasksManager method deleteTask.
/**
* Delete task.
*
* @param taskId
* - the id of task to delete.
*/
public void deleteTask(String taskId) {
try {
LOG.debug("Deleting task(id=" + taskId + ")");
if (taskId == null) {
throw new IllegalArgumentException("Parameter 'taskId' can not be null");
}
BoxTask task = new BoxTask(boxConnection, taskId);
task.delete();
} catch (BoxAPIException e) {
throw new RuntimeException(String.format("Box API returned the error code %d\n\n%s", e.getResponseCode(), e.getResponse()), e);
}
}
use of com.box.sdk.BoxTask in project camel by apache.
the class BoxTasksManager method addAssignmentToTask.
/**
* Add assignment for task.
*
* @param taskId
* - the id of task to add assignment for.
* @param assignTo
* - the user to assign to task.
* @return The assigned task.
*/
// compiler for some reason thinks 'if (assignTo
@SuppressWarnings("unused")
public // == null)' clause is dead code.
BoxTask addAssignmentToTask(String taskId, BoxUser assignTo) {
try {
LOG.debug("Assigning task(id=" + taskId + ") to user(id=" + assignTo.getID() + ")");
if (taskId == null) {
throw new IllegalArgumentException("Parameter 'commentId' can not be null");
}
if (assignTo == null) {
throw new IllegalArgumentException("Parameter 'assignTo' can not be null");
}
BoxTask task = new BoxTask(boxConnection, taskId);
task.addAssignment(assignTo);
return task;
} catch (BoxAPIException e) {
throw new RuntimeException(String.format("Box API returned the error code %d\n\n%s", e.getResponseCode(), e.getResponse()), e);
}
}
use of com.box.sdk.BoxTask in project camel by apache.
the class BoxTasksManager method getTaskAssignments.
/**
* Get a list of any assignments for task.
*
* @param taskId
* - the id of task.
* @return The list of assignments for task.
*/
public List<BoxTaskAssignment.Info> getTaskAssignments(String taskId) {
try {
LOG.debug("Getting assignments for task(id=" + taskId + ")");
if (taskId == null) {
throw new IllegalArgumentException("Parameter 'taskId' can not be null");
}
BoxTask file = new BoxTask(boxConnection, taskId);
return file.getAssignments();
} catch (BoxAPIException e) {
throw new RuntimeException(String.format("Box API returned the error code %d\n\n%s", e.getResponseCode(), e.getResponse()), e);
}
}
use of com.box.sdk.BoxTask in project camel by apache.
the class BoxTasksManager method getTaskInfo.
/**
* Get task information.
*
* @param taskId
* - the id of task.
* @return The task information.
*/
public BoxTask.Info getTaskInfo(String taskId) {
try {
LOG.debug("Getting info for task(id=" + taskId + ")");
if (taskId == null) {
throw new IllegalArgumentException("Parameter 'taskId' can not be null");
}
BoxTask task = new BoxTask(boxConnection, taskId);
return task.getInfo();
} catch (BoxAPIException e) {
throw new RuntimeException(String.format("Box API returned the error code %d\n\n%s", e.getResponseCode(), e.getResponse()), e);
}
}
use of com.box.sdk.BoxTask in project camel by apache.
the class BoxTasksManager method updateTaskInfo.
/**
* Update task information.
*
* @param taskId
* - the id of task.
* @param info
* - the updated information
* @return The updated task.
*/
public BoxTask updateTaskInfo(String taskId, BoxTask.Info info) {
try {
LOG.debug("Updating info for task(id=" + taskId + ")");
if (taskId == null) {
throw new IllegalArgumentException("Parameter 'taskId' can not be null");
}
if (info == null) {
throw new IllegalArgumentException("Parameter 'info' can not be null");
}
BoxTask task = new BoxTask(boxConnection, taskId);
task.updateInfo(info);
return task;
} catch (BoxAPIException e) {
throw new RuntimeException(String.format("Box API returned the error code %d\n\n%s", e.getResponseCode(), e.getResponse()), e);
}
}
Aggregations