use of com.cmput301w18t05.taskzilla.AppCache in project Taskzilla by CMPUT301W18T05.
the class GetTaskRequest method executeOffline.
/**
* get the tasks with this id in the app cache
*/
@Override
public void executeOffline() {
executedOffline = false;
AppCache appCache = AppCache.getInstance();
result = appCache.findCachedTaskById(taskId);
}
use of com.cmput301w18t05.taskzilla.AppCache 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.AppCache in project Taskzilla by CMPUT301W18T05.
the class GetUserRequest method executeOffline.
/**
* search for users with this id in the app cache.
*/
@Override
public void executeOffline() {
executedOffline = true;
AppCache appCache = AppCache.getInstance();
result = appCache.findCachedUserByUserid(userId);
}