Search in sources :

Example 1 with TaskSeries

use of org.dataportabilityproject.serviceProviders.rememberTheMilk.model.TaskSeries 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)

Example 2 with TaskSeries

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

the class RememberTheMilkTaskService method importItem.

@Override
public void importItem(TaskModelWrapper wrapper) throws IOException {
    String timeline = createTimeline();
    for (TaskListModel taskList : wrapper.getLists()) {
        ListInfo listInfo = createTaskList(taskList.getName(), timeline);
        jobDataCache.store(taskList.getId(), listInfo.id);
    }
    for (TaskModel task : wrapper.getTasks()) {
        int newList = jobDataCache.getData(task.getTaskListId(), Integer.class);
        TaskSeries addedTask = createTask(task.getText(), timeline, newList);
    // TODO add note here
    }
}
Also used : ListInfo(org.dataportabilityproject.serviceProviders.rememberTheMilk.model.ListInfo) TaskSeries(org.dataportabilityproject.serviceProviders.rememberTheMilk.model.TaskSeries) TaskListModel(org.dataportabilityproject.dataModels.tasks.TaskListModel) TaskModel(org.dataportabilityproject.dataModels.tasks.TaskModel)

Aggregations

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