TaskCommand<?> cmd = null;
if ("activate".equalsIgnoreCase(operation)) {
cmd = new ActivateTaskCommand(taskId, userId);
} else if ("claim".equalsIgnoreCase(operation)) {
cmd = new ClaimTaskCommand(taskId, userId);
} else if ("claimnextavailable".equalsIgnoreCase(operation)) {
cmd = new ClaimNextAvailableTaskCommand(userId);
} else if ("complete".equalsIgnoreCase(operation)) {
Map<String, Object> data = extractMapFromParams(params, operation);
cmd = new CompleteTaskCommand(taskId, userId, data);