use of com.cmput301w18t05.taskzilla.AppCache in project Taskzilla by CMPUT301W18T05.
the class GetBidsByTaskIdRequest method executeOffline.
/**
* search through bids in app cache
*/
@Override
public void executeOffline() {
executedOffline = false;
AppCache appCache = AppCache.getInstance();
result = appCache.findCachedBidsByTaskid(taskId);
}
use of com.cmput301w18t05.taskzilla.AppCache in project Taskzilla by CMPUT301W18T05.
the class GetAllTasksRequest method executeOffline.
/**
* get all the tasks from the app cache
*/
@Override
public void executeOffline() {
// return what is in app cache
if (executedOfflineOnce) {
// prevent infinite loop
result = new ArrayList<Task>();
return;
}
AppCache appCache = AppCache.getInstance();
result = appCache.getCachedTasks();
executedOfflineOnce = true;
}
use of com.cmput301w18t05.taskzilla.AppCache in project Taskzilla by CMPUT301W18T05.
the class GetBidsByUserIdRequest method executeOffline.
/**
* search through bids in app cache
*/
@Override
public void executeOffline() {
executedOffline = true;
AppCache appCache = AppCache.getInstance();
result = appCache.findCachedBidsByUserid(userId);
}
use of com.cmput301w18t05.taskzilla.AppCache in project Taskzilla by CMPUT301W18T05.
the class GetTasksByProviderUsernameRequest method executeOffline.
/**
* search through tasks in the app cache
* Also add the found tasks to the app cache
*/
@Override
public void executeOffline() {
if (executedOffline) {
result = new ArrayList<>();
return;
}
executedOffline = true;
AppCache appCache = AppCache.getInstance();
ArrayList<Task> cachedTasks = appCache.getCachedTasks();
result = new ArrayList<>();
for (Task t : cachedTasks) {
if (t.getTaskProvider().getUsername() != null && t.getTaskProvider().equals(user)) {
result.add(t);
}
}
}
use of com.cmput301w18t05.taskzilla.AppCache 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;
}