Remove SyncContainer

pull/189/head
Alex Baker 10 years ago
parent 0a939a406d
commit 76ac572b59

@ -1,30 +0,0 @@
/**
* Copyright (c) 2012 Todoroo Inc
*
* See the file "LICENSE" for the full license governing this code.
*/
package com.todoroo.astrid.sync;
import com.todoroo.astrid.data.Metadata;
import com.todoroo.astrid.data.Task;
import java.util.ArrayList;
/**
* Container class for transmitting tasks and including local and remote
* metadata. Synchronization Providers can subclass this class if desired.
*
* @author Tim Su <tim@todoroo.com>
*
*/
public class SyncContainer {
public Task task;
public ArrayList<Metadata> metadata;
/**
* Method called when sync container is about to be saved into the database.
*/
public void prepareForSaving() {
// override me necessary
}
}

@ -38,7 +38,7 @@ import javax.inject.Singleton;
*
*/
@Singleton
public final class GtasksMetadataService extends SyncMetadataService<GtasksTaskContainer> {
public final class GtasksMetadataService extends SyncMetadataService {
@Inject
public GtasksMetadataService(TaskDao taskDao, MetadataDao metadataDao) {

@ -11,11 +11,13 @@ import com.todoroo.astrid.data.Metadata;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.gtasks.GtasksMetadata;
import com.todoroo.astrid.gtasks.api.GtasksApiUtilities;
import com.todoroo.astrid.sync.SyncContainer;
import java.util.ArrayList;
public class GtasksTaskContainer extends SyncContainer {
public class GtasksTaskContainer {
public Task task;
public ArrayList<Metadata> metadata;
public Metadata gtaskMetadata;
private final long updateTime;
@ -53,9 +55,7 @@ public class GtasksTaskContainer extends SyncContainer {
return updateTime;
}
@Override
public void prepareForSaving() {
super.prepareForSaving();
metadata.add(gtaskMetadata);
}
}

@ -13,13 +13,13 @@ import com.todoroo.astrid.dao.MetadataDao;
import com.todoroo.astrid.dao.MetadataDao.MetadataCriteria;
import com.todoroo.astrid.dao.TaskDao;
import com.todoroo.astrid.data.Metadata;
import com.todoroo.astrid.sync.SyncContainer;
import com.todoroo.astrid.gtasks.sync.GtasksTaskContainer;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Set;
abstract public class SyncMetadataService<TYPE extends SyncContainer> {
abstract public class SyncMetadataService {
protected final TaskDao taskDao;
protected final MetadataDao metadataDao;
@ -46,7 +46,7 @@ abstract public class SyncMetadataService<TYPE extends SyncContainer> {
/**
* Saves a task and its metadata
*/
public void saveTaskAndMetadata(TYPE task) {
public void saveTaskAndMetadata(GtasksTaskContainer task) {
task.prepareForSaving();
taskDao.save(task.task);
synchronizeMetadata(task.task.getId(), task.metadata, getMetadataKey());

Loading…
Cancel
Save