Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Davis2014-10-06 17:24:16 -0400
committerSam Davis2015-03-11 17:02:17 -0400
commitdd62414dd526d7a08da6f8f3ecd85dd52d049e2f (patch)
tree5e3d168f2af0714f415309137815bd33a6ff74a7 /org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data
parent66369afb5c49a63829059cb2ec1d9663f2159833 (diff)
downloadorg.eclipse.mylyn.tasks-dd62414dd526d7a08da6f8f3ecd85dd52d049e2f.tar.gz
org.eclipse.mylyn.tasks-dd62414dd526d7a08da6f8f3ecd85dd52d049e2f.tar.xz
org.eclipse.mylyn.tasks-dd62414dd526d7a08da6f8f3ecd85dd52d049e2f.zip
446091: [api] allow clients to determine when the current user owns an
ITask Change-Id: Ie6fb5d4c27fd31be4f4127be7fc82e892b503466 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=446091
Diffstat (limited to 'org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data')
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskMapper.java30
1 files changed, 29 insertions, 1 deletions
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskMapper.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskMapper.java
index c9b35586f..ff5dbe7ef 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskMapper.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/data/TaskMapper.java
@@ -64,6 +64,10 @@ public class TaskMapper implements ITaskMapping {
task.setOwner(getOwner());
changed = true;
}
+ if (hasChanges(task.getOwnerId(), getOwnerId(), TaskAttribute.USER_ASSIGNED)) {
+ task.setOwnerId(getOwnerId());
+ changed = true;
+ }
if (hasChanges(task.getPriority(), getPriorityLevelString(), TaskAttribute.PRIORITY)) {
task.setPriority(getPriorityLevelString());
changed = true;
@@ -135,7 +139,7 @@ public class TaskMapper implements ITaskMapping {
* <li>description
* </ul>
* Other attribute values are only set if they exist on <code>sourceTaskData</code> and <code>targetTaskData</code>.
- *
+ *
* @param sourceTaskData
* the source task data values are copied from, the connector kind of repository of
* <code>sourceTaskData</code> can be different from <code>targetTaskData</code>
@@ -265,6 +269,14 @@ public class TaskMapper implements ITaskMapping {
return getValue(TaskAttribute.USER_ASSIGNED);
}
+ /**
+ * @since 3.15
+ */
+ @Nullable
+ public String getOwnerId() {
+ return getValueId(TaskAttribute.USER_ASSIGNED);
+ }
+
@Nullable
public String getPriority() {
return getValue(TaskAttribute.PRIORITY);
@@ -334,6 +346,9 @@ public class TaskMapper implements ITaskMapping {
return getValue(TaskAttribute.TASK_URL);
}
+ /**
+ * Returns the label of the attribute value.
+ */
@Nullable
public String getValue(@NonNull String attributeKey) {
TaskAttribute attribute = taskData.getRoot().getMappedAttribute(attributeKey);
@@ -343,6 +358,18 @@ public class TaskMapper implements ITaskMapping {
return null;
}
+ /**
+ * Returns the id of the attribute value.
+ */
+ @Nullable
+ private String getValueId(@NonNull String attributeKey) {
+ TaskAttribute attribute = taskData.getRoot().getMappedAttribute(attributeKey);
+ if (attribute != null) {
+ return taskData.getAttributeMapper().getValue(attribute);
+ }
+ return null;
+ }
+
@Nullable
private List<String> getValues(@NonNull String attributeKey) {
TaskAttribute attribute = taskData.getRoot().getMappedAttribute(attributeKey);
@@ -367,6 +394,7 @@ public class TaskMapper implements ITaskMapping {
changed |= hasChanges(task.getModificationDate(), getModificationDate(), TaskAttribute.DATE_MODIFICATION);
changed |= hasChanges(task.getDueDate(), getDueDate(), TaskAttribute.DATE_DUE);
changed |= hasChanges(task.getOwner(), getOwner(), TaskAttribute.USER_ASSIGNED);
+ changed |= hasChanges(task.getOwnerId(), getOwnerId(), TaskAttribute.USER_ASSIGNED);
changed |= hasChanges(task.getPriority(), getPriorityLevelString(), TaskAttribute.PRIORITY);
changed |= hasChanges(task.getSummary(), getSummary(), TaskAttribute.SUMMARY);
changed |= hasChanges(task.getTaskKey(), getTaskKey(), TaskAttribute.TASK_KEY);

Back to the top