mirror of https://github.com/tasks/tasks
Forgot to add dao files
parent
f3d7b1958c
commit
abc741b293
@ -0,0 +1,63 @@
|
||||
package com.todoroo.astrid.data;
|
||||
|
||||
import android.content.ContentValues;
|
||||
|
||||
import com.todoroo.andlib.data.AbstractModel;
|
||||
import com.todoroo.andlib.data.Property;
|
||||
import com.todoroo.andlib.data.Property.LongProperty;
|
||||
import com.todoroo.andlib.data.Property.StringProperty;
|
||||
import com.todoroo.andlib.data.Table;
|
||||
|
||||
@SuppressWarnings("nls")
|
||||
public class TaskAttachmentOutstanding extends OutstandingEntry<TaskAttachment> {
|
||||
|
||||
/** table for this model */
|
||||
public static final Table TABLE = new Table("task_attachment_outstanding", TaskAttachmentOutstanding.class);
|
||||
|
||||
// --- properties
|
||||
|
||||
/** ID */
|
||||
public static final LongProperty ID = new LongProperty(
|
||||
TABLE, ID_PROPERTY_NAME);
|
||||
|
||||
public static final LongProperty TASK_ATTACHMENT_ID = new LongProperty(
|
||||
TABLE, ENTITY_ID_PROPERTY_NAME);
|
||||
|
||||
public static final StringProperty COLUMN_STRING = new StringProperty(
|
||||
TABLE, COLUMN_STRING_PROPERTY_NAME);
|
||||
|
||||
public static final StringProperty VALUE_STRING = new StringProperty(
|
||||
TABLE, VALUE_STRING_PROPERTY_NAME);
|
||||
|
||||
public static final LongProperty CREATED_AT = new LongProperty(
|
||||
TABLE, CREATED_AT_PROPERTY_NAME);
|
||||
|
||||
private static final ContentValues defaultValues = new ContentValues();
|
||||
|
||||
static {
|
||||
defaultValues.put(TASK_ATTACHMENT_ID.name, 0);
|
||||
defaultValues.put(COLUMN_STRING.name, "");
|
||||
defaultValues.put(VALUE_STRING.name, "");
|
||||
}
|
||||
|
||||
/** List of all properties for this model */
|
||||
public static final Property<?>[] PROPERTIES = generateProperties(TaskAttachmentOutstanding.class);
|
||||
|
||||
@Override
|
||||
public ContentValues getDefaultValues() {
|
||||
return defaultValues;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getId() {
|
||||
return getIdHelper(ID);
|
||||
}
|
||||
|
||||
public static final Creator<TaskAttachmentOutstanding> CREATOR = new ModelCreator<TaskAttachmentOutstanding>(TaskAttachmentOutstanding.class);
|
||||
|
||||
@Override
|
||||
protected Creator<? extends AbstractModel> getCreator() {
|
||||
return CREATOR;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
/**
|
||||
* 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.andlib.sql.Criterion;
|
||||
import com.todoroo.astrid.actfm.sync.messages.NameMaps;
|
||||
import com.todoroo.astrid.data.TagData;
|
||||
import com.todoroo.astrid.data.TaskAttachment;
|
||||
|
||||
/**
|
||||
* Data Access layer for {@link TagData}-related operations.
|
||||
*
|
||||
* @author Tim Su <tim@todoroo.com>
|
||||
*
|
||||
*/
|
||||
public class TaskAttachmentDao extends RemoteModelDao<TaskAttachment> {
|
||||
|
||||
@Autowired Database database;
|
||||
|
||||
@edu.umd.cs.findbugs.annotations.SuppressWarnings(value="UR_UNINIT_READ")
|
||||
public TaskAttachmentDao() {
|
||||
super(TaskAttachment.class);
|
||||
DependencyInjectionService.getInstance().inject(this);
|
||||
setDatabase(database);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldRecordOutstandingEntry(String columnName) {
|
||||
return NameMaps.shouldRecordOutstandingColumnForTable(NameMaps.TABLE_ID_ATTACHMENTS, columnName);
|
||||
}
|
||||
|
||||
// --- SQL clause generators
|
||||
|
||||
/**
|
||||
* Generates SQL clauses
|
||||
*/
|
||||
public static class TagDataCriteria {
|
||||
|
||||
/** @returns tasks by id */
|
||||
public static Criterion byId(long id) {
|
||||
return TagData.ID.eq(id);
|
||||
}
|
||||
|
||||
public static Criterion isTeam() {
|
||||
return TagData.IS_TEAM.eq(1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,12 @@
|
||||
package com.todoroo.astrid.dao;
|
||||
|
||||
import com.todoroo.astrid.data.TaskAttachmentOutstanding;
|
||||
|
||||
|
||||
public class TaskAttachmentOutstandingDao extends OutstandingEntryDao<TaskAttachmentOutstanding> {
|
||||
|
||||
public TaskAttachmentOutstandingDao() {
|
||||
super(TaskAttachmentOutstanding.class);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue