Search in sources :

Example 6 with AppCache

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);
}
Also used : AppCache(com.cmput301w18t05.taskzilla.AppCache)

Example 7 with AppCache

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);
        }
    }
}
Also used : Task(com.cmput301w18t05.taskzilla.Task) AppCache(com.cmput301w18t05.taskzilla.AppCache)

Example 8 with AppCache

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);
}
Also used : AppCache(com.cmput301w18t05.taskzilla.AppCache)

Aggregations

AppCache (com.cmput301w18t05.taskzilla.AppCache)8 Task (com.cmput301w18t05.taskzilla.Task)3