mirror of https://github.com/tasks/tasks
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
117 lines
3.1 KiB
Java
117 lines
3.1 KiB
Java
/**
|
|
* See the file "LICENSE" for the full license governing this code.
|
|
*/
|
|
package com.todoroo.astrid.data;
|
|
|
|
|
|
import android.content.ContentValues;
|
|
import android.net.Uri;
|
|
|
|
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;
|
|
import com.todoroo.andlib.data.TodorooCursor;
|
|
import com.todoroo.astrid.api.AstridApiConstants;
|
|
|
|
/**
|
|
* Data Model which represents a piece of metadata associated with a task
|
|
*
|
|
* @author Tim Su <tim@todoroo.com>
|
|
*
|
|
*/
|
|
@SuppressWarnings("nls")
|
|
public class Metadata extends AbstractModel {
|
|
|
|
// --- table
|
|
|
|
/** table for this model */
|
|
public static final Table TABLE = new Table("metadata", Metadata.class);
|
|
|
|
/** content uri for this model */
|
|
public static final Uri CONTENT_URI = Uri.parse("content://" + AstridApiConstants.PACKAGE + "/" +
|
|
TABLE.name);
|
|
|
|
// --- properties
|
|
|
|
/** ID */
|
|
public static final LongProperty ID = new LongProperty(
|
|
TABLE, ID_PROPERTY_NAME);
|
|
|
|
/** Associated Task */
|
|
public static final LongProperty TASK = new LongProperty(
|
|
TABLE, "task");
|
|
|
|
/** Metadata Key */
|
|
public static final StringProperty KEY = new StringProperty(
|
|
TABLE, "key");
|
|
|
|
/** Metadata Text Value Column 1 */
|
|
public static final StringProperty VALUE1 = new StringProperty(
|
|
TABLE, "value");
|
|
|
|
/** Metadata Text Value Column 2 */
|
|
public static final StringProperty VALUE2 = new StringProperty(
|
|
TABLE, "value2");
|
|
|
|
/** Metadata Text Value Column 3 */
|
|
public static final StringProperty VALUE3 = new StringProperty(
|
|
TABLE, "value3");
|
|
|
|
/** Metadata Text Value Column 4 */
|
|
public static final StringProperty VALUE4 = new StringProperty(
|
|
TABLE, "value4");
|
|
|
|
/** Metadata Text Value Column 5 */
|
|
public static final StringProperty VALUE5 = new StringProperty(
|
|
TABLE, "value5");
|
|
|
|
/** Unixtime Metadata was created */
|
|
public static final LongProperty CREATION_DATE = new LongProperty(
|
|
TABLE, "created");
|
|
|
|
/** List of all properties for this model */
|
|
public static final Property<?>[] PROPERTIES = generateProperties(Metadata.class);
|
|
|
|
// --- defaults
|
|
|
|
/** Default values container */
|
|
private static final ContentValues defaultValues = new ContentValues();
|
|
|
|
@Override
|
|
public ContentValues getDefaultValues() {
|
|
return defaultValues;
|
|
}
|
|
|
|
// --- data access boilerplate
|
|
|
|
public Metadata() {
|
|
super();
|
|
}
|
|
|
|
public Metadata(TodorooCursor<Metadata> cursor) {
|
|
this();
|
|
readPropertiesFromCursor(cursor);
|
|
}
|
|
|
|
public void readFromCursor(TodorooCursor<Metadata> cursor) {
|
|
super.readPropertiesFromCursor(cursor);
|
|
}
|
|
|
|
@Override
|
|
public long getId() {
|
|
return getIdHelper(ID);
|
|
};
|
|
|
|
// --- parcelable helpers
|
|
|
|
private static final Creator<Metadata> CREATOR = new ModelCreator<Metadata>(Metadata.class);
|
|
|
|
@Override
|
|
protected Creator<? extends AbstractModel> getCreator() {
|
|
return CREATOR;
|
|
}
|
|
|
|
}
|