Remove unused DAOs

pull/46/head
Alex Baker 11 years ago
parent 30c972d7dc
commit 11523d454d

@ -4,7 +4,6 @@ import com.todoroo.andlib.service.Autowired;
import com.todoroo.astrid.dao.MetadataDao;
import com.todoroo.astrid.dao.RemoteModelDao;
import com.todoroo.astrid.dao.TagDataDao;
import com.todoroo.astrid.dao.TagOutstandingDao;
import com.todoroo.astrid.dao.TaskDao;
import com.todoroo.astrid.dao.TaskOutstandingDao;
import com.todoroo.astrid.data.SyncFlags;
@ -20,8 +19,6 @@ public class NewSyncTestCase extends DatabaseTestCase {
@Autowired
protected TaskOutstandingDao taskOutstandingDao;
@Autowired
protected TagOutstandingDao tagOutstandingDao;
@Autowired
protected MetadataDao metadataDao;

@ -1,36 +0,0 @@
package com.todoroo.astrid.dao;
import java.lang.reflect.Field;
import com.todoroo.andlib.data.AbstractModel;
import com.todoroo.andlib.data.Property;
import com.todoroo.astrid.data.RemoteModel;
public class DaoReflectionHelpers {
public static <T> T getStaticFieldByReflection(Class<?> cls, Class<T> cast, String fieldName) {
try {
Field field = cls.getField(fieldName);
Object obj = field.get(null);
if (obj == null) {
throw new RuntimeException(fieldName + " field for class " + cls.getName() + " is null");
}
return cast.cast(obj);
} catch (NoSuchFieldException e) {
throw new RuntimeException("Class " + cls.getName() + " does not declare field " + fieldName);
} catch (IllegalAccessException e2) {
throw new RuntimeException(fieldName + " field for class " + cls.getName() + " is not accessible");
} catch (ClassCastException e3) {
throw new RuntimeException(fieldName + " field for class " + cls.getName() + " cannot be cast to type " + cast.getName());
}
}
public static Property<?>[] getModelProperties(Class<? extends AbstractModel> model) {
return getStaticFieldByReflection(model, Property[].class, "PROPERTIES");
}
public static <OE> Class<OE> getOutstandingClass(Class<? extends RemoteModel> model) {
return DaoReflectionHelpers.getStaticFieldByReflection(model, Class.class, "OUTSTANDING_MODEL");
}
}

@ -1,38 +0,0 @@
package com.todoroo.astrid.dao;
import android.content.ContentValues;
import com.todoroo.andlib.data.DatabaseDao;
import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.service.DependencyInjectionService;
import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.astrid.data.History;
public class HistoryDao extends DatabaseDao<History> {
@Autowired
private Database database;
public HistoryDao() {
super(History.class);
DependencyInjectionService.getInstance().inject(this);
setDatabase(database);
}
@Override
public boolean createNew(History item) {
if (!item.containsValue(History.CREATED_AT)) {
item.setValue(History.CREATED_AT, DateUtilities.now());
}
return super.createNew(item);
}
@Override
public boolean saveExisting(History item) {
ContentValues values = item.getSetValues();
if(values == null || values.size() == 0) {
return false;
}
return super.saveExisting(item);
}
}

@ -1,11 +0,0 @@
package com.todoroo.astrid.dao;
import com.todoroo.astrid.data.TagOutstanding;
public class TagOutstandingDao extends OutstandingEntryDao<TagOutstanding> {
public TagOutstandingDao() {
super(TagOutstanding.class);
}
}

@ -1,12 +0,0 @@
package com.todoroo.astrid.dao;
import com.todoroo.astrid.data.TaskAttachmentOutstanding;
public class TaskAttachmentOutstandingDao extends OutstandingEntryDao<TaskAttachmentOutstanding> {
public TaskAttachmentOutstandingDao() {
super(TaskAttachmentOutstanding.class);
}
}

@ -1,12 +0,0 @@
package com.todoroo.astrid.dao;
import com.todoroo.astrid.data.TaskListMetadataOutstanding;
public class TaskListMetadataOutstandingDao extends OutstandingEntryDao<TaskListMetadataOutstanding> {
public TaskListMetadataOutstandingDao() {
super(TaskListMetadataOutstanding.class);
}
}

@ -1,31 +0,0 @@
/**
* Copyright (c) 2012 Todoroo Inc
*
* See the file "LICENSE" for the full license governing this code.
*/
package com.todoroo.astrid.dao;
import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.service.DependencyInjectionService;
import com.todoroo.astrid.data.Update;
/**
* Data Access layer for {@link Update}-related operations.
*
* @author Tim Su <tim@todoroo.com>
*
*/
@Deprecated
public class UpdateDao extends RemoteModelDao<Update> {
@Autowired Database database;
public UpdateDao() {
super(Update.class);
DependencyInjectionService.getInstance().inject(this);
setDatabase(database);
}
}

@ -1,11 +0,0 @@
package com.todoroo.astrid.dao;
import com.todoroo.astrid.data.UserActivityOutstanding;
public class UserActivityOutstandingDao extends OutstandingEntryDao<UserActivityOutstanding> {
public UserActivityOutstandingDao() {
super(UserActivityOutstanding.class);
}
}

@ -11,21 +11,15 @@ import com.todoroo.andlib.service.ExceptionService.AndroidLogReporter;
import com.todoroo.andlib.service.ExceptionService.ErrorReporter;
import com.todoroo.andlib.service.HttpRestClient;
import com.todoroo.astrid.dao.Database;
import com.todoroo.astrid.dao.HistoryDao;
import com.todoroo.astrid.dao.MetadataDao;
import com.todoroo.astrid.dao.StoreObjectDao;
import com.todoroo.astrid.dao.TagDataDao;
import com.todoroo.astrid.dao.TagMetadataDao;
import com.todoroo.astrid.dao.TagOutstandingDao;
import com.todoroo.astrid.dao.TaskAttachmentDao;
import com.todoroo.astrid.dao.TaskAttachmentOutstandingDao;
import com.todoroo.astrid.dao.TaskDao;
import com.todoroo.astrid.dao.TaskListMetadataDao;
import com.todoroo.astrid.dao.TaskListMetadataOutstandingDao;
import com.todoroo.astrid.dao.TaskOutstandingDao;
import com.todoroo.astrid.dao.UpdateDao;
import com.todoroo.astrid.dao.UserActivityDao;
import com.todoroo.astrid.dao.UserActivityOutstandingDao;
import com.todoroo.astrid.dao.UserDao;
import com.todoroo.astrid.gtasks.GtasksListService;
import com.todoroo.astrid.gtasks.GtasksMetadataService;
@ -71,17 +65,11 @@ public class AstridDependencyInjector extends AbstractDependencyInjector {
injectables.put("tagMetadataDao", TagMetadataDao.class);
injectables.put("tagDataDao", TagDataDao.class);
injectables.put("storeObjectDao", StoreObjectDao.class);
injectables.put("updateDao", UpdateDao.class);
injectables.put("userActivityDao", UserActivityDao.class);
injectables.put("userDao", UserDao.class);
injectables.put("taskOutstandingDao", TaskOutstandingDao.class);
injectables.put("tagOutstandingDao", TagOutstandingDao.class);
injectables.put("userActivityOutstandingDao", UserActivityOutstandingDao.class);
injectables.put("historyDao", HistoryDao.class);
injectables.put("taskAttachmentDao", TaskAttachmentDao.class);
injectables.put("taskAttachmentOutstandingDao", TaskAttachmentOutstandingDao.class);
injectables.put("taskListMetadataDao", TaskListMetadataDao.class);
injectables.put("taskListMetadataOutstandingDao", TaskListMetadataOutstandingDao.class);
// com.todoroo.astrid.service
injectables.put("taskService", TaskService.class);

Loading…
Cancel
Save