use of com.cmput301w18t05.taskzilla.Task in project Taskzilla by CMPUT301W18T05.
the class AddTaskRequest method executeOffline.
/**
* add the task into the appcache for offline viewing.
*/
@Override
public void executeOffline() {
AppCache appCache = AppCache.getInstance();
appCache.addInCache(taskData);
executedOffline = true;
}
use of com.cmput301w18t05.taskzilla.Task in project Taskzilla by CMPUT301W18T05.
the class GetTasksByRequesterUsernameRequest method executeOffline.
/**
* search through the app cache for tasks with this username
*/
@Override
public void executeOffline() {
if (executedOfflineOnce) {
result = new ArrayList<>();
return;
}
executedOfflineOnce = true;
System.out.println("Searching for tasks by requester username with username: " + user);
executedOffline = true;
AppCache appCache = AppCache.getInstance();
ArrayList<Task> cachedTasks = appCache.getCachedTasks();
this.result = new ArrayList<>();
for (Task t : cachedTasks) {
System.out.println("Looking at task: " + t);
System.out.println("Looking at task with taskrequester uname: " + t.getTaskRequester().getUsername());
if (t.getTaskRequester().getUsername().equals(user)) {
System.out.println("Adding this to result");
result.add(t);
}
}
}
use of com.cmput301w18t05.taskzilla.Task in project Taskzilla by CMPUT301W18T05.
the class ProfileController method getNumberOfTasksDone.
/**
* getNumberOfTasksDone
* get the number of tasks that the user
* has provided and completed for another user
*
* @param username
* @return number of tasks done by the user
*/
public String getNumberOfTasksDone(String username) {
requestTasksProvider = new GetTasksByProviderUsernameRequest(username);
RequestManager.getInstance().invokeRequest(ctx, requestTasksProvider);
taskList = new ArrayList<Task>();
this.taskList.addAll(requestTasksProvider.getResult());
tasksDone = 0;
for (Task task : taskList) {
if (task.getStatus().equals("Completed")) {
tasksDone++;
}
}
while (taskList.size() > 0 && taskList != null) {
taskList.clear();
RequestManager.getInstance().invokeRequest(ctx, requestTasksProvider);
this.taskList.addAll(requestTasksProvider.getResult());
for (Task task : taskList) {
if (task.getStatus().equals("Completed")) {
tasksDone++;
}
}
}
return Integer.toString(tasksDone);
}
use of com.cmput301w18t05.taskzilla.Task in project Taskzilla by CMPUT301W18T05.
the class ViewTaskController method RemoveTaskRequest.
public void RemoveTaskRequest(Task task) {
RemoveTaskRequest request = new RemoveTaskRequest(task.getId());
RequestManager.getInstance().invokeRequest(ctx, request);
}
Aggregations