Search in sources :

Example 1 with GetListResponse

use of org.dataportabilityproject.serviceProviders.rememberTheMilk.model.GetListResponse in project data-transfer-project by google.

the class RememberTheMilkTaskService method exportTaskList.

private TaskModelWrapper exportTaskList(Resource resource, Optional<PaginationInformation> paginationInformation) throws IOException {
    int oldListId = Integer.parseInt(((IdOnlyResource) resource).getId());
    GetListResponse oldList = getList(oldListId);
    List<TaskList> taskLists = oldList.tasks.list;
    List<TaskModel> tasks = new ArrayList<>();
    for (TaskList taskList : taskLists) {
        if (taskList.taskSeriesList != null) {
            for (TaskSeries taskSeries : taskList.taskSeriesList) {
                tasks.add(new TaskModel(Integer.toString(oldListId), taskSeries.name, taskSeries.notes.toString()));
                for (Task task : taskSeries.tasks) {
                // Do something here with completion date, but its odd there can be more than one.
                }
            }
        }
    }
    return new TaskModelWrapper(null, tasks, null);
}
Also used : GetListResponse(org.dataportabilityproject.serviceProviders.rememberTheMilk.model.GetListResponse) TaskModelWrapper(org.dataportabilityproject.dataModels.tasks.TaskModelWrapper) Task(org.dataportabilityproject.serviceProviders.rememberTheMilk.model.Task) TaskList(org.dataportabilityproject.serviceProviders.rememberTheMilk.model.TaskList) ArrayList(java.util.ArrayList) TaskSeries(org.dataportabilityproject.serviceProviders.rememberTheMilk.model.TaskSeries) TaskModel(org.dataportabilityproject.dataModels.tasks.TaskModel)

Aggregations

ArrayList (java.util.ArrayList)1 TaskModel (org.dataportabilityproject.dataModels.tasks.TaskModel)1 TaskModelWrapper (org.dataportabilityproject.dataModels.tasks.TaskModelWrapper)1 GetListResponse (org.dataportabilityproject.serviceProviders.rememberTheMilk.model.GetListResponse)1 Task (org.dataportabilityproject.serviceProviders.rememberTheMilk.model.Task)1 TaskList (org.dataportabilityproject.serviceProviders.rememberTheMilk.model.TaskList)1 TaskSeries (org.dataportabilityproject.serviceProviders.rememberTheMilk.model.TaskSeries)1