More getter/setters

* TagData
* StoreObject
* Missed some metadata fields
pull/120/head
Alex Baker 11 years ago
parent 5591eca34c
commit 139119ce76

@ -329,7 +329,7 @@ public abstract class AbstractModel implements Parcelable, Cloneable {
/**
* Merges content values with those coming from another source
*/
public synchronized <TYPE> void mergeWith(ContentValues other) {
public synchronized void mergeWith(ContentValues other) {
if (setValues == null) {
setValues = new ContentValues();
}
@ -340,7 +340,7 @@ public abstract class AbstractModel implements Parcelable, Cloneable {
* Merges set values with those coming from another source,
* keeping the existing value if one already exists
*/
public synchronized <TYPE> void mergeWithoutReplacement(ContentValues other) {
public synchronized void mergeWithoutReplacement(ContentValues other) {
if (setValues == null) {
setValues = new ContentValues();
}

@ -162,7 +162,7 @@ public class DatabaseDao<TYPE extends AbstractModel> {
* Example (updates "joe" => "bob" in metadata value1):
* {code}
* Metadata item = new Metadata();
* item.setValue(Metadata.VALUE1, "bob");
* item.setVALUE1("bob");
* update(item, Metadata.VALUE1.eq("joe"));
* {code}
* @param where sql criteria

@ -154,4 +154,20 @@ public class Metadata extends AbstractModel {
public void setKey(String key) {
setValue(KEY, key);
}
public void setValue1(String value1) {
setValue(VALUE1, value1);
}
public void setValue2(String value2) {
setValue(VALUE2, value2);
}
public void setValue3(String value3) {
setValue(VALUE3, value3);
}
public void setValue4(String value4) {
setValue(VALUE4, value4);
}
}

@ -96,4 +96,12 @@ public class StoreObject extends AbstractModel {
// --- parcelable helpers
private static final Creator<StoreObject> CREATOR = new ModelCreator<>(StoreObject.class);
public String getType() {
return getValue(TYPE);
}
public void setType(String type) {
setValue(TYPE, type);
}
}

@ -76,4 +76,20 @@ public class TagMetadata extends AbstractModel {
// --- parcelable helpers
private static final Creator<TagMetadata> CREATOR = new ModelCreator<>(TagMetadata.class);
public void setKey(String key) {
setValue(KEY, key);
}
public void setTagUUID(String tagUuid) {
setValue(TAG_UUID, tagUuid);
}
public void setTagID(Long tagId) {
setValue(TAG_ID, tagId);
}
public void setDeletionDate(Long deletionDate) {
setValue(DELETION_DATE, deletionDate);
}
}

@ -471,10 +471,10 @@ public class TasksXmlImporter {
Metadata metadata = new Metadata();
metadata.setTask(currentTask.getId());
metadata.setValue(Metadata.VALUE1, (listId));
metadata.setValue(Metadata.VALUE2, (taskSeriesId));
metadata.setValue(Metadata.VALUE3, (taskId));
metadata.setValue(Metadata.VALUE4, syncOnComplete ? "1" : "0"); //$NON-NLS-1$ //$NON-NLS-2$
metadata.setValue1(listId);
metadata.setValue2(taskSeriesId);
metadata.setValue3(taskId);
metadata.setValue4(syncOnComplete ? "1" : "0"); //$NON-NLS-1$ //$NON-NLS-2$
metadataService.save(metadata);
}
}

@ -70,7 +70,7 @@ public class SavedFilter {
}
// populate saved filter properties
storeObject.setValue(StoreObject.TYPE, TYPE);
storeObject.setType(TYPE);
storeObject.setValue(NAME, title);
storeObject.setValue(SQL, sql);

@ -69,7 +69,7 @@ public class TagMetadataDao extends DatabaseDao<TagMetadata> {
public void createMemberLink(long tagId, String tagUuid, String memberId, boolean removedMember) {
TagMetadata newMetadata = TagMemberMetadata.newMemberMetadata(tagId, tagUuid, memberId);
if (removedMember) {
newMetadata.setValue(TagMetadata.DELETION_DATE, DateUtilities.now());
newMetadata.setDeletionDate(DateUtilities.now());
}
if (update(Criterion.and(TagMetadataCriteria.byTagAndWithKey(tagUuid, TagMemberMetadata.KEY),
TagMemberMetadata.USER_UUID.eq(memberId)), newMetadata) <= 0) {
@ -79,8 +79,8 @@ public class TagMetadataDao extends DatabaseDao<TagMetadata> {
public void removeMemberLink(long tagId, String tagUuid, String memberId) {
TagMetadata deleteTemplate = new TagMetadata();
deleteTemplate.setValue(TagMetadata.TAG_ID, tagId); // Need this for recording changes in outstanding table
deleteTemplate.setValue(TagMetadata.DELETION_DATE, DateUtilities.now());
deleteTemplate.setTagID(tagId); // Need this for recording changes in outstanding table
deleteTemplate.setDeletionDate(DateUtilities.now());
deleteTemplate.setValue(TagMemberMetadata.USER_UUID, memberId); // Need this for recording changes in outstanding table
update(Criterion.and(TagMetadataCriteria.withKey(TagMemberMetadata.KEY), TagMetadata.DELETION_DATE.eq(0),

@ -99,7 +99,7 @@ public class GtasksListService {
local = new StoreObject();
}
local.setValue(StoreObject.TYPE, GtasksList.TYPE);
local.setType(GtasksList.TYPE);
local.setValue(GtasksList.REMOTE_ID, id);
local.setValue(GtasksList.NAME, remote.getTitle());
local.setValue(GtasksList.ORDER, i);
@ -128,7 +128,7 @@ public class GtasksListService {
}
StoreObject local = new StoreObject();
local.setValue(StoreObject.TYPE, GtasksList.TYPE);
local.setType(GtasksList.TYPE);
local.setValue(GtasksList.REMOTE_ID, newList.getId());
local.setValue(GtasksList.NAME, newList.getTitle());

@ -199,7 +199,7 @@ public class GtasksSyncV2Provider extends SyncV2Provider {
return;
}
final StoreObject gtasksList = (StoreObject) list;
if (!GtasksList.TYPE.equals(gtasksList.getValue(StoreObject.TYPE))) {
if (!GtasksList.TYPE.equals(gtasksList.getType())) {
return;
}

@ -279,7 +279,7 @@ public class TaskService {
* Example (updates "joe" => "bob" in metadata value1):
* {code}
* Metadata item = new Metadata();
* item.setValue(Metadata.VALUE1, "bob");
* item.setVALUE1("bob");
* update(item, Metadata.VALUE1.eq("joe"));
* {code}
* @param where sql criteria

@ -12,11 +12,11 @@ public class TagMemberMetadata {
public static TagMetadata newMemberMetadata(long tagId, String tagUuid, String userUuid) {
TagMetadata m = new TagMetadata();
m.setValue(TagMetadata.KEY, KEY);
m.setValue(TagMetadata.TAG_ID, tagId);
m.setValue(TagMetadata.TAG_UUID, tagUuid);
m.setKey(KEY);
m.setTagID(tagId);
m.setTagUUID(tagUuid);
m.setValue(USER_UUID, userUuid);
m.setValue(TagMetadata.DELETION_DATE, 0L);
m.setDeletionDate(0L);
return m;
}
}

Loading…
Cancel
Save