Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Davis2015-11-25 15:42:14 -0500
committerSam Davis2015-11-25 16:16:58 -0500
commit87ae1b0d5411a18b8c69f41fe992bbaaa114860b (patch)
tree04e145528c3abfac1c946b7545f6493fb6c6b556
parent335845982b92dd656e781e26e7ab1d64cc28d049 (diff)
downloadorg.eclipse.mylyn.tasks-87ae1b0d5411a18b8c69f41fe992bbaaa114860b.tar.gz
org.eclipse.mylyn.tasks-87ae1b0d5411a18b8c69f41fe992bbaaa114860b.tar.xz
org.eclipse.mylyn.tasks-87ae1b0d5411a18b8c69f41fe992bbaaa114860b.zip
483036: owner ID is not persisted
Change-Id: Idbf3e63a71bb040c3e82eaf3d95180fb4ef1ae4d Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=483036
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/DelegatingTaskExternalizer.java8
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskListExternalizationTest.java27
2 files changed, 35 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/DelegatingTaskExternalizer.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/DelegatingTaskExternalizer.java
index 7ad02d505..600209639 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/DelegatingTaskExternalizer.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/DelegatingTaskExternalizer.java
@@ -157,6 +157,8 @@ public final class DelegatingTaskExternalizer {
static final String KEY_OWNER = "Owner"; //$NON-NLS-1$
+ static final String KEY_OWNER_ID = "OwnerId"; //$NON-NLS-1$
+
static final String KEY_MARK_READ_PENDING = "MarkReadPending"; //$NON-NLS-1$
static final String KEY_STALE = "Stale"; //$NON-NLS-1$
@@ -286,6 +288,9 @@ public final class DelegatingTaskExternalizer {
if (task.getOwner() != null) {
node.setAttribute(KEY_OWNER, task.getOwner());
}
+ if (task.getOwnerId() != null) {
+ node.setAttribute(KEY_OWNER_ID, task.getOwnerId());
+ }
createAttributes(task, doc, node);
for (ITask t : task.getChildren()) {
createTaskReference(KEY_SUBTASK, t, doc, node);
@@ -613,6 +618,9 @@ public final class DelegatingTaskExternalizer {
if (element.hasAttribute(KEY_OWNER)) {
task.setOwner(element.getAttribute(KEY_OWNER));
}
+ if (element.hasAttribute(KEY_OWNER_ID)) {
+ task.setOwnerId(element.getAttribute(KEY_OWNER_ID));
+ }
if (VAL_TRUE.equals(element.getAttribute(KEY_NOTIFIED_INCOMING))) {
task.setNotified(true);
} else {
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskListExternalizationTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskListExternalizationTest.java
index 3afd1a644..832185b7f 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskListExternalizationTest.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TaskListExternalizationTest.java
@@ -415,6 +415,33 @@ public class TaskListExternalizationTest extends TestCase {
}
}
+ @SuppressWarnings("null")
+ public void testOwnerPersistance() throws Exception {
+ String bugNumber = "106939";
+ ITask task = TasksUi.getRepositoryModel().createTask(repository, bugNumber);
+ TaskTask task1 = null;
+ if (task instanceof TaskTask) {
+ task1 = (TaskTask) task;
+ }
+ assertNotNull(task1);
+
+ TasksUiPlugin.getTaskList().addTask(task1);
+
+ task1.setOwner("Joel User");
+ task1.setOwnerId("joel.user");
+ TaskTestUtil.saveAndReadTasklist();
+
+ TaskList taskList = TasksUiPlugin.getTaskList();
+ assertEquals(1, taskList.getAllTasks().size());
+ Set<ITask> tasksReturned = taskList.getTasks(MockRepositoryConnector.REPOSITORY_URL);
+ assertNotNull(tasksReturned);
+ assertEquals(1, tasksReturned.size());
+ for (ITask taskRet : tasksReturned) {
+ assertEquals("Joel User", taskRet.getOwner());
+ assertEquals("joel.user", taskRet.getOwnerId());
+ }
+ }
+
public void testRepositoryTaskExternalization() throws Exception {
TaskTask task = (TaskTask) TasksUi.getRepositoryModel().createTask(repository, "1");
task.setTaskKind("kind");

Back to the top