Remove unused TaskAttachment columns

pull/189/head
Alex Baker 10 years ago
parent 9e7162bb2b
commit 54fdd2606b

@ -9,7 +9,6 @@ package com.todoroo.astrid.data;
import android.content.ContentValues;
import com.todoroo.andlib.data.Property;
import com.todoroo.andlib.data.Property.IntegerProperty;
import com.todoroo.andlib.data.Property.LongProperty;
import com.todoroo.andlib.data.Property.StringProperty;
import com.todoroo.andlib.data.Table;
@ -39,10 +38,6 @@ public final class TaskAttachment extends RemoteModel {
public static final StringProperty UUID = new StringProperty(
TABLE, UUID_PROPERTY_NAME);
/** Pushed at date */
public static final LongProperty PUSHED_AT = new LongProperty(
TABLE, PUSHED_AT_PROPERTY_NAME);
/** Task uuid */
public static final StringProperty TASK_UUID = new StringProperty(
TABLE, "task_id");
@ -51,26 +46,14 @@ public final class TaskAttachment extends RemoteModel {
public static final StringProperty NAME = new StringProperty(
TABLE, "name");
/** File url (for downloading) */
public static final StringProperty URL = new StringProperty(
TABLE, "url");
/** File path (on local storage) */
public static final StringProperty FILE_PATH = new StringProperty(
TABLE, "path");
/** File size (in bytes) */
public static final IntegerProperty SIZE = new IntegerProperty(
TABLE, "size");
/** File mimetype */
public static final StringProperty CONTENT_TYPE = new StringProperty(
TABLE, "content_type");
/** Attachment creation date */
public static final LongProperty CREATED_AT = new LongProperty(
TABLE, "created_at", Property.PROP_FLAG_DATE);
/** Attachment deletion date */
public static final LongProperty DELETED_AT = new LongProperty(
TABLE, "deleted_at", Property.PROP_FLAG_DATE);
@ -84,15 +67,10 @@ public final class TaskAttachment extends RemoteModel {
private static final ContentValues defaultValues = new ContentValues();
static {
defaultValues.put(UUID.name, NO_UUID);
defaultValues.put(PUSHED_AT.name, 0);
defaultValues.put(TASK_UUID.name, NO_UUID);
defaultValues.put(NAME.name, "");
defaultValues.put(URL.name, "");
defaultValues.put(FILE_PATH.name, "");
defaultValues.put(SIZE.name, 0);
defaultValues.put(CONTENT_TYPE.name, "");
defaultValues.put(CREATED_AT.name, 0);
defaultValues.put(DELETED_AT.name, 0);
}
@ -134,7 +112,6 @@ public final class TaskAttachment extends RemoteModel {
attachment.setName(fileName);
attachment.setFilePath(filePath);
attachment.setContentType(fileType);
attachment.setCreatedAt(DateUtilities.now());
attachment.setDeletedAt(0L);
return attachment;
}
@ -167,10 +144,6 @@ public final class TaskAttachment extends RemoteModel {
setValue(DELETED_AT, deletedAt);
}
public void setCreatedAt(Long createdAt) {
setValue(CREATED_AT, createdAt);
}
public void setTaskUUID(String taskUuid) {
setValue(TASK_UUID, taskUuid);
}

@ -146,10 +146,7 @@ public class NameMaps {
putTaskAttachmentPropertyToServerName(TaskAttachment.UUID, "uuid", false);
putTaskAttachmentPropertyToServerName(TaskAttachment.TASK_UUID, "task_id", true);
putTaskAttachmentPropertyToServerName(TaskAttachment.NAME, "name", false);
putTaskAttachmentPropertyToServerName(TaskAttachment.URL, "url", false);
putTaskAttachmentPropertyToServerName(TaskAttachment.SIZE, "size", false);
putTaskAttachmentPropertyToServerName(TaskAttachment.CONTENT_TYPE, "content_type", false);
putTaskAttachmentPropertyToServerName(TaskAttachment.CREATED_AT, "created_at", true);
putTaskAttachmentPropertyToServerName(TaskAttachment.DELETED_AT, "deleted_at", true);
}

@ -117,13 +117,10 @@ public class FilesControlSet extends PopupControlSet {
File f = new File(m.getFilePath());
if (!f.exists()) {
m.setFilePath(""); //$NON-NLS-1$
if (m.containsNonNullValue(TaskAttachment.URL)) { // We're ok, just the local file was deleted
taskAttachmentDao.saveExisting(m);
} else { // No local file and no url -- delete the metadata
taskAttachmentDao.delete(m.getId());
files.remove(i);
i--;
}
// No local file and no url -- delete the metadata
taskAttachmentDao.delete(m.getId());
files.remove(i);
i--;
}
}

Loading…
Cancel
Save