}
case GetTaskRequest: {
response = CommandName.GetTaskResponse;
long taskId = (Long) cmd.getArguments().get(0);
Task task = taskSession.getTask(taskId);
List args = new ArrayList(1);
args.add(task);
Command resultsCmnd = new Command(cmd.getId(), CommandName.GetTaskResponse, args);
session.write(resultsCmnd);
break;
}
case AddTaskRequest: {
response = CommandName.AddTaskResponse;
Task task = (Task) cmd.getArguments().get(0);
ContentData content = (ContentData) cmd.getArguments().get(1);
taskSession.addTask(task, content);
List args = new ArrayList(1);
args.add(task.getId());
Command resultsCmnd = new Command(cmd.getId(),
CommandName.AddTaskResponse,
args);
session.write(resultsCmnd);
break;
}
case AddCommentRequest: {
response = CommandName.AddCommentResponse;
Comment comment = (Comment) cmd.getArguments().get(1);
taskSession.addComment((Long) cmd.getArguments().get(0),
comment);
List args = new ArrayList(1);
args.add(comment.getId());
Command resultsCmnd = new Command(cmd.getId(),
CommandName.AddCommentResponse,
args);
session.write(resultsCmnd);
break;
}
case DeleteCommentRequest: {
response = CommandName.DeleteCommentResponse;
long taskId = (Long) cmd.getArguments().get(0);
long commentId = (Long) cmd.getArguments().get(1);
taskSession.deleteComment(taskId,
commentId);
Command resultsCmnd = new Command(cmd.getId(),
CommandName.DeleteCommentResponse,
Collections.emptyList());
session.write(resultsCmnd);
break;
}
case AddAttachmentRequest: {
response = CommandName.AddAttachmentResponse;
Attachment attachment = (Attachment) cmd.getArguments().get(1);
Content content = (Content) cmd.getArguments().get(2);
taskSession.addAttachment((Long) cmd.getArguments().get(0),
attachment,
content);
List args = new ArrayList(2);
args.add(attachment.getId());
args.add(content.getId());
Command resultsCmnd = new Command(cmd.getId(),
CommandName.AddAttachmentResponse,
args);
session.write(resultsCmnd);
break;
}
case DeleteAttachmentRequest: {
response = CommandName.DeleteAttachmentResponse;
long taskId = (Long) cmd.getArguments().get(0);
long attachmentId = (Long) cmd.getArguments().get(1);
long contentId = (Long) cmd.getArguments().get(2);
taskSession.deleteAttachment(taskId,
attachmentId,
contentId);
Command resultsCmnd = new Command(cmd.getId(),
CommandName.DeleteAttachmentResponse,
Collections.emptyList());
session.write(resultsCmnd);
break;
}
case SetDocumentContentRequest: {
response = CommandName.SetDocumentContentResponse;
long taskId = (Long) cmd.getArguments().get(0);
Content content = (Content) cmd.getArguments().get(1);
taskSession.setDocumentContent(taskId,
content);
List args = new ArrayList(1);
args.add(content.getId());
Command resultsCmnd = new Command(cmd.getId(),
CommandName.SetDocumentContentResponse,
args);
session.write(resultsCmnd);
break;
}
case GetContentRequest: {
response = CommandName.GetContentResponse;
long contentId = (Long) cmd.getArguments().get(0);
Content content = taskSession.getContent(contentId);
List args = new ArrayList(1);
args.add(content);
Command resultsCmnd = new Command(cmd.getId(),
CommandName.GetContentResponse,
args);
session.write(resultsCmnd);
break;
}
case QueryTaskByWorkItemId: {
response = CommandName.QueryTaskByWorkItemIdResponse;
Task result = taskSession.getTaskByWorkItemId((Long) cmd.getArguments().get(0));
List args = new ArrayList(1);
args.add(result);
Command resultsCmnd = new Command(cmd.getId(),
CommandName.QueryTaskByWorkItemIdResponse,
args);