Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchris.poon2015-11-26 18:42:37 -0500
committerGerrit Code Review @ Eclipse.org2015-11-30 14:54:36 -0500
commit262b4f0876b7abae93c83d7747295f0b3d1d268c (patch)
tree52ee15a955edcb2a5d126cf022703d80191b4f28 /org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal
parent11fb814632a825d3ee291ff6fdd53dd0a3a627ad (diff)
downloadorg.eclipse.mylyn.tasks-262b4f0876b7abae93c83d7747295f0b3d1d268c.tar.gz
org.eclipse.mylyn.tasks-262b4f0876b7abae93c83d7747295f0b3d1d268c.tar.xz
org.eclipse.mylyn.tasks-262b4f0876b7abae93c83d7747295f0b3d1d268c.zip
463022: [api] add support for storing usernames on RepositoryPerson
Change-Id: Id565b10626461759e0322bcbbbd37e628e27eafb Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=463022 Signed-off-by: chris.poon <chris.poon@tasktop.com>
Diffstat (limited to 'org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal')
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/RepositoryPerson.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/RepositoryPerson.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/RepositoryPerson.java
index 87358d841..817e64c76 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/RepositoryPerson.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/RepositoryPerson.java
@@ -11,8 +11,14 @@
package org.eclipse.mylyn.internal.tasks.core;
+import java.util.HashMap;
+import java.util.Map;
+
import org.eclipse.mylyn.tasks.core.IRepositoryPerson;
import org.eclipse.mylyn.tasks.core.TaskRepository;
+import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
+
+import com.google.common.collect.ImmutableMap;
/**
* @author Steffen Pingel
@@ -25,6 +31,8 @@ public class RepositoryPerson implements IRepositoryPerson {
private final TaskRepository taskRepository;
+ private final Map<String, String> attributes = new HashMap<>();
+
public RepositoryPerson(TaskRepository taskRepository, String personId) {
this.taskRepository = taskRepository;
this.personId = personId;
@@ -50,10 +58,30 @@ public class RepositoryPerson implements IRepositoryPerson {
return taskRepository;
}
+ public String getAttribute(String key) {
+ return attributes.get(key);
+ }
+
+ public Map<String, String> getAttributes() {
+ return ImmutableMap.copyOf(attributes);
+ }
+
public void setName(String name) {
this.name = name;
}
+ public void setAttribute(String key, String value) {
+ attributes.put(key, value);
+ }
+
+ public boolean matchesUsername(String username) {
+ String thisUsername = attributes.get(TaskAttribute.PERSON_USERNAME);
+ if (thisUsername != null) {
+ return thisUsername.equals(username);
+ }
+ return getPersonId().equals(username);
+ }
+
@Override
public String toString() {
if (getName() == null) {

Back to the top