use of com.box.sdk.BoxTask in project camel by apache.
the class BoxTasksManager method addFileTask.
/**
* Add task to file.
*
* @param fileId
* - the id of file to add task to.
* @param action
* - the action the task assignee will be prompted to do.
* @param dueAt
* - - the day at which this task is due.
* @param message
* - an optional message to include with the task.
* @return The new task.
*/
public BoxTask addFileTask(String fileId, BoxTask.Action action, Date dueAt, String message) {
try {
LOG.debug("Adding task to file(id=" + fileId + ") to '" + message + "'");
if (fileId == null) {
throw new IllegalArgumentException("Parameter 'fileId' can not be null");
}
if (action == null) {
throw new IllegalArgumentException("Parameter 'action' can not be null");
}
if (dueAt == null) {
throw new IllegalArgumentException("Parameter 'dueAt' can not be null");
}
BoxFile fileToAddTaskOn = new BoxFile(boxConnection, fileId);
return (BoxTask) fileToAddTaskOn.addTask(action, message, dueAt).getResource();
} catch (BoxAPIException e) {
throw new RuntimeException(String.format("Box API returned the error code %d\n\n%s", e.getResponseCode(), e.getResponse()), e);
}
}
Aggregations