mirror of https://github.com/tasks/tasks
Remove unused DAOs
parent
30c972d7dc
commit
11523d454d
@ -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);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue