Add setters to replace setValues

* Task
* UserActivity
* RemoteModel
* TagData
* Metadata
* TaskListMetadata
* TaskAttachment
pull/120/head
Alex Baker 11 years ago
parent ed6382c9ce
commit 5591eca34c

@ -127,15 +127,31 @@ public class Metadata extends AbstractModel {
return getValue(DELETION_DATE);
}
public void setDeletionDate(Long deletionDate) {
setValue(DELETION_DATE, deletionDate);
}
public Long getTask() {
return getValue(TASK);
}
public void setTask(Long task) {
setValue(TASK, task);
}
public Long getCreationDate() {
return getValue(CREATION_DATE);
}
public void setCreationDate(Long creationDate) {
setValue(CREATION_DATE, creationDate);
}
public String getKey() {
return getValue(KEY);
}
public void setKey(String key) {
setValue(KEY, key);
}
}

@ -61,10 +61,6 @@ abstract public class RemoteModel extends AbstractModel {
}
}
public String getUuidProperty() {
return getValue(UUID_PROPERTY);
}
protected String getUuidHelper(StringProperty uuid) {
if(setValues != null && setValues.containsKey(uuid.name)) {
return setValues.getAsString(uuid.name);
@ -188,4 +184,12 @@ abstract public class RemoteModel extends AbstractModel {
}
}
public String getUuidProperty() {
return getValue(UUID_PROPERTY);
}
public void setUuidProperty(String uuidProperty) {
setValue(UUID_PROPERTY, uuidProperty);
}
}

@ -219,6 +219,10 @@ public final class TagData extends RemoteModel {
return getValue(NAME);
}
public void setName(String name) {
setValue(NAME, name);
}
public String getTagOrdering() {
return getValue(TAG_ORDERING);
}
@ -227,15 +231,43 @@ public final class TagData extends RemoteModel {
return getValue(LAST_AUTOSYNC);
}
public void setLastAutosync(Long lastAutosync) {
setValue(LAST_AUTOSYNC, lastAutosync);
}
public String getUUID() {
return getValue(UUID);
}
public void setUUID(String uuid) {
setValue(UUID, uuid);
}
public Integer getTaskCount() {
return getValue(TASK_COUNT);
}
public void setTaskCount(Integer taskCount) {
setValue(TASK_COUNT, taskCount);
}
public String getMembers() {
return getValue(MEMBERS);
}
public void setMembers(String members) {
setValue(MEMBERS, members);
}
public void setDeletionDate(Long deletionDate) {
setValue(DELETION_DATE, deletionDate);
}
public void setMemberCount(Integer memberCount) {
setValue(MEMBER_COUNT, memberCount);
}
public void setPicture(String picture) {
setValue(PICTURE, picture);
}
}

@ -490,14 +490,26 @@ public class Task extends RemoteModel {
return getValue(DUE_DATE);
}
public void setDueDate(Long dueDate) {
setValue(DUE_DATE, dueDate);
}
public String getRecurrence() {
return getValue(RECURRENCE);
}
public void setRecurrence(String recurrence) {
setValue(RECURRENCE, recurrence);
}
public Long getCreationDate() {
return getValue(CREATION_DATE);
}
public void setCreationDate(Long creationDate) {
setValue(CREATION_DATE, creationDate);
}
public String getUUID() {
return getValue(UUID);
}
@ -506,26 +518,50 @@ public class Task extends RemoteModel {
return getValue(TITLE);
}
public void setTitle(String title) {
setValue(TITLE, title);
}
public String getDetails() {
return getValue(DETAILS);
}
public void setDetails(String details) {
setValue(DETAILS, details);
}
public Long getDeletionDate() {
return getValue(DELETION_DATE);
}
public void setDeletionDate(Long deletionDate) {
setValue(DELETION_DATE, deletionDate);
}
public Long getHideUntil() {
return getValue(HIDE_UNTIL);
}
public void setHideUntil(Long hideUntil) {
setValue(HIDE_UNTIL, hideUntil);
}
public Long getReminderLast() {
return getValue(REMINDER_LAST);
}
public void setReminderLast(Long reminderLast) {
setValue(REMINDER_LAST, reminderLast);
}
public Long getReminderSnooze() {
return getValue(REMINDER_SNOOZE);
}
public void setReminderSnooze(Long reminderSnooze) {
setValue(REMINDER_SNOOZE, reminderSnooze);
}
public Integer getElapsedSeconds() {
return getValue(ELAPSED_SECONDS);
}
@ -534,10 +570,18 @@ public class Task extends RemoteModel {
return getValue(TIMER_START);
}
public void setTimerStart(Long timerStart) {
setValue(TIMER_START, timerStart);
}
public Long getRepeatUntil() {
return getValue(REPEAT_UNTIL);
}
public void setRepeatUntil(Long repeatUntil) {
setValue(REPEAT_UNTIL, repeatUntil);
}
public String getCalendarURI() {
return getValue(CALENDAR_URI);
}
@ -550,31 +594,83 @@ public class Task extends RemoteModel {
return getValue(IMPORTANCE);
}
public void setImportance(Integer importance) {
setValue(IMPORTANCE, importance);
}
public Long getCompletionDate() {
return getValue(COMPLETION_DATE);
}
public void setCompletionDate(Long completionDate) {
setValue(COMPLETION_DATE, completionDate);
}
public Long getDetailsDate() {
return getValue(DETAILS_DATE);
}
public void setDetailsDate(Long detailsDate) {
setValue(DETAILS_DATE, detailsDate);
}
public String getNotes() {
return getValue(NOTES);
}
public void setNotes(String notes) {
setValue(NOTES, notes);
}
public Long getModificationDate() {
return getValue(MODIFICATION_DATE);
}
public void setModificationDate(Long modificationDate) {
setValue(MODIFICATION_DATE, modificationDate);
}
public Integer getReminderFlags() {
return getValue(REMINDER_FLAGS);
}
public void setReminderFlags(Integer reminderFlags) {
setValue(REMINDER_FLAGS, reminderFlags);
}
public Long getReminderPeriod() {
return getValue(REMINDER_PERIOD);
}
public void setReminderPeriod(Long reminderPeriod) {
setValue(REMINDER_PERIOD, reminderPeriod);
}
public Integer getEstimatedSeconds() {
return getValue(ESTIMATED_SECONDS);
}
public void setEstimatedSeconds(Integer estimatedSeconds) {
setValue(ESTIMATED_SECONDS, estimatedSeconds);
}
public void setSocialReminder(String socialReminder) {
setValue(SOCIAL_REMINDER, socialReminder);
}
public void setPostponeCount(Integer postponeCount) {
setValue(POSTPONE_COUNT, postponeCount);
}
public void setELAPSED_SECONDS(Integer elapsedSeconds) {
setValue(ELAPSED_SECONDS, elapsedSeconds);
}
public void setCalendarUri(String calendarUri) {
setValue(CALENDAR_URI, calendarUri);
}
public void setID(Long id) {
setValue(ID, id);
}
}

@ -135,13 +135,13 @@ public final class TaskAttachment extends RemoteModel {
public static TaskAttachment createNewAttachment(String taskUuid, String filePath, String fileName, String fileType) {
TaskAttachment attachment = new TaskAttachment();
attachment.setValue(TaskAttachment.TASK_UUID, taskUuid);
attachment.setValue(NAME, fileName);
attachment.setValue(USER_UUID, Task.USER_ID_SELF);
attachment.setValue(FILE_PATH, filePath);
attachment.setValue(CONTENT_TYPE, fileType);
attachment.setValue(CREATED_AT, DateUtilities.now());
attachment.setValue(DELETED_AT, 0L);
attachment.setTaskUUID(taskUuid);
attachment.setName(fileName);
attachment.setUserUUID(Task.USER_ID_SELF);
attachment.setFilePath(filePath);
attachment.setContentType(fileType);
attachment.setCreatedAt(DateUtilities.now());
attachment.setDeletedAt(0L);
return attachment;
}
@ -169,14 +169,38 @@ public final class TaskAttachment extends RemoteModel {
public static final Creator<TaskAttachment> CREATOR = new ModelCreator<>(TaskAttachment.class);
public void setDeletedAt(Long deletedAt) {
setValue(DELETED_AT, deletedAt);
}
public void setCreatedAt(Long createdAt) {
setValue(CREATED_AT, createdAt);
}
public void setUserUUID(String userUuid) {
setValue(USER_UUID, userUuid);
}
public void setTaskUUID(String taskUuid) {
setValue(TASK_UUID, taskUuid);
}
public String getName() {
return getValue(NAME);
}
public void setName(String name) {
setValue(NAME, name);
}
public String getContentType() {
return getValue(CONTENT_TYPE);
}
public void setContentType(String contentType) {
setValue(CONTENT_TYPE, contentType);
}
public String getUUID() {
return getValue(UUID);
}
@ -184,4 +208,8 @@ public final class TaskAttachment extends RemoteModel {
public String getFilePath() {
return getValue(FILE_PATH);
}
public void setFilePath(String filePath) {
setValue(FILE_PATH, filePath);
}
}

@ -123,4 +123,16 @@ public final class TaskListMetadata extends RemoteModel {
public String getTaskIDs() {
return getValue(TASK_IDS);
}
public void setTaskIDs(String taskIds) {
setValue(TASK_IDS, taskIds);
}
public void setTagUUID(String tagUuid) {
setValue(TAG_UUID, tagUuid);
}
public void setFilter(String filter) {
setValue(FILTER, filter);
}
}

@ -112,7 +112,39 @@ public class UserActivity extends RemoteModel {
return getValue(CREATED_AT);
}
public void setCreatedAt(Long createdAt) {
setValue(CREATED_AT, createdAt);
}
public String getMessage() {
return getValue(MESSAGE);
}
public void setMessage(String message) {
setValue(MESSAGE, message);
}
public void setUserUUID(String userUuid) {
setValue(USER_UUID, userUuid);
}
public void setTargetName(String targetName) {
setValue(TARGET_NAME, targetName);
}
public void setTargetId(String targetId) {
setValue(TARGET_ID, targetId);
}
public void setAction(String action) {
setValue(ACTION, action);
}
public void setUUID(String uuid) {
setValue(UUID, uuid);
}
public void setPicture(String picture) {
setValue(PICTURE, picture);
}
}

@ -50,7 +50,7 @@ public class BackupServiceTests extends DatabaseTestCase {
// make a temporary task
Task task = new Task();
task.setValue(Task.TITLE, "helicopter");
task.setTitle("helicopter");
taskDao.createNew(task);
}

@ -36,7 +36,7 @@ public class MetadataDaoTests extends DatabaseTestCase {
// create "happy"
Metadata metadata = new Metadata();
metadata.setValue(Metadata.KEY, "happy");
metadata.setKey("happy");
assertTrue(metadataDao.persist(metadata));
cursor = metadataDao.query(
Query.select(Metadata.ID));
@ -49,7 +49,7 @@ public class MetadataDaoTests extends DatabaseTestCase {
// create "sad"
metadata = new Metadata();
metadata.setValue(Metadata.KEY, "sad");
metadata.setKey("sad");
assertTrue(metadataDao.persist(metadata));
cursor = metadataDao.query(Query.select(Metadata.ID));
assertEquals(2, cursor.getCount());
@ -58,7 +58,7 @@ public class MetadataDaoTests extends DatabaseTestCase {
// rename sad to melancholy
long sadId = metadata.getId();
assertNotSame(Metadata.NO_ID, sadId);
metadata.setValue(Metadata.KEY, "melancholy");
metadata.setKey("melancholy");
assertTrue(metadataDao.persist(metadata));
cursor = metadataDao.query(
Query.select(Metadata.ID));
@ -88,18 +88,18 @@ public class MetadataDaoTests extends DatabaseTestCase {
public void testMetadataConditions() throws Exception {
// create "happy"
Metadata metadata = new Metadata();
metadata.setValue(Metadata.KEY, "with1");
metadata.setValue(Metadata.TASK, 1L);
metadata.setKey("with1");
metadata.setTask(1L);
assertTrue(metadataDao.persist(metadata));
metadata = new Metadata();
metadata.setValue(Metadata.KEY, "with2");
metadata.setValue(Metadata.TASK, 2L);
metadata.setKey("with2");
metadata.setTask(2L);
assertTrue(metadataDao.persist(metadata));
metadata = new Metadata();
metadata.setValue(Metadata.KEY, "with1");
metadata.setValue(Metadata.TASK, 1L);
metadata.setKey("with1");
metadata.setTask(1L);
assertTrue(metadataDao.persist(metadata));
@ -149,18 +149,18 @@ public class MetadataDaoTests extends DatabaseTestCase {
cursor.close();
Metadata metadata = new Metadata();
metadata.setValue(Metadata.KEY, "with1");
metadata.setValue(Metadata.TASK, task1.getId());
metadata.setKey("with1");
metadata.setTask(task1.getId());
assertTrue(metadataDao.persist(metadata));
metadata = new Metadata();
metadata.setValue(Metadata.KEY, "with2");
metadata.setValue(Metadata.TASK, task2.getId());
metadata.setKey("with2");
metadata.setTask(task2.getId());
assertTrue(metadataDao.persist(metadata));
metadata = new Metadata();
metadata.setValue(Metadata.KEY, "with3");
metadata.setValue(Metadata.TASK, task3.getId());
metadata.setKey("with3");
metadata.setTask(task3.getId());
assertTrue(metadataDao.persist(metadata));
// fetch with tasks and corresponding metadata
@ -178,8 +178,8 @@ public class MetadataDaoTests extends DatabaseTestCase {
cursor.close();
metadata = new Metadata();
metadata.setValue(Metadata.KEY, "with2");
metadata.setValue(Metadata.TASK, task2Id);
metadata.setKey("with2");
metadata.setTask(task2Id);
assertTrue(metadataDao.persist(metadata));
// but if we simulate something bad happening by creating

@ -36,7 +36,7 @@ public class TaskDaoTests extends DatabaseTestCase {
// create task "happy"
Task task = new Task();
task.setValue(Task.TITLE, "happy");
task.setTitle("happy");
assertTrue(taskDao.save(task));
cursor = taskDao.query(
Query.select(IDS));
@ -49,7 +49,7 @@ public class TaskDaoTests extends DatabaseTestCase {
// create task "sad"
task = new Task();
task.setValue(Task.TITLE, "sad");
task.setTitle("sad");
assertTrue(taskDao.save(task));
cursor = taskDao.query(
Query.select(IDS));
@ -59,7 +59,7 @@ public class TaskDaoTests extends DatabaseTestCase {
// rename sad to melancholy
long sadId = task.getId();
assertNotSame(Task.NO_ID, sadId);
task.setValue(Task.TITLE, "melancholy");
task.setTitle("melancholy");
assertTrue(taskDao.save(task));
cursor = taskDao.query(
Query.select(IDS));
@ -79,35 +79,35 @@ public class TaskDaoTests extends DatabaseTestCase {
public void testTaskConditions() throws Exception {
// create normal task
Task task = new Task();
task.setValue(Task.TITLE, "normal");
task.setTitle("normal");
assertTrue(taskDao.save(task));
// create blank task
task = new Task();
task.setValue(Task.TITLE, "");
task.setTitle("");
assertTrue(taskDao.save(task));
// create hidden task
task = new Task();
task.setValue(Task.TITLE, "hidden");
task.setValue(Task.HIDE_UNTIL, DateUtilities.now() + 10000);
task.setTitle("hidden");
task.setHideUntil(DateUtilities.now() + 10000);
assertTrue(taskDao.save(task));
// create task with deadlines
task = new Task();
task.setValue(Task.TITLE, "deadlineInFuture");
task.setValue(Task.DUE_DATE, DateUtilities.now() + 10000);
task.setTitle("deadlineInFuture");
task.setDueDate(DateUtilities.now() + 10000);
assertTrue(taskDao.save(task));
task = new Task();
task.setValue(Task.TITLE, "deadlineInPast");
task.setValue(Task.DUE_DATE, DateUtilities.now() - 10000);
task.setTitle("deadlineInPast");
task.setDueDate(DateUtilities.now() - 10000);
assertTrue(taskDao.save(task));
// create completed task
task = new Task();
task.setValue(Task.TITLE, "completed");
task.setValue(Task.COMPLETION_DATE, DateUtilities.now() - 10000);
task.setTitle("completed");
task.setCompletionDate(DateUtilities.now() - 10000);
assertTrue(taskDao.save(task));
// check has no name
@ -169,7 +169,7 @@ public class TaskDaoTests extends DatabaseTestCase {
// create task "happy"
Task task = new Task();
task.setValue(Task.TITLE, "happy");
task.setTitle("happy");
assertTrue(taskDao.save(task));
cursor = taskDao.query(
Query.select(IDS));
@ -193,8 +193,8 @@ public class TaskDaoTests extends DatabaseTestCase {
// try to save task "happy"
Task task = new Task();
task.setValue(Task.TITLE, "happy");
task.setValue(Task.ID, 1L);
task.setTitle("happy");
task.setID(1L);
assertFalse(taskDao.save(task));

@ -155,7 +155,7 @@ public class GtasksIndentActionTest extends DatabaseTestCase {
metadata.setValue(GtasksMetadata.INDENT, indentation);
metadata.setValue(GtasksMetadata.ORDER, order);
metadata.setValue(GtasksMetadata.LIST_ID, "list");
metadata.setValue(Metadata.TASK, newTask.getId());
metadata.setTask(newTask.getId());
PluginServices.getMetadataService().save(metadata);
return newTask;
}

@ -132,12 +132,12 @@ public class GtasksMetadataServiceTest extends DatabaseTestCase {
private Task taskWithMetadata(String id) {
Task task = new Task();
task.setValue(Task.TITLE, "cats");
task.setTitle("cats");
PluginServices.getTaskService().save(task);
Metadata metadata = GtasksMetadata.createEmptyMetadata(task.getId());
if(id != null)
metadata.setValue(GtasksMetadata.ID, id);
metadata.setValue(Metadata.TASK, task.getId());
metadata.setTask(task.getId());
PluginServices.getMetadataService().save(metadata);
return task;
}
@ -148,7 +148,7 @@ public class GtasksMetadataServiceTest extends DatabaseTestCase {
private Task taskWithoutMetadata() {
Task task = new Task();
task.setValue(Task.TITLE, "dogs");
task.setTitle("dogs");
PluginServices.getTaskService().save(task);
return task;
}

@ -163,7 +163,7 @@ public class GtasksTaskListUpdaterTest extends DatabaseTestCase {
private Task createTask(String title, long order, int indent) {
Task task = new Task();
task.setValue(Task.TITLE, title);
task.setTitle(title);
PluginServices.getTaskService().save(task);
Metadata metadata = GtasksMetadata.createEmptyMetadata(task.getId());
metadata.setValue(GtasksMetadata.LIST_ID, "1");

@ -272,7 +272,7 @@ public class GtasksTaskMovingTest extends DatabaseTestCase {
private Task createTask(String title, long order, int indent) {
Task task = new Task();
task.setValue(Task.TITLE, title);
task.setTitle(title);
PluginServices.getTaskService().save(task);
Metadata metadata = GtasksMetadata.createEmptyMetadata(task.getId());
metadata.setValue(GtasksMetadata.LIST_ID, "1");

@ -43,8 +43,8 @@ public class NotificationTests extends DatabaseTestCase {
/** test that a normal task gets a notification */
public void testAlarmToNotification() {
final Task task = new Task();
task.setValue(Task.TITLE, "rubberduck");
task.setValue(Task.DUE_DATE, DateUtilities.now() - DateUtilities.ONE_DAY);
task.setTitle("rubberduck");
task.setDueDate(DateUtilities.now() - DateUtilities.ONE_DAY);
taskDao.persist(task);
final MutableBoolean triggered = new MutableBoolean();
@ -67,8 +67,8 @@ public class NotificationTests extends DatabaseTestCase {
/** test that a deleted task doesn't get a notification */
public void testDeletedTask() {
final Task task = new Task();
task.setValue(Task.TITLE, "gooeyduck");
task.setValue(Task.DELETION_DATE, DateUtilities.now());
task.setTitle("gooeyduck");
task.setDeletionDate(DateUtilities.now());
taskDao.persist(task);
Notifications.setNotificationManager(new NotificationManager() {
@ -92,8 +92,8 @@ public class NotificationTests extends DatabaseTestCase {
/** test that a completed task doesn't get a notification */
public void testCompletedTask() {
final Task task = new Task();
task.setValue(Task.TITLE, "rubberduck");
task.setValue(Task.COMPLETION_DATE, DateUtilities.now());
task.setTitle("rubberduck");
task.setCompletionDate(DateUtilities.now());
taskDao.persist(task);
Notifications.setNotificationManager(new NotificationManager() {
@ -117,7 +117,7 @@ public class NotificationTests extends DatabaseTestCase {
/** test of quiet hours */
public void testQuietHours() {
final Task task = new Task();
task.setValue(Task.TITLE, "rubberduck");
task.setTitle("rubberduck");
taskDao.persist(task);
Intent intent = new Intent();
intent.putExtra(Notifications.ID_KEY, task.getId());
@ -166,7 +166,7 @@ public class NotificationTests extends DatabaseTestCase {
new Notifications().onReceive(getContext(), intent);
// nonstop notification still sounds
task.setValue(Task.REMINDER_FLAGS, Task.NOTIFY_MODE_NONSTOP);
task.setReminderFlags(Task.NOTIFY_MODE_NONSTOP);
taskDao.persist(task);
Notifications.setNotificationManager(new TestNotificationManager() {
public void notify(int id, Notification notification) {

@ -67,7 +67,7 @@ public class NewRepeatTests<REMOTE_MODEL> extends DatabaseTestCase {
completionDate = dueDate - DateUtilities.ONE_DAY;
else
completionDate = dueDate + DateUtilities.ONE_DAY;
t.setValue(Task.COMPLETION_DATE, completionDate);
t.setCompletionDate(completionDate);
saveAndTriggerRepeatListener(t);
return completionDate;
}
@ -88,10 +88,10 @@ public class NewRepeatTests<REMOTE_MODEL> extends DatabaseTestCase {
public void testNoRepeat() {
Task t = new Task();
t.setValue(Task.TITLE, "no repeat");
t.setTitle("no repeat");
taskDao.save(t);
t.setValue(Task.COMPLETION_DATE, DateUtilities.now());
t.setCompletionDate(DateUtilities.now());
saveAndTriggerRepeatListener(t);
TodorooCursor<Task> cursor = taskDao.query(Query.select(Task.ID));
@ -105,14 +105,14 @@ public class NewRepeatTests<REMOTE_MODEL> extends DatabaseTestCase {
protected void testRepeating(boolean completeBefore, boolean fromCompletion,
RRule rrule, Frequency frequency, String title) {
Task t = new Task();
t.setValue(Task.TITLE, title);
t.setTitle(title);
long dueDate = DateUtilities.now() + DateUtilities.ONE_DAY * 3;
Date adjustDate = newDate(dueDate);
adjustDate.setSeconds(1);
dueDate = adjustDate.getTime();
dueDate = (dueDate / 1000L) * 1000L; // Strip milliseconds
t.setValue(Task.DUE_DATE, dueDate);
t.setDueDate(dueDate);
if (rrule == null) {
rrule = new RRule();
@ -124,7 +124,7 @@ public class NewRepeatTests<REMOTE_MODEL> extends DatabaseTestCase {
String result = rrule.toIcal();
if (fromCompletion)
result = result + ";FROM=COMPLETION";
t.setValue(Task.RECURRENCE, result);
t.setRecurrence(result);
taskDao.save(t);
waitAndSync();

@ -83,7 +83,7 @@ public class QuickAddMarkupTest extends DatabaseTestCase {
private void whenTitleIs(String title) {
task = new Task();
task.setValue(Task.TITLE, title);
task.setTitle(title);
tags.clear();
TaskService.parseQuickAddMarkup(task, tags);
}

@ -36,7 +36,7 @@ public class TitleParserTest extends DatabaseTestCase {
TaskService taskService = new TaskService();
Task task = new Task();
Task nothing = new Task();
task.setValue(Task.TITLE, "Jog");
task.setTitle("Jog");
taskService.save(task);
assertFalse(task.hasDueTime());
assertFalse(task.hasDueDate());
@ -159,7 +159,7 @@ public class TitleParserTest extends DatabaseTestCase {
private void insertTitleAddTask(String title, Task task) {
task.clear();
task.setValue(Task.TITLE, title);
task.setTitle(title);
TaskService.createWithValues(task, null, title);
}
@ -171,7 +171,7 @@ public class TitleParserTest extends DatabaseTestCase {
Task task = new Task();
String title = "Jog today";
task.setValue(Task.TITLE, title);
task.setTitle(title);
TaskService.createWithValues(task, null, title);
Date date = newDate(task.getDueDate());
assertEquals(date.getDay()+1, today.get(Calendar.DAY_OF_WEEK));
@ -179,7 +179,7 @@ public class TitleParserTest extends DatabaseTestCase {
task = new Task();
title = "Jog tomorrow";
task.setValue(Task.TITLE, title);
task.setTitle(title);
TaskService.createWithValues(task, null, title);
date = newDate(task.getDueDate());
assertEquals((date.getDay()+1) % 7, (today.get(Calendar.DAY_OF_WEEK)+1) % 7);
@ -206,14 +206,14 @@ public class TitleParserTest extends DatabaseTestCase {
for (int i = 1; i <= 6; i++){
task = new Task();
title = "Jog "+ days[i];
task.setValue(Task.TITLE, title);
task.setTitle(title);
TaskService.createWithValues(task, null, title);
date = newDate(task.getDueDate());
assertEquals(date.getDay(), i);
task = new Task();
title = "Jog "+ abrevDays[i];
task.setValue(Task.TITLE, title);
task.setTitle(title);
TaskService.createWithValues(task, null, title);
date = newDate(task.getDueDate());
assertEquals(date.getDay(), i);
@ -237,14 +237,14 @@ public class TitleParserTest extends DatabaseTestCase {
for (String acceptedString:acceptedStrings){
task = new Task();
String title = "Jog " + acceptedString;
task.setValue(Task.TITLE, title); //test at end of task. should set importance.
task.setTitle(title); //test at end of task. should set importance.
TaskService.createWithValues(task, null, title);
assertEquals((int)task.getImportance(), Task.IMPORTANCE_LEAST);
}
for (String acceptedString:acceptedStrings){
task = new Task();
String title = acceptedString + " jog";
task.setValue(Task.TITLE, title); //test at beginning of task. should not set importance.
task.setTitle(title); //test at beginning of task. should not set importance.
TaskService.createWithValues(task, null, title);
assertNotSame(task.getImportance(),Task.IMPORTANCE_LEAST);
}
@ -265,23 +265,23 @@ public class TitleParserTest extends DatabaseTestCase {
Task task;
for (String acceptedStringAtEnd:acceptedStringsAtEnd){
task = new Task();
task.setValue(Task.TITLE, "Jog " + acceptedStringAtEnd); //test at end of task. should set importance.
task.setTitle("Jog " + acceptedStringAtEnd); //test at end of task. should set importance.
taskService.save(task);
assertEquals((int)task.getImportance(), Task.IMPORTANCE_SHOULD_DO);
}
for (String acceptedStringAtEnd:acceptedStringsAtEnd){
task = new Task();
task.setValue(Task.TITLE, acceptedStringAtEnd + " jog"); //test at beginning of task. should not set importance.
task.setTitle(acceptedStringAtEnd + " jog"); //test at beginning of task. should not set importance.
taskService.save(task);
assertEquals((int)task.getImportance(), Task.IMPORTANCE_SHOULD_DO);
}
for (String acceptedStringAnywhere:acceptedStringsAnywhere){
task = new Task();
task.setValue(Task.TITLE, "Jog " + acceptedStringAnywhere); //test at end of task. should set importance.
task.setTitle("Jog " + acceptedStringAnywhere); //test at end of task. should set importance.
taskService.save(task);
assertEquals((int)task.getImportance(), Task.IMPORTANCE_SHOULD_DO);
task.setValue(Task.TITLE, acceptedStringAnywhere + " jog"); //test at beginning of task. should set importance.
task.setTitle(acceptedStringAnywhere + " jog"); //test at beginning of task. should set importance.
taskService.save(task);
assertEquals((int)task.getImportance(), Task.IMPORTANCE_SHOULD_DO);
}
@ -303,25 +303,25 @@ public class TitleParserTest extends DatabaseTestCase {
for (String acceptedStringAtEnd:acceptedStringsAtEnd){
task = new Task();
String title = "Jog " + acceptedStringAtEnd;
task.setValue(Task.TITLE, title); //test at end of task. should set importance.
task.setTitle(title); //test at end of task. should set importance.
TaskService.createWithValues(task, null, title);
assertEquals((int)task.getImportance(), Task.IMPORTANCE_MUST_DO);
task = new Task();
title = acceptedStringAtEnd + " jog";
task.setValue(Task.TITLE, title); //test at beginning of task. should not set importance.
task.setTitle(title); //test at beginning of task. should not set importance.
TaskService.createWithValues(task, null, title);
assertNotSame(task.getImportance(), Task.IMPORTANCE_MUST_DO);
}
for (String acceptedStringAnywhere:acceptedStringsAnywhere){
task = new Task();
String title = "Jog " + acceptedStringAnywhere;
task.setValue(Task.TITLE, title); //test at end of task. should set importance.
task.setTitle(title); //test at end of task. should set importance.
TaskService.createWithValues(task, null, title);
assertEquals((int)task.getImportance(), Task.IMPORTANCE_MUST_DO);
title = acceptedStringAnywhere + " jog";
task.setValue(Task.TITLE, title); //test at beginning of task. should set importance.
task.setTitle(title); //test at beginning of task. should set importance.
TaskService.createWithValues(task, null, title);
assertEquals((int)task.getImportance(), Task.IMPORTANCE_MUST_DO);
}
@ -346,25 +346,25 @@ public class TitleParserTest extends DatabaseTestCase {
for (String acceptedStringAtEnd:acceptedStringsAtEnd){
task = new Task();
String title = "Jog " + acceptedStringAtEnd;
task.setValue(Task.TITLE, title); //test at end of task. should set importance.
task.setTitle(title); //test at end of task. should set importance.
TaskService.createWithValues(task, null, title);
assertEquals((int)task.getImportance(), Task.IMPORTANCE_DO_OR_DIE);
task = new Task();
title = acceptedStringAtEnd + " jog";
task.setValue(Task.TITLE, title); //test at beginning of task. should not set importance.
task.setTitle(title); //test at beginning of task. should not set importance.
TaskService.createWithValues(task, null, title);
assertNotSame(task.getImportance(), Task.IMPORTANCE_DO_OR_DIE);
}
for (String acceptedStringAnywhere:acceptedStringsAnywhere){
task = new Task();
String title = "Jog " + acceptedStringAnywhere;
task.setValue(Task.TITLE, title); //test at end of task. should set importance.
task.setTitle(title); //test at end of task. should set importance.
TaskService.createWithValues(task, null, title);
assertEquals((int)task.getImportance(), Task.IMPORTANCE_DO_OR_DIE);
title = acceptedStringAnywhere + " jog";
task.setValue(Task.TITLE, title); //test at beginning of task. should set importance.
task.setTitle(title); //test at beginning of task. should set importance.
TaskService.createWithValues(task, null, title);
assertEquals((int)task.getImportance(), Task.IMPORTANCE_DO_OR_DIE);
}
@ -380,7 +380,7 @@ public class TitleParserTest extends DatabaseTestCase {
public void testDailyWithNoDueDate() throws Exception {
Task task = new Task();
String title = "Jog daily";
task.setValue(Task.TITLE, title);
task.setTitle(title);
TaskService.createWithValues(task, null, title);
RRule rrule = new RRule();
rrule.setFreq(Frequency.DAILY);
@ -390,7 +390,7 @@ public class TitleParserTest extends DatabaseTestCase {
assertFalse(task.hasDueDate());
title = "Jog every day";
task.setValue(Task.TITLE, title);
task.setTitle(title);
TaskService.createWithValues(task, null, title);
assertEquals(task.getRecurrence(), rrule.toIcal());
assertFalse(task.hasDueTime());
@ -398,7 +398,7 @@ public class TitleParserTest extends DatabaseTestCase {
for (int i = 1; i <= 12; i++){
title = "Jog every " + i + " days.";
task.setValue(Task.TITLE, title);
task.setTitle(title);
rrule.setInterval(i);
TaskService.createWithValues(task, null, title);
assertEquals(task.getRecurrence(), rrule.toIcal());
@ -414,7 +414,7 @@ public class TitleParserTest extends DatabaseTestCase {
new TaskService();
Task task = new Task();
String title = "Jog weekly";
task.setValue(Task.TITLE, title);
task.setTitle(title);
TaskService.createWithValues(task, null, title);
RRule rrule = new RRule();
rrule.setFreq(Frequency.WEEKLY);
@ -424,7 +424,7 @@ public class TitleParserTest extends DatabaseTestCase {
assertFalse(task.hasDueDate());
title = "Jog every week";
task.setValue(Task.TITLE, title);
task.setTitle(title);
TaskService.createWithValues(task, null, title);
assertEquals(task.getRecurrence(), rrule.toIcal());
assertFalse(task.hasDueTime());
@ -432,7 +432,7 @@ public class TitleParserTest extends DatabaseTestCase {
for (int i = 1; i <= 12; i++){
title = "Jog every " + i + " weeks";
task.setValue(Task.TITLE, title);
task.setTitle(title);
rrule.setInterval(i);
TaskService.createWithValues(task, null, title);
assertEquals(task.getRecurrence(), rrule.toIcal());
@ -446,7 +446,7 @@ public class TitleParserTest extends DatabaseTestCase {
public void testMonthlyFromNoDueDate() throws Exception {
Task task = new Task();
String title = "Jog monthly";
task.setValue(Task.TITLE, title);
task.setTitle(title);
TaskService.createWithValues(task, null, title);
RRule rrule = new RRule();
rrule.setFreq(Frequency.MONTHLY);
@ -456,7 +456,7 @@ public class TitleParserTest extends DatabaseTestCase {
assertFalse(task.hasDueDate());
title = "Jog every month";
task.setValue(Task.TITLE, title);
task.setTitle(title);
TaskService.createWithValues(task, null, title);
assertEquals(task.getRecurrence(), rrule.toIcal());
assertFalse(task.hasDueTime());
@ -464,7 +464,7 @@ public class TitleParserTest extends DatabaseTestCase {
for (int i = 1; i <= 12; i++){
title = "Jog every " + i + " months";
task.setValue(Task.TITLE, title);
task.setTitle(title);
rrule.setInterval(i);
TaskService.createWithValues(task, null, title);
assertEquals(task.getRecurrence(), rrule.toIcal());
@ -477,7 +477,7 @@ public class TitleParserTest extends DatabaseTestCase {
public void testDailyFromDueDate() throws Exception {
Task task = new Task();
String title = "Jog daily starting from today";
task.setValue(Task.TITLE, title);
task.setTitle(title);
TaskService.createWithValues(task, null, title);
RRule rrule = new RRule();
rrule.setFreq(Frequency.DAILY);
@ -488,14 +488,14 @@ public class TitleParserTest extends DatabaseTestCase {
task.clearValue(Task.ID);
task.clearValue(Task.UUID);
title = "Jog every day starting from today";
task.setValue(Task.TITLE, title);
task.setTitle(title);
TaskService.createWithValues(task, null, title);
assertEquals(task.getRecurrence(), rrule.toIcal());
assertTrue(task.hasDueDate());
for (int i = 1; i <= 12; i++){
title = "Jog every " + i + " days starting from today";
task.setValue(Task.TITLE, title);
task.setTitle(title);
rrule.setInterval(i);
TaskService.createWithValues(task, null, title);
assertEquals(task.getRecurrence(), rrule.toIcal());
@ -507,7 +507,7 @@ public class TitleParserTest extends DatabaseTestCase {
public void testWeeklyFromDueDate() throws Exception {
Task task = new Task();
String title = "Jog weekly starting from today";
task.setValue(Task.TITLE, title);
task.setTitle(title);
TaskService.createWithValues(task, null, title);
RRule rrule = new RRule();
rrule.setFreq(Frequency.WEEKLY);
@ -518,14 +518,14 @@ public class TitleParserTest extends DatabaseTestCase {
task.clearValue(Task.ID);
task.clearValue(Task.UUID);
title = "Jog every week starting from today";
task.setValue(Task.TITLE, title);
task.setTitle(title);
TaskService.createWithValues(task, null, title);
assertEquals(task.getRecurrence(), rrule.toIcal());
assertTrue(task.hasDueDate());
for (int i = 1; i <= 12; i++){
title = "Jog every " + i + " weeks starting from today";
task.setValue(Task.TITLE, title);
task.setTitle(title);
rrule.setInterval(i);
TaskService.createWithValues(task, null, title);
assertEquals(task.getRecurrence(), rrule.toIcal());
@ -549,7 +549,7 @@ public class TitleParserTest extends DatabaseTestCase {
Task task;
for (String acceptedString : acceptedStrings) {
task = new Task();
task.setValue(Task.TITLE, "Jog " + acceptedString); //test at end of task. should set importance.
task.setTitle("Jog " + acceptedString); //test at end of task. should set importance.
ArrayList<String> tags = new ArrayList<>();
TitleParser.listHelper(task, tags);
String tag = TitleParser.trimParenthesis(acceptedString);
@ -568,7 +568,7 @@ public class TitleParserTest extends DatabaseTestCase {
Task task;
for (String acceptedString : acceptedStrings) {
task = new Task();
task.setValue(Task.TITLE, "Jog " + acceptedString); //test at end of task. should set importance.
task.setTitle("Jog " + acceptedString); //test at end of task. should set importance.
ArrayList<String> tags = new ArrayList<>();
TitleParser.listHelper(task, tags);
String tag = TitleParser.trimParenthesis(acceptedString);

@ -11,14 +11,14 @@ public class SubtasksHelperTest extends SubtasksTestCase {
super.setUp();
createTasks();
TaskListMetadata m = new TaskListMetadata();
m.setValue(TaskListMetadata.FILTER, TaskListMetadata.FILTER_ID_ALL);
m.setFilter(TaskListMetadata.FILTER_ID_ALL);
updater.initializeFromSerializedTree(m, filter, SubtasksHelper.convertTreeToRemoteIds(DEFAULT_SERIALIZED_TREE));
}
private void createTask(String title, String uuid) {
Task t = new Task();
t.setValue(Task.TITLE, title);
t.setValue(Task.UUID, uuid);
t.setTitle(title);
t.setUUID(uuid);
PluginServices.getTaskService().save(t);
}

@ -13,7 +13,7 @@ public class SubtasksMovingTest extends SubtasksTestCase {
super.setUp();
createTasks();
TaskListMetadata m = new TaskListMetadata();
m.setValue(TaskListMetadata.FILTER, TaskListMetadata.FILTER_ID_ALL);
m.setFilter(TaskListMetadata.FILTER_ID_ALL);
updater.initializeFromSerializedTree(m, filter, SubtasksHelper.convertTreeToRemoteIds(DEFAULT_SERIALIZED_TREE));
// Assert initial state is correct
@ -36,7 +36,7 @@ public class SubtasksMovingTest extends SubtasksTestCase {
private Task createTask(String title) {
Task task = new Task();
task.setValue(Task.TITLE, title);
task.setTitle(title);
PluginServices.getTaskService().save(task);
return task;
}

@ -20,8 +20,8 @@ public class NewSyncTestCase extends DatabaseTestCase {
protected Task createTask(String title) {
Task task = new Task();
task.setValue(Task.TITLE, title);
task.setValue(Task.IMPORTANCE, SYNC_TASK_IMPORTANCE);
task.setTitle(title);
task.setImportance(SYNC_TASK_IMPORTANCE);
taskDao.createNew(task);
return task;
@ -36,7 +36,7 @@ public class NewSyncTestCase extends DatabaseTestCase {
protected TagData createTagData(String name) {
TagData tag = new TagData();
tag.setValue(TagData.NAME, name);
tag.setName(name);
tagDataDao.createNew(tag);
return tag;

@ -252,7 +252,7 @@ public abstract class CommentsFragment extends ListFragment {
if (picture != null) {
JSONObject pictureJson = RemoteModel.PictureHelper.savePictureJson(getActivity(), picture);
if (pictureJson != null) {
update.setValue(UserActivity.PICTURE, pictureJson.toString());
update.setPicture(pictureJson.toString());
}
}

@ -72,12 +72,12 @@ public class TagCommentsFragment extends CommentsFragment {
@Override
protected UserActivity createUpdate() {
UserActivity userActivity = new UserActivity();
userActivity.setValue(UserActivity.MESSAGE, addCommentField.getText().toString());
userActivity.setValue(UserActivity.ACTION, UserActivity.ACTION_TAG_COMMENT);
userActivity.setValue(UserActivity.USER_UUID, Task.USER_ID_SELF);
userActivity.setValue(UserActivity.TARGET_ID, tagData.getUuid());
userActivity.setValue(UserActivity.TARGET_NAME, tagData.getName());
userActivity.setValue(UserActivity.CREATED_AT, DateUtilities.now());
userActivity.setMessage(addCommentField.getText().toString());
userActivity.setAction(UserActivity.ACTION_TAG_COMMENT);
userActivity.setUserUUID(Task.USER_ID_SELF);
userActivity.setTargetId(tagData.getUuid());
userActivity.setTargetName(tagData.getName());
userActivity.setCreatedAt(DateUtilities.now());
return userActivity;
}
}

@ -99,7 +99,7 @@ public class TagSettingsActivity extends ActionBarActivity {
if (tagData == null) {
isNewTag = true;
tagData = new TagData();
tagData.setValue(TagData.UUID, UUIDHelper.newUUID());
tagData.setUUID(UUIDHelper.newUUID());
}
ActionBar actionBar = getSupportActionBar();
@ -167,13 +167,13 @@ public class TagSettingsActivity extends ActionBarActivity {
TagService service = TagService.getInstance();
if (nameChanged) {
if (oldName.equalsIgnoreCase(newName)) { // Change the capitalization of a list manually
tagData.setValue(TagData.NAME, newName);
tagData.setName(newName);
service.rename(tagData.getUuid(), newName);
} else { // Rename list--check for existing name
newName = service.getTagWithCase(newName);
tagName.setText(newName);
if (!newName.equals(oldName)) {
tagData.setValue(TagData.NAME, newName);
tagData.setName(newName);
service.rename(tagData.getUuid(), newName);
}
}
@ -182,13 +182,13 @@ public class TagSettingsActivity extends ActionBarActivity {
if (setBitmap != null) {
JSONObject pictureJson = RemoteModel.PictureHelper.savePictureJson(this, setBitmap);
if (pictureJson != null) {
tagData.setValue(TagData.PICTURE, pictureJson.toString());
tagData.setPicture(pictureJson.toString());
}
}
JSONArray members = new JSONArray();
tagData.setValue(TagData.MEMBER_COUNT, members.length());
tagData.setMemberCount(members.length());
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(tagName.getWindowToken(), 0);
@ -213,7 +213,7 @@ public class TagSettingsActivity extends ActionBarActivity {
}
try {
String tagPicture = RemoteModel.PictureHelper.getPictureHash(tagData);
tagData.setValue(TagData.PICTURE, tagPicture);
tagData.setPicture(tagPicture);
}
catch (Exception e) {
e.printStackTrace();

@ -148,8 +148,8 @@ public class TagViewFragment extends TaskListFragment {
try {
tagData = new TagData();
if(cursor.getCount() == 0) {
tagData.setValue(TagData.NAME, tag);
tagData.setValue(TagData.UUID, uuid);
tagData.setName(tag);
tagData.setUUID(uuid);
tagDataService.save(tagData);
} else {
cursor.moveToFirst();
@ -182,7 +182,7 @@ public class TagViewFragment extends TaskListFragment {
if(tagData != null && sortFlags <= SortHelper.FLAG_REVERSE_SORT &&
count != tagData.getTaskCount()) {
tagData.setValue(TagData.TASK_COUNT, count);
tagData.setTaskCount(count);
tagDataService.save(tagData);
}
}
@ -198,7 +198,7 @@ public class TagViewFragment extends TaskListFragment {
if (tagData != null) {
long lastAutosync = tagData.getLastAutosync();
if(DateUtilities.now() - lastAutosync > AUTOSYNC_INTERVAL) {
tagData.setValue(TagData.LAST_AUTOSYNC, DateUtilities.now());
tagData.setLastAutosync(DateUtilities.now());
tagDataDao.saveExisting(tagData);
}
}

@ -51,7 +51,7 @@ public final class ShareLinkActivity extends TaskListActivity {
Task task = QuickAddBar.basicQuickAddTask(subject);
if (task != null) {
task.setValue(Task.NOTES, callerIntent.getStringExtra(Intent.EXTRA_TEXT));
task.setNotes(callerIntent.getStringExtra(Intent.EXTRA_TEXT));
taskService.save(task);
handled = true;
onTaskListItemClicked(task.getId());

@ -605,7 +605,7 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
if (model.getTitle().length() == 0) {
// set deletion date until task gets a title
model.setValue(Task.DELETION_DATE, DateUtilities.now());
model.setDeletionDate(DateUtilities.now());
}
setIsNewTask(model.getTitle().length() == 0);
@ -665,7 +665,7 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
}
if (title.getText().length() > 0) {
model.setValue(Task.DELETION_DATE, 0L);
model.setDeletionDate(0L);
}
if (title.getText().length() == 0) {

@ -381,8 +381,8 @@ public class TaskListFragment extends ListFragment implements OnSortSelectedList
}
defaultOrder = SubtasksHelper.convertTreeToRemoteIds(defaultOrder);
taskListMetadata = new TaskListMetadata();
taskListMetadata.setValue(TaskListMetadata.FILTER, filterId);
taskListMetadata.setValue(TaskListMetadata.TASK_IDS, defaultOrder);
taskListMetadata.setFilter(filterId);
taskListMetadata.setTaskIDs(defaultOrder);
taskListMetadataDao.createNew(taskListMetadata);
}
}
@ -391,7 +391,7 @@ public class TaskListFragment extends ListFragment implements OnSortSelectedList
taskListMetadata = taskListMetadataDao.fetchByTagId(td.getUuid(), TaskListMetadata.PROPERTIES);
if (taskListMetadata == null && !RemoteModel.isUuidEmpty(tdId)) {
taskListMetadata = new TaskListMetadata();
taskListMetadata.setValue(TaskListMetadata.TAG_UUID, tdId);
taskListMetadata.setTagUUID(tdId);
taskListMetadataDao.createNew(taskListMetadata);
}
}
@ -460,7 +460,7 @@ public class TaskListFragment extends ListFragment implements OnSortSelectedList
&& event.getUnicodeChar() <= '4' && selected != null) {
int importance = event.getNumber() - '1';
Task task = ((ViewHolder) selected.getTag()).task;
task.setValue(Task.IMPORTANCE, importance);
task.setImportance(importance);
taskService.save(task);
taskAdapter.setFieldContentsAndVisibility(selected);
}
@ -1063,7 +1063,7 @@ public class TaskListFragment extends ListFragment implements OnSortSelectedList
itemId = item.getGroupId();
Task task = new Task();
task.setId(itemId);
task.setValue(Task.DELETION_DATE, 0L);
task.setDeletionDate(0L);
taskService.save(task);
loadTaskListContent(true);
return true;

@ -718,8 +718,8 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
}
addTaskToLoadingArray(task);
task.setValue(Task.DETAILS, DETAIL_SEPARATOR);
task.setValue(Task.DETAILS_DATE, DateUtilities.now());
task.setDetails(DETAIL_SEPARATOR);
task.setDetailsDate(DateUtilities.now());
taskService.save(task);
requestNewDetails(task);
@ -780,8 +780,8 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
details.append(detail);
Task task = new Task();
task.setId(id);
task.setValue(Task.DETAILS, details.toString());
task.setValue(Task.DETAILS_DATE, DateUtilities.now());
task.setDetails(details.toString());
task.setDetailsDate(DateUtilities.now());
taskService.save(task);
}
@ -990,7 +990,7 @@ public class TaskAdapter extends CursorAdapter implements Filterable {
value = completedItems.get(task.getId());
}
if(value != null) {
task.setValue(Task.COMPLETION_DATE,
task.setCompletionDate(
value ? DateUtilities.now() : 0);
}
boolean state = task.isCompleted();

@ -134,14 +134,14 @@ public class UpdateAdapter extends CursorAdapter {
}
public static void readUserActivityProperties(TodorooCursor<UserActivity> unionCursor, UserActivity activity) {
activity.setValue(UserActivity.CREATED_AT, unionCursor.getLong(0));
activity.setValue(UserActivity.UUID, unionCursor.getString(1));
activity.setValue(UserActivity.ACTION, unionCursor.getString(2));
activity.setValue(UserActivity.MESSAGE, unionCursor.getString(3));
activity.setValue(UserActivity.TARGET_ID, unionCursor.getString(4));
activity.setValue(UserActivity.TARGET_NAME, unionCursor.getString(5));
activity.setValue(UserActivity.PICTURE, unionCursor.getString(6));
activity.setValue(UserActivity.USER_UUID, unionCursor.getString(7));
activity.setCreatedAt(unionCursor.getLong(0));
activity.setUUID(unionCursor.getString(1));
activity.setAction(unionCursor.getString(2));
activity.setMessage(unionCursor.getString(3));
activity.setTargetId(unionCursor.getString(4));
activity.setTargetName(unionCursor.getString(5));
activity.setPicture(unionCursor.getString(6));
activity.setUserUUID(unionCursor.getString(7));
}
/** Helper method to set the contents and visibility of each field */

@ -93,7 +93,7 @@ public final class AlarmControlSet extends TaskEditControlSet {
}
if(AlarmService.getInstance().synchronizeAlarms(task.getId(), alarms)) {
task.setValue(Task.MODIFICATION_DATE, DateUtilities.now());
task.setModificationDate(DateUtilities.now());
}
}

@ -76,7 +76,7 @@ public class AlarmService {
ArrayList<Metadata> metadata = new ArrayList<>();
for(Long alarm : alarms) {
Metadata item = new Metadata();
item.setValue(Metadata.KEY, AlarmFields.METADATA_KEY);
item.setKey(AlarmFields.METADATA_KEY);
item.setValue(AlarmFields.TIME, alarm);
item.setValue(AlarmFields.TYPE, AlarmFields.TYPE_SINGLE);
metadata.add(item);

@ -292,7 +292,7 @@ public class TasksXmlImporter {
metadata.clear();
deserializeModel(metadata, Metadata.PROPERTIES);
metadata.setId(Metadata.NO_ID);
metadata.setValue(Metadata.TASK, currentTask.getId());
metadata.setTask(currentTask.getId());
metadataService.save(metadata);
// Construct the TagData from Metadata
@ -312,7 +312,7 @@ public class TasksXmlImporter {
tagdata.clear();
tagdata.setId(TagData.NO_ID);
tagdata.setUuid(uuid);
tagdata.setValue(TagData.NAME, name);
tagdata.setName(name);
tagdataService.save(tagdata);
}
} finally {
@ -470,7 +470,7 @@ public class TasksXmlImporter {
String listId = strtok.nextToken();
Metadata metadata = new Metadata();
metadata.setValue(Metadata.TASK, currentTask.getId());
metadata.setTask(currentTask.getId());
metadata.setValue(Metadata.VALUE1, (listId));
metadata.setValue(Metadata.VALUE2, (taskSeriesId));
metadata.setValue(Metadata.VALUE3, (taskId));
@ -537,9 +537,9 @@ public class TasksXmlImporter {
if(upgradeNotes != null) {
if(task.containsValue(Task.NOTES) && task.getNotes().length() > 0) {
task.setValue(Task.NOTES, task.getNotes() + "\n" + upgradeNotes);
task.setNotes(task.getNotes() + "\n" + upgradeNotes);
} else {
task.setValue(Task.NOTES, upgradeNotes);
task.setNotes(upgradeNotes);
}
upgradeNotes = null;
}
@ -557,25 +557,25 @@ public class TasksXmlImporter {
// ignore
break;
case LegacyTaskModel.NAME:
task.setValue(Task.TITLE, value);
task.setTitle(value);
break;
case LegacyTaskModel.NOTES:
task.setValue(Task.NOTES, value);
task.setNotes(value);
break;
case LegacyTaskModel.PROGRESS_PERCENTAGE:
// ignore
break;
case LegacyTaskModel.IMPORTANCE:
task.setValue(Task.IMPORTANCE, LegacyImportance.valueOf(value).ordinal());
task.setImportance(LegacyImportance.valueOf(value).ordinal());
break;
case LegacyTaskModel.ESTIMATED_SECONDS:
task.setValue(Task.ESTIMATED_SECONDS, Integer.parseInt(value));
task.setEstimatedSeconds(Integer.parseInt(value));
break;
case LegacyTaskModel.ELAPSED_SECONDS:
task.setValue(Task.ELAPSED_SECONDS, Integer.parseInt(value));
task.setELAPSED_SECONDS(Integer.parseInt(value));
break;
case LegacyTaskModel.TIMER_START:
task.setValue(Task.TIMER_START,
task.setTimerStart(
BackupDateUtilities.getDateFromIso8601String(value).getTime());
break;
case LegacyTaskModel.DEFINITE_DUE_DATE:
@ -585,7 +585,7 @@ public class TasksXmlImporter {
upgradeNotes = "Project Deadline: " +
DateUtilities.getDateString(preferredDate);
}
task.setValue(Task.DUE_DATE,
task.setDueDate(
BackupDateUtilities.getTaskDueDateFromIso8601String(value).getTime());
break;
case LegacyTaskModel.PREFERRED_DUE_DATE:
@ -593,39 +593,39 @@ public class TasksXmlImporter {
if (definite != null) {
// handled above
} else {
task.setValue(Task.DUE_DATE,
task.setDueDate(
BackupDateUtilities.getTaskDueDateFromIso8601String(value).getTime());
}
break;
case LegacyTaskModel.HIDDEN_UNTIL:
task.setValue(Task.HIDE_UNTIL,
task.setHideUntil(
BackupDateUtilities.getDateFromIso8601String(value).getTime());
break;
case LegacyTaskModel.BLOCKING_ON:
// ignore
break;
case LegacyTaskModel.POSTPONE_COUNT:
task.setValue(Task.POSTPONE_COUNT, Integer.parseInt(value));
task.setPostponeCount(Integer.parseInt(value));
break;
case LegacyTaskModel.NOTIFICATIONS:
task.setValue(Task.REMINDER_PERIOD, Integer.parseInt(value) * 1000L);
task.setReminderPeriod(Integer.parseInt(value) * 1000L);
break;
case LegacyTaskModel.CREATION_DATE:
task.setValue(Task.CREATION_DATE,
task.setCreationDate(
BackupDateUtilities.getDateFromIso8601String(value).getTime());
break;
case LegacyTaskModel.COMPLETION_DATE:
String completion = xpp.getAttributeValue(null, LegacyTaskModel.PROGRESS_PERCENTAGE);
if ("100".equals(completion)) {
task.setValue(Task.COMPLETION_DATE,
task.setCompletionDate(
BackupDateUtilities.getDateFromIso8601String(value).getTime());
}
break;
case LegacyTaskModel.NOTIFICATION_FLAGS:
task.setValue(Task.REMINDER_FLAGS, Integer.parseInt(value));
task.setReminderFlags(Integer.parseInt(value));
break;
case LegacyTaskModel.LAST_NOTIFIED:
task.setValue(Task.REMINDER_LAST,
task.setReminderLast(
BackupDateUtilities.getDateFromIso8601String(value).getTime());
break;
case "repeat_interval":
@ -638,7 +638,7 @@ public class TasksXmlImporter {
LegacyRepeatInterval interval = LegacyRepeatInterval.valueOf(repeatInterval);
LegacyRepeatInfo repeatInfo = new LegacyRepeatInfo(interval, repeatValue);
RRule rrule = repeatInfo.toRRule();
task.setValue(Task.RECURRENCE, rrule.toIcal());
task.setRecurrence(rrule.toIcal());
}
break;
case LegacyTaskModel.FLAGS:

@ -195,8 +195,8 @@ public class MissedCallActivity extends Activity {
public void snoozeForTime(long time) {
Task newTask = new Task();
newTask.setValue(Task.TITLE, taskTitle);
newTask.setValue(Task.DUE_DATE, time);
newTask.setTitle(taskTitle);
newTask.setDueDate(time);
taskService.save(newTask);
finish();

@ -162,7 +162,7 @@ public class OldTaskPreferences extends TodorooPreferenceActivity {
cursor.close();
}
Task template = new Task();
template.setValue(Task.DELETION_DATE,
template.setDeletionDate(
DateUtilities.now());
int result = taskService.update(
Task.COMPLETION_DATE.gt(0), template);
@ -242,7 +242,7 @@ public class OldTaskPreferences extends TodorooPreferenceActivity {
// mass update the CALENDAR_URI here,
// since the GCalHelper doesnt save it due to performance-reasons
Task template = new Task();
template.setValue(Task.CALENDAR_URI, ""); //$NON-NLS-1$
template.setCalendarUri(""); //$NON-NLS-1$
taskService.update(
Criterion.and(Task.COMPLETION_DATE.gt(0), Task.CALENDAR_URI.isNotNull()),
template);
@ -284,7 +284,7 @@ public class OldTaskPreferences extends TodorooPreferenceActivity {
// mass update the CALENDAR_URI here,
// since the GCalHelper doesnt save it due to performance-reasons
Task template = new Task();
template.setValue(Task.CALENDAR_URI, ""); //$NON-NLS-1$
template.setCalendarUri(""); //$NON-NLS-1$
taskService.update(
Task.CALENDAR_URI.isNotNull(),
template);

@ -81,7 +81,7 @@ public class MetadataDao extends DatabaseDao<Metadata> {
Criterion metadataCriteria) {
HashSet<ContentValues> newMetadataValues = new HashSet<>();
for(Metadata metadatum : metadata) {
metadatum.setValue(Metadata.TASK, taskId);
metadatum.setTask(taskId);
metadatum.clearValue(Metadata.ID);
newMetadataValues.add(metadatum.getMergedValues());
}
@ -121,7 +121,7 @@ public class MetadataDao extends DatabaseDao<Metadata> {
@Override
public boolean persist(Metadata item) {
if(!item.containsValue(Metadata.CREATION_DATE)) {
item.setValue(Metadata.CREATION_DATE, DateUtilities.now());
item.setCreationDate(DateUtilities.now());
}
boolean state = super.persist(item);

@ -26,7 +26,7 @@ public class RemoteModelDao<RTYPE extends RemoteModel> extends DatabaseDao<RTYPE
@Override
public boolean createNew(RTYPE item) {
if (!item.containsValue(RemoteModel.UUID_PROPERTY) || RemoteModel.isUuidEmpty(item.getUuidProperty())) {
item.setValue(RemoteModel.UUID_PROPERTY, UUIDHelper.newUUID());
item.setUuidProperty(UUIDHelper.newUUID());
}
return super.createNew(item);
}

@ -133,7 +133,7 @@ public class TagMetadataDao extends DatabaseDao<TagMetadata> {
} catch (JSONException e) {
//
}
tagData.setValue(TagData.MEMBERS, ""); //$NON-NLS-1$
tagData.setMembers(""); //$NON-NLS-1$
PluginServices.getTagDataDao().saveExisting(tagData);
}

@ -185,19 +185,19 @@ public class TaskDao extends RemoteModelDao<Task> {
@Override
public boolean createNew(Task item) {
if(!item.containsValue(Task.CREATION_DATE)) {
item.setValue(Task.CREATION_DATE, DateUtilities.now());
item.setCreationDate(DateUtilities.now());
}
item.setValue(Task.MODIFICATION_DATE, DateUtilities.now());
item.setModificationDate(DateUtilities.now());
// set up task defaults
if(!item.containsValue(Task.IMPORTANCE)) {
item.setValue(Task.IMPORTANCE, Preferences.getIntegerFromString(
item.setImportance(Preferences.getIntegerFromString(
R.string.p_default_importance_key, Task.IMPORTANCE_SHOULD_DO));
}
if(!item.containsValue(Task.DUE_DATE)) {
int setting = Preferences.getIntegerFromString(R.string.p_default_urgency_key,
Task.URGENCY_NONE);
item.setValue(Task.DUE_DATE, Task.createDueDate(setting, 0));
item.setDueDate(Task.createDueDate(setting, 0));
}
createDefaultHideUntil(item);
@ -216,7 +216,7 @@ public class TaskDao extends RemoteModelDao<Task> {
if(!item.containsValue(Task.HIDE_UNTIL)) {
int setting = Preferences.getIntegerFromString(R.string.p_default_hideUntil_key,
Task.HIDE_UNTIL_NONE);
item.setValue(Task.HIDE_UNTIL, item.createHideUntil(setting, 0));
item.setHideUntil(item.createHideUntil(setting, 0));
}
}
@ -225,7 +225,7 @@ public class TaskDao extends RemoteModelDao<Task> {
*/
public static void setDefaultReminders(Task item) {
if(!item.containsValue(Task.REMINDER_PERIOD)) {
item.setValue(Task.REMINDER_PERIOD, DateUtilities.ONE_HOUR *
item.setReminderPeriod(DateUtilities.ONE_HOUR *
Preferences.getIntegerFromString(R.string.p_rmd_default_random_hours,
0));
}
@ -233,7 +233,7 @@ public class TaskDao extends RemoteModelDao<Task> {
int reminder_flags = Preferences.getIntegerFromString(R.string.p_default_reminders_key,
Task.NOTIFY_AT_DEADLINE | Task.NOTIFY_AFTER_DEADLINE) |
Preferences.getIntegerFromString(R.string.p_default_reminders_mode_key, 0);
item.setValue(Task.REMINDER_FLAGS, reminder_flags);
item.setReminderFlags(reminder_flags);
}
}
@ -244,9 +244,9 @@ public class TaskDao extends RemoteModelDao<Task> {
return false;
}
if(!TaskApiDao.insignificantChange(values)) {
item.setValue(Task.DETAILS, null);
item.setDetails(null);
if(!values.containsKey(Task.MODIFICATION_DATE.name)) {
item.setValue(Task.MODIFICATION_DATE, DateUtilities.now());
item.setModificationDate(DateUtilities.now());
}
}
boolean result = super.saveExisting(item);
@ -318,7 +318,7 @@ public class TaskDao extends RemoteModelDao<Task> {
}
if (!match) {
if (existing.getCreationDate().equals(newConflict.getCreationDate())) {
newConflict.setValue(Task.CREATION_DATE, newConflict.getCreationDate() + 1000L);
newConflict.setCreationDate(newConflict.getCreationDate() + 1000L);
}
newConflict.clearValue(Task.UUID);
saveExisting(newConflict);

@ -21,7 +21,7 @@ public class UserActivityDao extends RemoteModelDao<UserActivity> {
@Override
public boolean createNew(UserActivity item) {
if (!item.containsValue(UserActivity.CREATED_AT)) {
item.setValue(UserActivity.CREATED_AT, DateUtilities.now());
item.setCreatedAt(DateUtilities.now());
}
return super.createNew(item);
}

@ -118,7 +118,7 @@ public class FilesControlSet extends PopupControlSet {
if (m.containsNonNullValue(TaskAttachment.FILE_PATH)) {
File f = new File(m.getFilePath());
if (!f.exists()) {
m.setValue(TaskAttachment.FILE_PATH, ""); //$NON-NLS-1$
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
@ -171,7 +171,7 @@ public class FilesControlSet extends PopupControlSet {
@Override
public void onClick(DialogInterface d, int which) {
if (RemoteModel.isValidUuid(m.getUUID())) {
m.setValue(TaskAttachment.DELETED_AT, DateUtilities.now());
m.setDeletedAt(DateUtilities.now());
taskAttachmentDao.saveExisting(m);
} else {
taskAttachmentDao.delete(m.getId());
@ -233,7 +233,7 @@ public class FilesControlSet extends PopupControlSet {
useType = guessedType;
}
if (!useType.equals(guessedType)) {
m.setValue(TaskAttachment.CONTENT_TYPE, useType);
m.setContentType(useType);
m.putTransitory(SyncFlags.ACTFM_SUPPRESS_OUTSTANDING_ENTRIES, true);
taskAttachmentDao.saveExisting(m);
}

@ -46,7 +46,7 @@ public class CalendarAlarmListCreator extends Activity {
@Override
public void onClick(View v) {
TagData tagData = new TagData();
tagData.setValue(TagData.NAME, tagName);
tagData.setName(tagName);
tagDataService.save(tagData);
dismissWithAnimation();
}

@ -157,7 +157,7 @@ public class GCalControlSet extends PopupControlSet {
calendarUri = GCalHelper.createTaskEvent(task, cr, values);
if(calendarUri != null) {
task.setValue(Task.CALENDAR_URI, calendarUri.toString());
task.setCalendarUri(calendarUri.toString());
if (calendarSelector.getSelectedItemPosition() != 0 && !hasEvent) {
// pop up the new event

@ -60,7 +60,7 @@ public class GCalHelper {
ContentResolver cr = ContextManager.getContext().getContentResolver();
Uri calendarUri = GCalHelper.createTaskEvent(t, cr, new ContentValues(), deleteEventIfExists);
if (calendarUri != null) {
t.setValue(Task.CALENDAR_URI, calendarUri.toString());
t.setCalendarUri(calendarUri.toString());
}
}
}
@ -119,14 +119,14 @@ public class GCalHelper {
Uri eventUri = Uri.parse(taskUri);
String calendarId = getCalendarId(eventUri, cr);
if (calendarId == null) { // Bail out, no calendar id
task.setValue(Task.CALENDAR_URI, ""); //$NON-NLS-1$
task.setCalendarUri(""); //$NON-NLS-1$
return;
}
ContentValues cv = new ContentValues();
cv.put(CALENDAR_ID_COLUMN, calendarId);
Uri uri = createTaskEvent(task, cr, cv, false);
task.setValue(Task.CALENDAR_URI, uri.toString());
task.setCalendarUri(uri.toString());
}
private static String getCalendarId(Uri uri, ContentResolver cr) {
@ -172,7 +172,7 @@ public class GCalHelper {
cursor.close();
}
task.setValue(Task.CALENDAR_URI,"");
task.setCalendarUri( "");
} catch (Exception e) {
Log.e("astrid-gcal", "error-deleting-calendar-event", e); //$NON-NLS-1$ //$NON-NLS-2$
}

@ -132,7 +132,7 @@ public class GtasksListFragment extends SubtasksListFragment {
listId = gtasksMetadataService.getTaskMetadata(
t.getId()).getValue(GtasksMetadata.LIST_ID);
}
t.setValue(Task.DELETION_DATE, DateUtilities.now());
t.setDeletionDate(DateUtilities.now());
taskService.save(t);
}
}

@ -54,7 +54,7 @@ public class GtasksMetadata {
*/
public static Metadata createEmptyMetadata(long taskId) {
Metadata metadata = new Metadata();
metadata.setValue(Metadata.KEY, GtasksMetadata.METADATA_KEY);
metadata.setKey(GtasksMetadata.METADATA_KEY);
metadata.setValue(ID, ""); //$NON-NLS-1$
String defaultList = Preferences.getStringValue(GtasksPreferenceService.PREF_DEFAULT_LIST);
@ -67,7 +67,7 @@ public class GtasksMetadata {
metadata.setValue(INDENT, 0);
metadata.setValue(ORDER, DateUtilities.now());
if(taskId > AbstractModel.NO_ID) {
metadata.setValue(Metadata.TASK, taskId);
metadata.setTask(taskId);
}
return metadata;
}

@ -301,7 +301,7 @@ public class GtasksSyncService {
}
}
task.setValue(Task.MODIFICATION_DATE, DateUtilities.now());
task.setModificationDate(DateUtilities.now());
gtasksMetadata.setValue(GtasksMetadata.LAST_SYNC, DateUtilities.now() + 1000L);
metadataService.save(gtasksMetadata);
task.putTransitory(SyncFlags.GTASKS_SUPPRESS_SYNC, true);

@ -304,22 +304,22 @@ public class GtasksSyncV2Provider extends SyncV2Provider {
ArrayList<Metadata> metadata = new ArrayList<>();
task.setValue(Task.TITLE, remoteTask.getTitle());
task.setValue(Task.CREATION_DATE, DateUtilities.now());
task.setValue(Task.COMPLETION_DATE, GtasksApiUtilities.gtasksCompletedTimeToUnixTime(remoteTask.getCompleted()));
task.setTitle(remoteTask.getTitle());
task.setCreationDate(DateUtilities.now());
task.setCompletionDate(GtasksApiUtilities.gtasksCompletedTimeToUnixTime(remoteTask.getCompleted()));
if (remoteTask.getDeleted() == null || !remoteTask.getDeleted()) {
task.setValue(Task.DELETION_DATE, 0L);
task.setDeletionDate(0L);
} else if (remoteTask.getDeleted()) {
task.setValue(Task.DELETION_DATE, DateUtilities.now());
task.setDeletionDate(DateUtilities.now());
}
if (remoteTask.getHidden() != null && remoteTask.getHidden()) {
task.setValue(Task.DELETION_DATE, DateUtilities.now());
task.setDeletionDate(DateUtilities.now());
}
long dueDate = GtasksApiUtilities.gtasksDueTimeToUnixTime(remoteTask.getDue());
long createdDate = Task.createDueDate(Task.URGENCY_SPECIFIC_DAY, dueDate);
task.setValue(Task.DUE_DATE, createdDate);
task.setValue(Task.NOTES, remoteTask.getNotes());
task.setDueDate(createdDate);
task.setNotes(remoteTask.getNotes());
Metadata gtasksMetadata = GtasksMetadata.createEmptyMetadata(AbstractModel.NO_ID);
gtasksMetadata.setValue(GtasksMetadata.ID, remoteTask.getId());
@ -340,7 +340,7 @@ public class GtasksSyncV2Provider extends SyncV2Provider {
mergeDates(task.task, local);
}
} else { // Set default importance and reminders for remotely created tasks
task.task.setValue(Task.IMPORTANCE, Preferences.getIntegerFromString(
task.task.setImportance(Preferences.getIntegerFromString(
R.string.p_default_importance_key, Task.IMPORTANCE_SHOULD_DO));
TaskDao.setDefaultReminders(task.task);
}
@ -359,7 +359,7 @@ public class GtasksSyncV2Provider extends SyncV2Provider {
newDate.setSeconds(oldDate.getSeconds());
long setDate = Task.createDueDate(Task.URGENCY_SPECIFIC_DAY_TIME,
newDate.getTime());
remote.setValue(Task.DUE_DATE, setDate);
remote.setDueDate(setDate);
}
}
}

@ -365,16 +365,16 @@ public class EditNoteActivity extends LinearLayout implements TimerActionListene
message = " ";
}
UserActivity userActivity = new UserActivity();
userActivity.setValue(UserActivity.MESSAGE, message);
userActivity.setValue(UserActivity.ACTION, actionCode);
userActivity.setValue(UserActivity.USER_UUID, Task.USER_ID_SELF);
userActivity.setValue(UserActivity.TARGET_ID, uuid);
userActivity.setValue(UserActivity.TARGET_NAME, title);
userActivity.setValue(UserActivity.CREATED_AT, DateUtilities.now());
userActivity.setMessage(message);
userActivity.setAction(actionCode);
userActivity.setUserUUID(Task.USER_ID_SELF);
userActivity.setTargetId(uuid);
userActivity.setTargetName(title);
userActivity.setCreatedAt(DateUtilities.now());
if (usePicture && pendingCommentPicture != null) {
JSONObject pictureJson = RemoteModel.PictureHelper.savePictureJson(activity, pendingCommentPicture);
if (pictureJson != null) {
userActivity.setValue(UserActivity.PICTURE, pictureJson.toString());
userActivity.setPicture(pictureJson.toString());
}
}

@ -255,19 +255,19 @@ public class Astrid2TaskProvider extends ContentProvider {
// map values
if(values.containsKey(NAME)) {
task.setValue(Task.TITLE, values.getAsString(NAME));
task.setTitle(values.getAsString(NAME));
}
if(values.containsKey(PREFERRED_DUE_DATE)) {
task.setValue(Task.DUE_DATE, values.getAsLong(PREFERRED_DUE_DATE));
task.setDueDate(values.getAsLong(PREFERRED_DUE_DATE));
}
if(values.containsKey(DEFINITE_DUE_DATE)) {
task.setValue(Task.DUE_DATE, values.getAsLong(DEFINITE_DUE_DATE));
task.setDueDate(values.getAsLong(DEFINITE_DUE_DATE));
}
if(values.containsKey(IMPORTANCE)) {
task.setValue(Task.IMPORTANCE, values.getAsInteger(IMPORTANCE));
task.setImportance(values.getAsInteger(IMPORTANCE));
}
if(values.containsKey(COMPLETED)) {
task.setValue(Task.COMPLETION_DATE, values.getAsBoolean(COMPLETED) ? DateUtilities.now() : 0);
task.setCompletionDate(values.getAsBoolean(COMPLETED) ? DateUtilities.now() : 0);
}
// map selection criteria

@ -190,8 +190,8 @@ public class Notifications extends BroadcastReceiver {
int ringTimes = nonstopMode ? -1 : (ringFiveMode ? 5 : 1);
// update last reminder time
task.setValue(Task.REMINDER_LAST, DateUtilities.now());
task.setValue(Task.SOCIAL_REMINDER, Task.REMINDER_SOCIAL_UNSEEN);
task.setReminderLast(DateUtilities.now());
task.setSocialReminder(Task.REMINDER_SOCIAL_UNSEEN);
taskDao.saveExisting(task);
Context context = ContextManager.getContext();

@ -49,7 +49,7 @@ public class ReminderDialog extends Dialog {
public void snoozeForTime(long time) {
Task task = new Task();
task.setId(taskId);
task.setValue(Task.REMINDER_SNOOZE, time);
task.setReminderSnooze(time);
PluginServices.getTaskService().save(task);
dismiss();
}

@ -369,8 +369,8 @@ public class RepeatControlSet extends PopupControlSet {
{
task.putTransitory(TaskService.TRANS_REPEAT_CHANGED, true);
}
task.setValue(Task.RECURRENCE, result);
task.setValue(Task.REPEAT_UNTIL, repeatUntilValue);
task.setRecurrence(result);
task.setRepeatUntil(repeatUntilValue);
if(task.repeatAfterCompletion()) {
type.setSelection(1);

@ -101,9 +101,9 @@ public class RepeatTaskCompleteListener extends BroadcastReceiver {
hideUntil += newDueDate - task.getDueDate();
}
task.setValue(Task.COMPLETION_DATE, 0L);
task.setValue(Task.DUE_DATE, newDueDate);
task.setValue(Task.HIDE_UNTIL, hideUntil);
task.setCompletionDate(0L);
task.setDueDate(newDueDate);
task.setHideUntil(hideUntil);
task.putTransitory(TaskService.TRANS_REPEAT_COMPLETE, true);
ContentResolver cr = ContextManager.getContext().getContentResolver();

@ -104,7 +104,7 @@ public class MetadataService {
boolean dirty = false;
HashSet<ContentValues> newMetadataValues = new HashSet<>();
for(Metadata metadatum : metadata) {
metadatum.setValue(Metadata.TASK, taskId);
metadatum.setTask(taskId);
metadatum.clearValue(Metadata.CREATION_DATE);
metadatum.clearValue(Metadata.ID);
@ -152,7 +152,7 @@ public class MetadataService {
// everything that remains shall be written
for(ContentValues values : newMetadataValues) {
item.clear();
item.setValue(Metadata.CREATION_DATE, DateUtilities.now());
item.setCreationDate(DateUtilities.now());
item.mergeWith(values);
metadataDao.persist(item);
dirty = true;

@ -97,9 +97,9 @@ public class TaskService {
*/
public void setComplete(Task item, boolean completed) {
if(completed) {
item.setValue(Task.COMPLETION_DATE, DateUtilities.now());
item.setCompletionDate(DateUtilities.now());
} else {
item.setValue(Task.COMPLETION_DATE, 0L);
item.setCompletionDate(0L);
}
taskDao.save(item);
@ -143,7 +143,7 @@ public class TaskService {
metadata.setValue(GtasksMetadata.ID, ""); //$NON-NLS-1$
}
metadata.setValue(Metadata.TASK, newId);
metadata.setTask(newId);
metadata.clearValue(Metadata.ID);
metadataDao.createNew(metadata);
}
@ -171,7 +171,7 @@ public class TaskService {
item.clear();
item.setId(id);
GCalHelper.deleteTaskEvent(item);
item.setValue(Task.DELETION_DATE, DateUtilities.now());
item.setDeletionDate(DateUtilities.now());
taskDao.save(item);
}
}
@ -252,7 +252,7 @@ public class TaskService {
*/
public void clearDetails(Criterion criterion) {
Task template = new Task();
template.setValue(Task.DETAILS_DATE, 0L);
template.setDetailsDate(0L);
taskDao.update(criterion, template);
}
@ -264,7 +264,7 @@ public class TaskService {
TodorooCursor<Task> cursor = taskDao.rawQuery(selection, selectionArgs, Task.ID);
try {
for(cursor.moveToFirst(); !cursor.isAfterLast(); cursor.moveToNext()) {
taskValues.setValue(Task.ID, cursor.get(Task.ID));
taskValues.setID(cursor.get(Task.ID));
taskDao.save(taskValues);
}
return cursor.getCount();
@ -355,10 +355,10 @@ public class TaskService {
if (!Task.USER_ID_SELF.equals(userId) && !ActFmPreferenceService.userId().equals(userId)) {
clone.putTransitory(TRANS_ASSIGNED, true);
}
clone.setValue(Task.CREATION_DATE, DateUtilities.now());
clone.setValue(Task.COMPLETION_DATE, 0L);
clone.setValue(Task.DELETION_DATE, 0L);
clone.setValue(Task.CALENDAR_URI, ""); //$NON-NLS-1$
clone.setCreationDate(DateUtilities.now());
clone.setCompletionDate(0L);
clone.setDeletionDate(0L);
clone.setCalendarUri(""); //$NON-NLS-1$
GCalHelper.createTaskEventIfEnabled(clone);
save(clone);
@ -380,7 +380,7 @@ public class TaskService {
*/
public static Task createWithValues(Task task, ContentValues values, String title) {
if (title != null) {
task.setValue(Task.TITLE, title);
task.setTitle(title);
}
ArrayList<String> tags = new ArrayList<>();
@ -425,7 +425,7 @@ public class TaskService {
if (forMetadata != null && forMetadata.size() > 0) {
Metadata metadata = new Metadata();
metadata.setValue(Metadata.TASK, task.getId());
metadata.setTask(task.getId());
metadata.mergeWith(forMetadata);
if (TaskToTagMetadata.KEY.equals(metadata.getKey())) {
if (metadata.containsNonNullValue(TaskToTagMetadata.TAG_UUID) && !RemoteModel.NO_UUID.equals(metadata.getValue(TaskToTagMetadata.TAG_UUID))) {

@ -250,7 +250,7 @@ public class AstridOrderedListFragmentHelper<LIST> implements OrderedListFragmen
ArrayList<String> chained = chainedCompletions.get(itemId);
if(chained != null) {
for(String taskId : chained) {
model.setValue(Task.COMPLETION_DATE, completionDate);
model.setCompletionDate(completionDate);
taskService.update(Task.UUID.eq(taskId), model);
model.clear();
@ -266,7 +266,7 @@ public class AstridOrderedListFragmentHelper<LIST> implements OrderedListFragmen
@Override
public void visitNode(AstridOrderedListUpdater.Node node) {
String uuid = node.uuid;
model.setValue(Task.COMPLETION_DATE, completionDate);
model.setCompletionDate(completionDate);
taskService.update(Task.UUID.eq(uuid), model);
model.clear();

@ -261,7 +261,7 @@ public class OrderedMetadataListFragmentHelper<LIST> implements OrderedListFragm
if(chained != null) {
for(Long taskId : chained) {
model.setId(taskId);
model.setValue(Task.COMPLETION_DATE, completionDate);
model.setCompletionDate(completionDate);
taskService.save(model);
model.clear();
@ -285,7 +285,7 @@ public class OrderedMetadataListFragmentHelper<LIST> implements OrderedListFragm
}
model.setId(node.taskId);
model.setValue(Task.COMPLETION_DATE, completionDate);
model.setCompletionDate(completionDate);
taskService.save(model);
model.clear();

@ -28,7 +28,7 @@ public class SubtasksFilterUpdater extends SubtasksUpdater<TaskListMetadata> {
@Override
protected void writeSerialization(TaskListMetadata list, String serialized, boolean shouldQueueSync) {
if (list != null) {
list.setValue(TaskListMetadata.TASK_IDS, serialized);
list.setTaskIDs(serialized);
if (!shouldQueueSync) {
list.putTransitory(SyncFlags.ACTFM_SUPPRESS_OUTSTANDING_ENTRIES, true);
}

@ -192,7 +192,7 @@ public final class TagService {
TagData tagData;
if (existingTag.getCount() == 0) {
tagData = new TagData();
tagData.setValue(TagData.NAME, tagName);
tagData.setName(tagName);
tagDataService.save(tagData);
} else {
existingTag.moveToFirst();
@ -217,8 +217,8 @@ public final class TagService {
*/
public void deleteLinks(long taskId, String taskUuid, String[] tagUuids) {
Metadata deleteTemplate = new Metadata();
deleteTemplate.setValue(Metadata.TASK, taskId); // Need this for recording changes in outstanding table
deleteTemplate.setValue(Metadata.DELETION_DATE, DateUtilities.now());
deleteTemplate.setTask(taskId); // Need this for recording changes in outstanding table
deleteTemplate.setDeletionDate(DateUtilities.now());
if (tagUuids != null) {
for (String uuid : tagUuids) {
// TODO: Right now this is in a loop because each deleteTemplate needs the individual tagUuid in order to record
@ -279,7 +279,7 @@ public final class TagService {
TagData tagData = tagDataDao.fetch(uuid, TagData.ID, TagData.UUID, TagData.DELETION_DATE, TagData.MEMBER_COUNT, TagData.USER_ID);
Intent tagDeleted = new Intent(AstridApiConstants.BROADCAST_EVENT_TAG_DELETED);
if(tagData != null) {
tagData.setValue(TagData.DELETION_DATE, DateUtilities.now());
tagData.setDeletionDate(DateUtilities.now());
PluginServices.getTagDataService().save(tagData);
tagDeleted.putExtra(TagViewFragment.EXTRA_TAG_UUID, tagData.getUuid());
}
@ -332,7 +332,7 @@ public final class TagService {
TagData tagData = getTagDataWithCase(tag, TagData.NAME, TagData.UUID);
if (tagData == null) {
tagData = new TagData();
tagData.setValue(TagData.NAME, tag);
tagData.setName(tag);
tagDataService.save(tagData);
}
if (existingLinks.contains(tagData.getUUID())) {
@ -392,14 +392,14 @@ public final class TagService {
public int deleteTagMetadata(String uuid) {
Metadata deleted = new Metadata();
deleted.setValue(Metadata.DELETION_DATE, DateUtilities.now());
deleted.setDeletionDate(DateUtilities.now());
return metadataDao.update(Criterion.and(MetadataCriteria.withKey(TaskToTagMetadata.KEY), TaskToTagMetadata.TAG_UUID.eq(uuid)), deleted);
}
public int rename(String uuid, String newName) {
TagData template = new TagData();
template.setValue(TagData.NAME, newName);
template.setName(newName);
tagDataDao.update(TagData.UUID.eq(uuid), template);
Metadata metadataTemplate = new Metadata();

@ -305,7 +305,7 @@ public final class TagsControlSet extends PopupControlSet {
TagService.getInstance().synchronizeTags(task.getId(), task.getUUID(), tags);
Flags.set(Flags.TAGS_CHANGED);
task.setValue(Task.MODIFICATION_DATE, DateUtilities.now());
task.setModificationDate(DateUtilities.now());
}
@Override

@ -29,12 +29,12 @@ public class TaskToTagMetadata {
*/
public static Metadata newTagMetadata(long taskId, String taskUuid, String tagName, String tagUuid) {
Metadata link = new Metadata();
link.setValue(Metadata.KEY, KEY);
link.setValue(Metadata.TASK, taskId);
link.setKey(KEY);
link.setTask(taskId);
link.setValue(TAG_NAME, tagName);
link.setValue(TASK_UUID, taskUuid);
link.setValue(TAG_UUID, tagUuid);
link.setValue(Metadata.DELETION_DATE, 0L);
link.setDeletionDate(0L);
return link;
}
}

@ -58,13 +58,13 @@ public class TimerPlugin extends BroadcastReceiver {
if(start) {
if(task.getTimerStart() == 0) {
task.setValue(Task.TIMER_START, DateUtilities.now());
task.setTimerStart(DateUtilities.now());
}
} else {
if(task.getTimerStart() > 0) {
int newElapsed = (int)((DateUtilities.now() - task.getTimerStart()) / 1000L);
task.setValue(Task.TIMER_START, 0L);
task.setValue(Task.ELAPSED_SECONDS,
task.setTimerStart(0L);
task.setELAPSED_SECONDS(
task.getElapsedSeconds() + newElapsed);
}
}

@ -156,7 +156,7 @@ public class DateChangedAlerts {
@Override
public void onDateAndTimeSelected(long date) {
d.dismiss();
task.setValue(Task.REPEAT_UNTIL, date);
task.setRepeatUntil(date);
RepeatTaskCompleteListener.rescheduleTask(task, newDueDate);
Flags.set(Flags.REFRESH);
}
@ -202,11 +202,11 @@ public class DateChangedAlerts {
@Override
public void onClick(View v) {
d.dismiss();
task.setValue(Task.DUE_DATE, oldDueDate);
task.setValue(Task.COMPLETION_DATE, 0L);
task.setDueDate(oldDueDate);
task.setCompletionDate(0L);
long hideUntil = task.getHideUntil();
if (hideUntil > 0) {
task.setValue(Task.HIDE_UNTIL, hideUntil - (newDueDate - oldDueDate));
task.setHideUntil(hideUntil - (newDueDate - oldDueDate));
}
PluginServices.getTaskService().save(task);
Flags.set(Flags.REFRESH);

@ -121,9 +121,9 @@ public class DeadlineControlSet extends PopupControlSet {
long dueDate = dateAndTimePicker.constructDueDate();
if (dueDate != task.getDueDate()) // Clear snooze if due date has changed
{
task.setValue(Task.REMINDER_SNOOZE, 0L);
task.setReminderSnooze(0L);
}
task.setValue(Task.DUE_DATE, dueDate);
task.setDueDate(dueDate);
}
private void initializeWithDate(long dueDate) {

@ -84,7 +84,7 @@ public class EditNotesControlSet extends PopupControlSet {
@Override
protected void writeToModelAfterInitialized(Task task) {
task.setValue(Task.NOTES, editText.getText().toString());
task.setNotes(editText.getText().toString());
}
@Override

@ -85,7 +85,7 @@ public class EditTitleControlSet extends TaskEditControlSet implements Importanc
@Override
protected void writeToModelAfterInitialized(Task task) {
task.setValue(Task.TITLE, editText.getText().toString());
task.setTitle(editText.getText().toString());
boolean newState = completeBox.isChecked();
if (newState != task.isCompleted()) {
taskService.setComplete(task, newState);

@ -273,7 +273,7 @@ public class HideUntilControlSet extends PopupControlSet implements OnItemSelect
return;
}
long value = task.createHideUntil(item.setting, item.date);
task.setValue(Task.HIDE_UNTIL, value);
task.setHideUntil(value);
}
}

@ -140,7 +140,7 @@ public class ImportanceControlSet extends TaskEditControlSet {
@Override
protected void writeToModelAfterInitialized(Task task) {
if(getImportance() != null) {
task.setValue(Task.IMPORTANCE, getImportance());
task.setImportance(getImportance());
}
}
}

@ -258,7 +258,7 @@ public class QuickAddBar extends LinearLayout {
Task task = new Task();
if (title != null) {
task.setValue(Task.TITLE, title); // need this for calendar
task.setTitle(title); // need this for calendar
}
if (repeatControl.isRecurrenceSet()) {
@ -307,7 +307,7 @@ public class QuickAddBar extends LinearLayout {
if (!TextUtils.isEmpty(title) && gcalCreateEventEnabled && TextUtils.isEmpty(task.getCalendarURI())) {
Uri calendarUri = GCalHelper.createTaskEvent(task,
ContextManager.getContext().getContentResolver(), new ContentValues());
task.setValue(Task.CALENDAR_URI, calendarUri.toString());
task.setCalendarUri(calendarUri.toString());
task.putTransitory(SyncFlags.GTASKS_SUPPRESS_SYNC, true);
PluginServices.getTaskService().save(task);
}

@ -97,9 +97,9 @@ public class RandomReminderControlSet extends TaskEditControlSet {
protected void writeToModelAfterInitialized(Task task) {
if(settingCheckbox.isChecked()) {
int hourValue = hours[periodSpinner.getSelectedItemPosition()];
task.setValue(Task.REMINDER_PERIOD, hourValue * DateUtilities.ONE_HOUR);
task.setReminderPeriod(hourValue * DateUtilities.ONE_HOUR);
} else {
task.setValue(Task.REMINDER_PERIOD, 0L);
task.setReminderPeriod(0L);
}
}

@ -158,7 +158,7 @@ public class ReminderControlSet extends PopupControlSet {
@Override
protected void writeToModelAfterInitialized(Task task) {
task.setValue(Task.REMINDER_FLAGS, getValue());
task.setReminderFlags(getValue());
randomControlSet.writeToModel(task);
alarmControl.writeToModel(task);

@ -74,7 +74,7 @@ public class TitleParser {
}
inputText = inputText.substring(0, m.start()) + inputText.substring(m.end());
}
task.setValue(Task.TITLE, inputText.trim());
task.setTitle(inputText.trim());
}
//helper method for priorityHelper. converts the string to a Task Importance
@ -112,7 +112,7 @@ public class TitleParser {
Matcher m = importancePattern.matcher(inputText);
if(m.find()) {
result = true;
task.setValue(Task.IMPORTANCE, strToPriority(m.group(2).trim()));
task.setImportance(strToPriority(m.group(2).trim()));
int start = m.start() == 0 ? 0 : m.start() + 1;
inputText = inputText.substring(0, start) + inputText.substring(m.end());
@ -121,7 +121,7 @@ public class TitleParser {
}
}
}
task.setValue(Task.TITLE, inputText.trim());
task.setTitle(inputText.trim());
return result;
}
@ -356,12 +356,12 @@ public class TitleParser {
if(cal != null) { //if at least one of the above has been called, write to task. else do nothing.
if (!TextUtils.isEmpty(inputText)) {
task.setValue(Task.TITLE, inputText);
task.setTitle(inputText);
}
if (containsSpecificTime) {
task.setValue(Task.DUE_DATE, Task.createDueDate(Task.URGENCY_SPECIFIC_DAY_TIME, cal.getTime().getTime()));
task.setDueDate(Task.createDueDate(Task.URGENCY_SPECIFIC_DAY_TIME, cal.getTime().getTime()));
} else {
task.setValue(Task.DUE_DATE, Task.createDueDate(Task.URGENCY_SPECIFIC_DAY, cal.getTime().getTime()));
task.setDueDate(Task.createDueDate(Task.URGENCY_SPECIFIC_DAY, cal.getTime().getTime()));
}
return true;
}
@ -403,7 +403,7 @@ public class TitleParser {
RRule rrule = new RRule();
rrule.setFreq(rtime);
rrule.setInterval(findInterval(inputText));
task.setValue(Task.RECURRENCE, rrule.toIcal());
task.setRecurrence(rrule.toIcal());
return true;
}
}
@ -417,7 +417,7 @@ public class TitleParser {
rrule.setFreq(rtime);
rrule.setInterval(1);
String thing = rrule.toIcal();
task.setValue(Task.RECURRENCE, thing);
task.setRecurrence(thing);
return true;
}
}

@ -2,7 +2,6 @@ package com.todoroo.astrid.reminders;
import com.todoroo.andlib.service.Autowired;
import com.todoroo.andlib.test.TodorooRobolectricTestCase;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.dao.TaskDao;
import com.todoroo.astrid.data.Task;
@ -11,7 +10,6 @@ import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.robolectric.RobolectricTestRunner;
import org.tasks.R;
import static com.todoroo.astrid.reminders.ReminderService.NO_ALARM;
import static org.junit.Assert.assertEquals;
@ -43,8 +41,8 @@ public class NotifyAtDeadlineTest extends TodorooRobolectricTestCase {
public void scheduleReminderAtDueTime() {
final DateTime dueDate = new DateTime(2014, 1, 24, 19, 23, 57);
Task task = new Task() {{
setValue(Task.DUE_DATE, dueDate.getMillis());
setValue(Task.REMINDER_FLAGS, Task.NOTIFY_AT_DEADLINE);
setDueDate(dueDate.getMillis());
setReminderFlags(Task.NOTIFY_AT_DEADLINE);
}};
assertEquals(dueDate.getMillis(), service.calculateNextDueDateReminder(task));
}
@ -52,7 +50,7 @@ public class NotifyAtDeadlineTest extends TodorooRobolectricTestCase {
@Test
public void noReminderWhenNoDueDate() {
Task task = new Task() {{
setValue(Task.REMINDER_FLAGS, Task.NOTIFY_AT_DEADLINE);
setReminderFlags(Task.NOTIFY_AT_DEADLINE);
}};
assertEquals(NO_ALARM, service.calculateNextDueDateReminder(task));
}
@ -60,7 +58,7 @@ public class NotifyAtDeadlineTest extends TodorooRobolectricTestCase {
@Test
public void noReminderWhenNotifyAtDeadlineFlagNotSet() {
Task task = new Task() {{
setValue(Task.DUE_DATE, new DateTime(2014, 1, 24, 19, 23, 57).getMillis());
setDueDate(new DateTime(2014, 1, 24, 19, 23, 57).getMillis());
}};
assertEquals(NO_ALARM, service.calculateNextDueDateReminder(task));
}
@ -68,9 +66,9 @@ public class NotifyAtDeadlineTest extends TodorooRobolectricTestCase {
@Test
public void dontNotifyMoreThanOncePerDay() {
Task task = new Task() {{
setValue(Task.DUE_DATE, newDate(2014, 1, 23).getTime());
setValue(Task.REMINDER_FLAGS, Task.NOTIFY_AT_DEADLINE);
setValue(Task.REMINDER_LAST, new DateTime(2014, 1, 23, 17, 23, 37).getMillis());
setDueDate(newDate(2014, 1, 23).getTime());
setReminderFlags(Task.NOTIFY_AT_DEADLINE);
setReminderLast(new DateTime(2014, 1, 23, 17, 23, 37).getMillis());
}};
assertEquals(NO_ALARM, service.calculateNextDueDateReminder(task));
}
@ -79,9 +77,9 @@ public class NotifyAtDeadlineTest extends TodorooRobolectricTestCase {
public void notifyIfLastNotificationWasMoreThanOneDayAgo() {
final DateTime dueDate = new DateTime(2014, 1, 23, 0, 0, 0, 0);
Task task = new Task() {{
setValue(Task.DUE_DATE, dueDate.getMillis());
setValue(Task.REMINDER_FLAGS, Task.NOTIFY_AT_DEADLINE);
setValue(Task.REMINDER_LAST, new DateTime(2014, 1, 23, 17, 23, 36).getMillis());
setDueDate(dueDate.getMillis());
setReminderFlags(Task.NOTIFY_AT_DEADLINE);
setReminderLast(new DateTime(2014, 1, 23, 17, 23, 36).getMillis());
}};
assertEquals(
dueDate.withHourOfDay(18).getMillis(),

@ -50,9 +50,9 @@ public class ReminderServiceTest extends TodorooRobolectricTestCase {
service.setScheduler(new NoAlarmExpected());
Task task = new Task();
task.setValue(Task.TITLE, "water");
task.setValue(Task.REMINDER_FLAGS, 0);
task.setValue(Task.REMINDER_PERIOD, 0L);
task.setTitle("water");
task.setReminderFlags(0);
task.setReminderPeriod(0L);
taskDao.save(task);
service.scheduleAlarm(task);
}
@ -72,13 +72,13 @@ public class ReminderServiceTest extends TodorooRobolectricTestCase {
// test due date in the past
final Task task = new Task();
task.setValue(Task.TITLE, "water");
task.setValue(Task.DUE_DATE, DateUtilities.now() - DateUtilities.ONE_DAY);
task.setValue(Task.REMINDER_FLAGS, Task.NOTIFY_AT_DEADLINE);
task.setTitle("water");
task.setDueDate(DateUtilities.now() - DateUtilities.ONE_DAY);
task.setReminderFlags(Task.NOTIFY_AT_DEADLINE);
taskDao.save(task);
// test due date in the future
task.setValue(Task.DUE_DATE, DateUtilities.now() + DateUtilities.ONE_DAY);
task.setDueDate(DateUtilities.now() + DateUtilities.ONE_DAY);
taskDao.save(task);
assertTrue(((AlarmExpected)service.getScheduler()).alarmCreated);
}
@ -87,8 +87,8 @@ public class ReminderServiceTest extends TodorooRobolectricTestCase {
public void testRandom() {
// test random
final Task task = new Task();
task.setValue(Task.TITLE, "water");
task.setValue(Task.REMINDER_PERIOD, DateUtilities.ONE_WEEK);
task.setTitle("water");
task.setReminderPeriod(DateUtilities.ONE_WEEK);
service.setScheduler(new AlarmExpected() {
@Override
public void createAlarm(Task task, long time, int type) {
@ -119,13 +119,13 @@ public class ReminderServiceTest extends TodorooRobolectricTestCase {
}
});
final Task task = new Task();
task.setValue(Task.TITLE, "water");
task.setValue(Task.DUE_DATE, DateUtilities.now() + DateUtilities.ONE_DAY);
task.setValue(Task.REMINDER_FLAGS, Task.NOTIFY_AFTER_DEADLINE);
task.setTitle("water");
task.setDueDate(DateUtilities.now() + DateUtilities.ONE_DAY);
task.setReminderFlags(Task.NOTIFY_AFTER_DEADLINE);
taskDao.save(task);
// test due date in the past
task.setValue(Task.DUE_DATE, DateUtilities.now() - DateUtilities.ONE_DAY);
task.setDueDate(DateUtilities.now() - DateUtilities.ONE_DAY);
service.setScheduler(new AlarmExpected() {
@Override
public void createAlarm(Task task, long time, int type) {
@ -141,7 +141,7 @@ public class ReminderServiceTest extends TodorooRobolectricTestCase {
assertTrue(((AlarmExpected)service.getScheduler()).alarmCreated);
// test due date in the past, but recently notified
task.setValue(Task.REMINDER_LAST, DateUtilities.now());
task.setReminderLast(DateUtilities.now());
service.setScheduler(new AlarmExpected() {
@Override
public void createAlarm(Task task, long time, int type) {
@ -161,10 +161,10 @@ public class ReminderServiceTest extends TodorooRobolectricTestCase {
public void testMultipleReminders() {
// test due date in the future, enable random
final Task task = new Task();
task.setValue(Task.TITLE, "water");
task.setValue(Task.DUE_DATE, DateUtilities.now() + DateUtilities.ONE_WEEK);
task.setValue(Task.REMINDER_FLAGS, Task.NOTIFY_AT_DEADLINE);
task.setValue(Task.REMINDER_PERIOD, DateUtilities.ONE_HOUR);
task.setTitle("water");
task.setDueDate(DateUtilities.now() + DateUtilities.ONE_WEEK);
task.setReminderFlags(Task.NOTIFY_AT_DEADLINE);
task.setReminderPeriod(DateUtilities.ONE_HOUR);
service.setScheduler(new AlarmExpected() {
@Override
public void createAlarm(Task task, long time, int type) {
@ -180,13 +180,13 @@ public class ReminderServiceTest extends TodorooRobolectricTestCase {
assertTrue(((AlarmExpected)service.getScheduler()).alarmCreated);
// now set the due date in the past
task.setValue(Task.DUE_DATE, DateUtilities.now() - DateUtilities.ONE_WEEK);
task.setDueDate(DateUtilities.now() - DateUtilities.ONE_WEEK);
((AlarmExpected)service.getScheduler()).alarmCreated = false;
service.scheduleAlarm(task);
assertTrue(((AlarmExpected)service.getScheduler()).alarmCreated);
// now set the due date before the random
task.setValue(Task.DUE_DATE, DateUtilities.now() + DateUtilities.ONE_HOUR);
task.setDueDate(DateUtilities.now() + DateUtilities.ONE_HOUR);
service.setScheduler(new AlarmExpected() {
@Override
public void createAlarm(Task task, long time, int type) {
@ -207,10 +207,10 @@ public class ReminderServiceTest extends TodorooRobolectricTestCase {
// test due date and snooze in the future
final Task task = new Task();
task.setValue(Task.TITLE, "spacemen");
task.setValue(Task.DUE_DATE, DateUtilities.now() + 5000L);
task.setValue(Task.REMINDER_FLAGS, Task.NOTIFY_AT_DEADLINE);
task.setValue(Task.REMINDER_SNOOZE, DateUtilities.now() + DateUtilities.ONE_WEEK);
task.setTitle("spacemen");
task.setDueDate(DateUtilities.now() + 5000L);
task.setReminderFlags(Task.NOTIFY_AT_DEADLINE);
task.setReminderSnooze(DateUtilities.now() + DateUtilities.ONE_WEEK);
service.setScheduler(new AlarmExpected() {
@Override
public void createAlarm(Task task, long time, int type) {
@ -226,7 +226,7 @@ public class ReminderServiceTest extends TodorooRobolectricTestCase {
assertTrue(((AlarmExpected)service.getScheduler()).alarmCreated);
// snooze in the past
task.setValue(Task.REMINDER_SNOOZE, DateUtilities.now() - DateUtilities.ONE_WEEK);
task.setReminderSnooze(DateUtilities.now() - DateUtilities.ONE_WEEK);
service.setScheduler(new AlarmExpected() {
@Override
public void createAlarm(Task task, long time, int type) {

@ -43,7 +43,7 @@ public class AdvancedRepeatTest extends TodorooRobolectricTestCase {
public void before() {
super.before();
task = new Task();
task.setValue(Task.COMPLETION_DATE, DateUtilities.now());
task.setCompletionDate(DateUtilities.now());
rrule = new RRule();
}
@ -55,7 +55,7 @@ public class AdvancedRepeatTest extends TodorooRobolectricTestCase {
// test specific day & time
long dayWithTime = Task.createDueDate(Task.URGENCY_SPECIFIC_DAY_TIME, newDate(2010, 8, 1, 10, 4, 0).getTime());
task.setValue(Task.DUE_DATE, dayWithTime);
task.setDueDate(dayWithTime);
long nextDayWithTime = dayWithTime + DateUtilities.ONE_DAY;
nextDueDate = RepeatTaskCompleteListener.computeNextDueDate(task, rrule.toIcal(), false);
@ -68,7 +68,7 @@ public class AdvancedRepeatTest extends TodorooRobolectricTestCase {
// test specific day & time
long dayWithTime = Task.createDueDate(Task.URGENCY_SPECIFIC_DAY_TIME, newDate(2010, 8, 1, 10, 4, 0).getTime());
task.setValue(Task.DUE_DATE, dayWithTime);
task.setDueDate(dayWithTime);
Date todayWithTime = newDate();
todayWithTime.setHours(10);
@ -255,7 +255,7 @@ public class AdvancedRepeatTest extends TodorooRobolectricTestCase {
private void setTaskDueDate(int which, int day) {
long time = getDate(DateUtilities.now(), which, day);
task.setValue(Task.DUE_DATE, time);
task.setDueDate(time);
}
private long getDate(long start, int which, int dayOfWeek) {

@ -36,8 +36,8 @@ public class RepeatTaskCompleteListenerTest {
{
completionDate = new DateTime(2014, 1, 7, 17, 17, 32, 900).getMillis();
dueDate = new DateTime(2013, 12, 31, 17, 17, 32, 900).getMillis();
task.setValue(Task.DUE_DATE, dueDate);
task.setValue(Task.COMPLETION_DATE, completionDate);
task.setDueDate(dueDate);
task.setCompletionDate(completionDate);
}
@Test

@ -92,7 +92,7 @@ public class GtasksNewSyncTest extends DatabaseTestCase {
//Set new title on local task
String newTitle = "Astrid task 2 edited";
localTask.setValue(Task.TITLE, newTitle);
localTask.setTITLE(newTitle);
taskService.save(localTask);
whenInvokeSync();
@ -146,7 +146,7 @@ public class GtasksNewSyncTest extends DatabaseTestCase {
//Set new due date on local task
long newDueDate = Task.createDueDate(Task.URGENCY_SPECIFIC_DAY, new Date(116, 1, 8).getTime());
localTask.setValue(Task.DUE_DATE, newDueDate);
localTask.setDUE_DATE(newDueDate);
taskService.save(localTask);
whenInvokeSync();
@ -219,7 +219,7 @@ public class GtasksNewSyncTest extends DatabaseTestCase {
AndroidUtilities.sleepDeep(TIME_BETWEEN_SYNCS);
localTask.setValue(Task.DUE_DATE, newLocalDate);
localTask.setDUE_DATE(newLocalDate);
taskService.save(localTask);
whenInvokeSync();
@ -252,7 +252,7 @@ public class GtasksNewSyncTest extends DatabaseTestCase {
long newLocalDate = new Date(128, 5, 11).getTime();
long newRemoteDate = new Date(121, 5, 25).getTime();
localTask.setValue(Task.DUE_DATE, newLocalDate);
localTask.setDUE_DATE(newLocalDate);
taskService.save(localTask);
AndroidUtilities.sleepDeep(TIME_BETWEEN_SYNCS);
@ -279,7 +279,7 @@ public class GtasksNewSyncTest extends DatabaseTestCase {
date.setMinutes(0);
date.setSeconds(0);
long dueDate = date.getTime();
localTask.setValue(Task.DUE_DATE, dueDate);
localTask.setDUE_DATE(dueDate);
taskService.save(localTask);
return localTask;
@ -300,7 +300,7 @@ public class GtasksNewSyncTest extends DatabaseTestCase {
AndroidUtilities.sleepDeep(TIME_BETWEEN_SYNCS);
String newNote = "New local note";
localTask.setValue(Task.NOTES, newNote);
localTask.setNOTES(newNote);
taskService.save(localTask);
whenInvokeSync();
@ -354,7 +354,7 @@ public class GtasksNewSyncTest extends DatabaseTestCase {
String newLocalNote = "New local note";
String newRemoteNote = "New remote note";
localTask.setValue(Task.NOTES, newLocalNote);
localTask.setNOTES(newLocalNote);
taskService.save(localTask);
AndroidUtilities.sleepDeep(TIME_BETWEEN_SYNCS);
@ -373,7 +373,7 @@ public class GtasksNewSyncTest extends DatabaseTestCase {
private Task createLocalTaskForNoteTests(String addToTitle) {
Task localTask = createNewLocalTask("Note will change" + addToTitle);
String note = "Original note";
localTask.setValue(Task.NOTES, note);
localTask.setNOTES(note);
taskService.save(localTask);
return localTask;
@ -394,7 +394,7 @@ public class GtasksNewSyncTest extends DatabaseTestCase {
AndroidUtilities.sleepDeep(TIME_BETWEEN_SYNCS);
long completion = DateUtilities.now();
localTask.setValue(Task.COMPLETION_DATE, completion);
localTask.setCompletionDate(completion);
taskService.save(localTask);
whenInvokeSync();
@ -489,7 +489,7 @@ public class GtasksNewSyncTest extends DatabaseTestCase {
//Create a new Astrid task and save it to the database
private Task createNewLocalTask(String title) {
Task task = new Task();
task.setValue(Task.TITLE, title);
task.setTITLE(title);
taskService.save(task);
return task;
}

@ -67,7 +67,7 @@ public class GtasksSyncOnSaveTest extends DatabaseTestCase {
private Task setupLocalTaskModel(String title) {
Task localTask = new Task();
localTask.setValue(Task.TITLE, title);
localTask.setTITLE(title);
return localTask;
}
@ -84,7 +84,7 @@ public class GtasksSyncOnSaveTest extends DatabaseTestCase {
Task localTask = performBasicCreation("-title will change");
String newTitle = "Title has changed!";
localTask.setValue(Task.TITLE, newTitle);
localTask.setTITLE(newTitle);
taskService.save(localTask);
AndroidUtilities.sleepDeep(TIME_TO_WAIT);
@ -98,7 +98,7 @@ public class GtasksSyncOnSaveTest extends DatabaseTestCase {
Task localTask = performBasicCreation("-due date will change");
long dueDate = new Date(115, 2, 14).getTime();
localTask.setValue(Task.DUE_DATE, dueDate);
localTask.setDUE_DATE(dueDate);
taskService.save(localTask);
AndroidUtilities.sleepDeep(TIME_TO_WAIT);
@ -112,7 +112,7 @@ public class GtasksSyncOnSaveTest extends DatabaseTestCase {
Task localTask = performBasicCreation("-notes will change");
String notes = "Noted!";
localTask.setValue(Task.NOTES, notes);
localTask.setNOTES(notes);
taskService.save(localTask);
AndroidUtilities.sleepDeep(TIME_TO_WAIT);
@ -126,7 +126,7 @@ public class GtasksSyncOnSaveTest extends DatabaseTestCase {
Task localTask = performBasicCreation("-will be completed");
long completionDate = (DateUtilities.now() / 1000L) * 1000L;
localTask.setValue(Task.COMPLETION_DATE, completionDate);
localTask.setCompletionDate(completionDate);
taskService.save(localTask);
AndroidUtilities.sleepDeep(TIME_TO_WAIT);
@ -141,7 +141,7 @@ public class GtasksSyncOnSaveTest extends DatabaseTestCase {
Task localTask = performBasicCreation("-will be deleted");
long deletionDate = DateUtilities.now();
localTask.setValue(Task.DELETION_DATE, deletionDate);
localTask.setDELETION_DATE(deletionDate);
taskService.save(localTask);
AndroidUtilities.sleepDeep(TIME_TO_WAIT);

@ -86,7 +86,7 @@ abstract public class AbstractSyncRepeatTests<REMOTE_MODEL> extends DatabaseTest
protected long setCompletionDate(boolean completeBefore, Task t,
REMOTE_MODEL remoteModel, long dueDate) {
long completionDate = DateUtilities.now();
t.setValue(Task.COMPLETION_DATE, completionDate);
t.setCompletionDate(completionDate);
saveAndTriggerRepeatListener(t);
return completionDate;
}
@ -103,10 +103,10 @@ abstract public class AbstractSyncRepeatTests<REMOTE_MODEL> extends DatabaseTest
public void testNoRepeat() {
Task t = new Task();
t.setValue(Task.TITLE, "no repeat");
t.setTITLE("no repeat");
taskDao.save(t);
t.setValue(Task.COMPLETION_DATE, DateUtilities.now());
t.setCompletionDate(DateUtilities.now());
saveAndTriggerRepeatListener(t);
TodorooCursor<Task> cursor = taskDao.query(Query.select(Task.ID));
@ -120,11 +120,11 @@ abstract public class AbstractSyncRepeatTests<REMOTE_MODEL> extends DatabaseTest
protected void testRepeating(boolean completeBefore, boolean fromCompletion,
RRule rrule, Frequency frequency, String title) {
Task t = new Task();
t.setValue(Task.TITLE, title);
t.setTITLE(title);
long dueDate = DateUtilities.now() + ((completeBefore ? -1 : 1) * DateUtilities.ONE_DAY * 3);
dueDate = Task.createDueDate(Task.URGENCY_SPECIFIC_DAY_TIME, (dueDate / 1000L) * 1000L); // Strip milliseconds
t.setValue(Task.DUE_DATE, dueDate);
t.setDUE_DATE(dueDate);
if (rrule == null) {
rrule = new RRule();
@ -137,7 +137,7 @@ abstract public class AbstractSyncRepeatTests<REMOTE_MODEL> extends DatabaseTest
if (fromCompletion)
result = result + ";FROM=COMPLETION";
t.setValue(Task.RECURRENCE, rrule.toIcal());
t.setRECURRENCE(rrule.toIcal());
taskDao.save(t);
waitAndSync();

Loading…
Cancel
Save