Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2010-07-14 17:07:36 +0000
committerspingel2010-07-14 17:07:36 +0000
commit24d85f9b76538078c8d6a3cf9589419e8338249f (patch)
tree7e79ecc00f9482535cf51dbf18fdb4a8a40562c0 /org.eclipse.mylyn.tasks.core
parent46b8c62d63d7b4d3a44bd2a2082e1289c44592f5 (diff)
downloadorg.eclipse.mylyn.tasks-24d85f9b76538078c8d6a3cf9589419e8338249f.tar.gz
org.eclipse.mylyn.tasks-24d85f9b76538078c8d6a3cf9589419e8338249f.tar.xz
org.eclipse.mylyn.tasks-24d85f9b76538078c8d6a3cf9589419e8338249f.zip
NEW - bug 319397: [patch][api] let the connector be able to define task ownership definition
https://bugs.eclipse.org/bugs/show_bug.cgi?id=319397
Diffstat (limited to 'org.eclipse.mylyn.tasks.core')
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskRepositoryManager.java12
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java18
2 files changed, 25 insertions, 5 deletions
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskRepositoryManager.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskRepositoryManager.java
index ff7cf1680..505623e7b 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskRepositoryManager.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskRepositoryManager.java
@@ -8,6 +8,7 @@
* Contributors:
* Tasktop Technologies - initial API and implementation
* Jevgeni Holodkov - improvements
+ * Atlassian - improvements for bug 319397
*******************************************************************************/
package org.eclipse.mylyn.internal.tasks.core;
@@ -481,12 +482,13 @@ public class TaskRepositoryManager implements IRepositoryManager {
return true;
}
- ITask repositoryTask = task;
- TaskRepository repository = getRepository(repositoryTask.getConnectorKind(), repositoryTask.getRepositoryUrl());
- if (repository != null && repositoryTask.getOwner() != null) {
- return repositoryTask.getOwner().equals(repository.getUserName());
+ AbstractRepositoryConnector connector = getRepositoryConnector(task.getConnectorKind());
+ if (connector != null) {
+ TaskRepository repository = getRepository(task.getConnectorKind(), task.getRepositoryUrl());
+ if (repository != null) {
+ return connector.isOwnedByUser(repository, task);
+ }
}
-
return false;
}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java
index 51a8fc765..1aca43f78 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java
@@ -7,6 +7,7 @@
*
* Contributors:
* Tasktop Technologies - initial API and implementation
+ * Atlassian - improvements for bug 319397
*******************************************************************************/
package org.eclipse.mylyn.tasks.core;
@@ -358,4 +359,21 @@ public abstract class AbstractRepositoryConnector {
public void migrateTask(TaskMigrationEvent event) {
}
+ /**
+ * Returns if the user using the repository is the owner of the task. Subclasses may override.
+ *
+ * @param repository
+ * repository task is associated with
+ * @param task
+ * task to determined ownership of
+ * @return true if user using the repository is owner of the task
+ * @since 3.5
+ */
+ public boolean isOwnedByUser(TaskRepository repository, ITask task) {
+ if (task.getOwner() != null) {
+ return task.getOwner().equals(repository.getUserName());
+ }
+ return false;
+ }
+
}

Back to the top