Search in sources :

Example 1 with ListInfo

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

Example 2 with ListInfo

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

the class RememberTheMilkTaskService method exportTaskLists.

private TaskModelWrapper exportTaskLists(Optional<PaginationInformation> paginationInformation) throws IOException {
    List<TaskListModel> lists = new ArrayList<>();
    List<Resource> subResources = new ArrayList<>();
    for (ListInfo oldListInfo : getLists().listInfoList.lists) {
        if (oldListInfo.name.equals("All Tasks")) {
            // don't copy that over.
            continue;
        }
        lists.add(new TaskListModel(Integer.toString(oldListInfo.id), oldListInfo.name));
        subResources.add(new IdOnlyResource(Integer.toString(oldListInfo.id)));
    }
    return new TaskModelWrapper(lists, null, new ContinuationInformation(subResources, null));
}
Also used : TaskModelWrapper(org.dataportabilityproject.dataModels.tasks.TaskModelWrapper) ContinuationInformation(org.dataportabilityproject.dataModels.ContinuationInformation) ListInfo(org.dataportabilityproject.serviceProviders.rememberTheMilk.model.ListInfo) ArrayList(java.util.ArrayList) Resource(org.dataportabilityproject.dataModels.Resource) IdOnlyResource(org.dataportabilityproject.shared.IdOnlyResource) IdOnlyResource(org.dataportabilityproject.shared.IdOnlyResource) TaskListModel(org.dataportabilityproject.dataModels.tasks.TaskListModel)

Aggregations

TaskListModel (org.dataportabilityproject.dataModels.tasks.TaskListModel)2 ListInfo (org.dataportabilityproject.serviceProviders.rememberTheMilk.model.ListInfo)2 ArrayList (java.util.ArrayList)1 ContinuationInformation (org.dataportabilityproject.dataModels.ContinuationInformation)1 Resource (org.dataportabilityproject.dataModels.Resource)1 TaskModel (org.dataportabilityproject.dataModels.tasks.TaskModel)1 TaskModelWrapper (org.dataportabilityproject.dataModels.tasks.TaskModelWrapper)1 TaskSeries (org.dataportabilityproject.serviceProviders.rememberTheMilk.model.TaskSeries)1 IdOnlyResource (org.dataportabilityproject.shared.IdOnlyResource)1