summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Sawicki2011-04-12 14:59:22 (EDT)
committer Chris Aniszczyk2011-04-12 22:54:00 (EDT)
commitc3097d3e73ca2c1944deea5e01b552ca0453bff5 (patch)
treeac727b3a2b73820e3e75c7e27b246dbde4e6770c
parentab165b5a1dda36e4bc1d01e6c1c234731f6a4332 (diff)
downloadegit-github-c3097d3e73ca2c1944deea5e01b552ca0453bff5.zip
egit-github-c3097d3e73ca2c1944deea5e01b552ca0453bff5.tar.gz
egit-github-c3097d3e73ca2c1944deea5e01b552ca0453bff5.tar.bz2
Set issue task data as partial when returned via a queryrefs/changes/78/3078/2
Issues are missing milestone and assignee information when obtained via a query. Change-Id: Iac3ddace2e83584d53ba37881aae1651f29ca691 Signed-off-by: Kevin Sawicki <kevin@github.com> Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com>
-rw-r--r--org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubRepositoryConnector.java6
-rw-r--r--org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubTaskAttributes.java169
-rw-r--r--org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubTaskDataHandler.java21
3 files changed, 145 insertions, 51 deletions
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubRepositoryConnector.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubRepositoryConnector.java
index 477c7a7..f07b300 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubRepositoryConnector.java
+++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubRepositoryConnector.java
@@ -285,8 +285,9 @@ public class GitHubRepositoryConnector extends AbstractRepositoryConnector {
// collect task data
for (Issue issue : issues) {
- TaskData taskData = taskDataHandler.createPartialTaskData(
+ TaskData taskData = taskDataHandler.createTaskData(
repository, monitor, user, project, issue);
+ taskData.setPartial(true);
collector.accept(taskData);
}
monitor.worked(1);
@@ -361,9 +362,6 @@ public class GitHubRepositoryConnector extends AbstractRepositoryConnector {
@Override
public boolean hasTaskChanged(TaskRepository repository, ITask task,
TaskData taskData) {
- if (taskData.isPartial())
- return new TaskMapper(taskData).hasChanges(task);
-
TaskAttribute modAttribute = taskData.getRoot().getAttribute(
TaskAttribute.DATE_MODIFICATION);
if (modAttribute == null)
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubTaskAttributes.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubTaskAttributes.java
index 5b8edd3..1b6cd3b 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubTaskAttributes.java
+++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubTaskAttributes.java
@@ -14,64 +14,177 @@ package org.eclipse.mylyn.github.internal;
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
+/**
+ * GitHub issue task attributes
+ */
public enum GitHubTaskAttributes {
- KEY("Key",TaskAttribute.TASK_KEY,TaskAttribute.TYPE_SHORT_TEXT,true,true,true),
- TITLE("Summary",TaskAttribute.SUMMARY,TaskAttribute.TYPE_SHORT_RICH_TEXT,true,false,true),
- BODY("Description",TaskAttribute.DESCRIPTION,TaskAttribute.TYPE_LONG_RICH_TEXT,true,false,true),
-
- CREATION_DATE("Created:",TaskAttribute.DATE_CREATION,TaskAttribute.TYPE_DATETIME,true,true,false),
- MODIFICATION_DATE("Modified:",TaskAttribute.DATE_MODIFICATION,TaskAttribute.TYPE_DATETIME,true,true,false),
- CLOSED_DATE("Closed:",TaskAttribute.DATE_COMPLETION,TaskAttribute.TYPE_DATETIME,false,true,false),
-
- STATUS("Status:",TaskAttribute.STATUS,TaskAttribute.TYPE_SHORT_TEXT,true,false,true),
- REPORTER("Reporter:", TaskAttribute.USER_REPORTER, TaskAttribute.TYPE_PERSON, true, true, false),
- COMMENT_NEW("Comment:", TaskAttribute.COMMENT_NEW, TaskAttribute.TYPE_LONG_RICH_TEXT, false, false, false),
- LABELS("Labels:", "github.issue.labels", TaskAttribute.TYPE_MULTI_SELECT, true, true, false),
- ASSIGNEE("Assignee:", TaskAttribute.USER_ASSIGNED, TaskAttribute.TYPE_PERSON, true, false, true),
- MILESTONE("Milestone:", "github.issue.milestone", TaskAttribute.TYPE_SINGLE_SELECT, true, false, true),
- ASSIGNEE_GRAVATAR("Assignee", "github.issue.assignee.gravatar", TaskAttribute.TYPE_URL, false, true, false),
- REPORTER_GRAVATAR("Reporter", "github.issue.reporter.gravatar", TaskAttribute.TYPE_URL, false, true, false),
- ;
+ /**
+ * Issue key
+ */
+ KEY(Messages.GitHubTaskAttributes_LabelKey, TaskAttribute.TASK_KEY,
+ TaskAttribute.TYPE_SHORT_TEXT, true, true),
+
+ /**
+ * Issue title
+ */
+ TITLE(Messages.GitHubTaskAttributes_LabekSummary, TaskAttribute.SUMMARY,
+ TaskAttribute.TYPE_SHORT_RICH_TEXT, false, true),
+
+ /**
+ * Issue description
+ */
+ BODY(Messages.GitHubTaskAttributes_LabelDescription,
+ TaskAttribute.DESCRIPTION, TaskAttribute.TYPE_LONG_RICH_TEXT,
+ false, true),
+
+ /**
+ * Issue creation date
+ */
+ CREATION_DATE(Messages.GitHubTaskAttributes_LabelCreated,
+ TaskAttribute.DATE_CREATION, TaskAttribute.TYPE_DATETIME, true,
+ false),
+
+ /**
+ * Issue modification date
+ */
+ MODIFICATION_DATE(Messages.GitHubTaskAttributes_LabelModified,
+ TaskAttribute.DATE_MODIFICATION, TaskAttribute.TYPE_DATETIME, true,
+ false),
+
+ /**
+ * Issue closed date
+ */
+ CLOSED_DATE(Messages.GitHubTaskAttributes_LabelClosed,
+ TaskAttribute.DATE_COMPLETION, TaskAttribute.TYPE_DATETIME, true,
+ false),
+
+ /**
+ * Issue status
+ */
+ STATUS(Messages.GitHubTaskAttributes_LabelStatus, TaskAttribute.STATUS,
+ TaskAttribute.TYPE_SHORT_TEXT, false, true),
+
+ /**
+ * Issue reporter
+ */
+ REPORTER(Messages.GitHubTaskAttributes_LabelReporter,
+ TaskAttribute.USER_REPORTER, TaskAttribute.TYPE_PERSON, true, false),
+
+ /**
+ * Comment being added to issue
+ */
+ COMMENT_NEW(Messages.GitHubTaskAttributes_LabelComment,
+ TaskAttribute.COMMENT_NEW, TaskAttribute.TYPE_LONG_RICH_TEXT,
+ false, false),
+
+ /**
+ * Labels applied to issue
+ */
+ LABELS(Messages.GitHubTaskAttributes_LabelLabels, "github.issue.labels", //$NON-NLS-1$
+ TaskAttribute.TYPE_MULTI_SELECT, true, false),
+
+ /**
+ * Issue assignee
+ */
+ ASSIGNEE(Messages.GitHubTaskAttributes_LabelAssignee,
+ TaskAttribute.USER_ASSIGNED, TaskAttribute.TYPE_PERSON, false, true),
+
+ /**
+ * Issue milestone
+ */
+ MILESTONE(Messages.GitHubTaskAttributes_LabelMilestone,
+ "github.issue.milestone", TaskAttribute.TYPE_SINGLE_SELECT, //$NON-NLS-1$
+ false, true),
+
+ /**
+ * Issue assignee gravatar
+ */
+ ASSIGNEE_GRAVATAR(Messages.GitHubTaskAttributes_LabelAssigneeGravatar,
+ "github.issue.assignee.gravatar", TaskAttribute.TYPE_URL, null, //$NON-NLS-1$
+ true, false),
+
+ /**
+ * Issue reporter gravatar
+ */
+ REPORTER_GRAVATAR(Messages.GitHubTaskAttributes_LabelReporterGravatar,
+ "github.issue.reporter.gravatar", TaskAttribute.TYPE_URL, null, //$NON-NLS-1$
+ true, false);
private final String id;
private final String label;
+ private final String kind;
private final boolean readOnly;
private final boolean initTask;
- private final boolean requiredForFullTaskData;
private final String type;
-
- private GitHubTaskAttributes(String label, String id,String type,boolean requiredForFullTaskData, boolean readOnly, boolean initTask) {
+
+ private GitHubTaskAttributes(String label, String id, String type,
+ boolean readOnly, boolean initTask) {
+ this(label, id, type, TaskAttribute.KIND_DEFAULT, readOnly, initTask);
+ }
+
+ private GitHubTaskAttributes(String label, String id, String type,
+ String kind, boolean readOnly, boolean initTask) {
this.label = label;
- this.requiredForFullTaskData = requiredForFullTaskData;
- this.id = id==null?"github."+name():id;
+ this.id = id;
+ this.kind = kind;
this.type = type;
this.readOnly = readOnly;
this.initTask = initTask;
}
-
+
+ /**
+ * Get attribute label
+ *
+ * @return label
+ */
public String getLabel() {
return label;
}
+
+ /**
+ * Get attribute id
+ *
+ * @return id
+ */
public String getId() {
return id;
}
+
+ /**
+ * Get attribute type
+ *
+ * @return type
+ */
public String getType() {
return type;
}
+
+ /**
+ * Is attribute read only?
+ *
+ * @return true if read only, false otherwise
+ */
public boolean isReadOnly() {
return readOnly;
}
+ /**
+ * Get attribute kind
+ *
+ * @return kind
+ */
public String getKind() {
- return TaskAttribute.KIND_DEFAULT;
+ return this.kind;
}
-
+
+ /**
+ * Is this attribute created for new tasks?
+ *
+ * @return true if needed for new tasks, false otherwise
+ */
public boolean isInitTask() {
return initTask;
}
- public boolean isRequiredForFullTaskData() {
- return requiredForFullTaskData;
- }
}
diff --git a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubTaskDataHandler.java b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubTaskDataHandler.java
index 9e478ab..7150deb 100644
--- a/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubTaskDataHandler.java
+++ b/org.eclipse.mylyn.github.core/src/org/eclipse/mylyn/github/internal/GitHubTaskDataHandler.java
@@ -54,7 +54,7 @@ public class GitHubTaskDataHandler extends AbstractTaskDataHandler {
return this.taskAttributeMapper;
}
- public TaskData createPartialTaskData(TaskRepository repository,
+ public TaskData createTaskData(TaskRepository repository,
IProgressMonitor monitor, String user, String project, Issue issue) {
String key = Integer.toString(issue.getNumber());
@@ -95,26 +95,9 @@ public class GitHubTaskDataHandler extends AbstractTaskDataHandler {
createAttribute(data, GitHubTaskAttributes.COMMENT_NEW, "");
createAttribute(data, GitHubTaskAttributes.LABELS, issue.getLabels());
- if (isPartial(data)) {
- data.setPartial(true);
- }
-
return data;
}
- private boolean isPartial(TaskData data) {
- for (GitHubTaskAttributes attribute : GitHubTaskAttributes.values()) {
- if (attribute.isRequiredForFullTaskData()) {
- TaskAttribute taskAttribute = data.getRoot().getAttribute(
- attribute.getId());
- if (taskAttribute == null) {
- return true;
- }
- }
- }
- return false;
- }
-
private void createOperations(TaskData data, Issue issue) {
TaskAttribute operationAttribute = data.getRoot().createAttribute(
TaskAttribute.OPERATION);
@@ -155,7 +138,7 @@ public class GitHubTaskDataHandler extends AbstractTaskDataHandler {
public TaskData createTaskData(TaskRepository repository,
IProgressMonitor monitor, String user, String project, Issue issue,
List<Comment> comments) {
- TaskData taskData = createPartialTaskData(repository, monitor, user,
+ TaskData taskData = createTaskData(repository, monitor, user,
project, issue);
taskData.setPartial(false);