Search in sources :

Example 1 with AppCache

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

Example 2 with AppCache

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

Example 3 with AppCache

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

Example 4 with AppCache

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

Example 5 with AppCache

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

Aggregations

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