Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2007-02-13 18:12:01 -0500
committermkersten2007-02-13 18:12:01 -0500
commitc102ee5935f75cc8941f1cfb563b071b2dc499d7 (patch)
tree55c8e9f72354a98d30d11342b11cfb4b1082c736 /org.eclipse.mylyn.tasks.core
parent5f274da8f43c3ef71b33938ef7d219e1ee11efd4 (diff)
downloadorg.eclipse.mylyn.tasks-c102ee5935f75cc8941f1cfb563b071b2dc499d7.tar.gz
org.eclipse.mylyn.tasks-c102ee5935f75cc8941f1cfb563b071b2dc499d7.tar.xz
org.eclipse.mylyn.tasks-c102ee5935f75cc8941f1cfb563b071b2dc499d7.zip
NEW - bug 149624: [api] AbstractRepositoryTask repositoryUrl and task id should not be derived from handleIdentifier
https://bugs.eclipse.org/bugs/show_bug.cgi?id=149624
Diffstat (limited to 'org.eclipse.mylyn.tasks.core')
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/WebQueryHit.java10
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/.AbstractRepositoryTask.java14
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractQueryHit.java16
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java2
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryQuery.java2
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryTask.java14
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTaskContainer.java2
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DateRangeActivityDelegate.java4
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DateRangeContainer.java4
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DelegatingTaskExternalizer.java191
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITask.java2
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskListExternalizer.java4
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryTaskData.java2
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/Task.java23
14 files changed, 172 insertions, 118 deletions
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/WebQueryHit.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/WebQueryHit.java
index 104a502f8..71b838b5f 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/WebQueryHit.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/WebQueryHit.java
@@ -38,13 +38,13 @@ public class WebQueryHit extends AbstractQueryHit {
@Override
protected AbstractRepositoryTask createTask() {
- return new WebTask(taskId, description, taskPrefix, repositoryUrl, WebTask.REPOSITORY_TYPE);
+ return new WebTask(taskId, summary, taskPrefix, repositoryUrl, WebTask.REPOSITORY_TYPE);
}
- @Override
- public String getHandleIdentifier() {
- return taskPrefix + getTaskId();
- }
+// @Override
+// public String getHandleIdentifier() {
+// return taskPrefix + getTaskId();
+// }
public String getTaskPrefix() {
return this.taskPrefix;
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/.AbstractRepositoryTask.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/.AbstractRepositoryTask.java
index 3681a805a..26932a56e 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/.AbstractRepositoryTask.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/.AbstractRepositoryTask.java
@@ -50,8 +50,9 @@ public abstract class AbstractRepositoryTask extends Task {
protected IStatus status = null;
- public AbstractRepositoryTask(String repositoryUrl, String taskId, String label, boolean newTask) {
- super(null, label, newTask);
+ public AbstractRepositoryTask(String repositoryUrl, String taskId, String summary, boolean newTask) {
+ // NOTE: Repository tasks specify their own handle format.
+ super(null, summary, newTask);
this.repositoryUrl = repositoryUrl;
this.taskId = taskId;
}
@@ -93,14 +94,6 @@ public abstract class AbstractRepositoryTask extends Task {
return false;
}
-// public static long getLastRefreshTimeInMinutes(Date lastRefresh) {
-// Date timeNow = new Date();
-// if (lastRefresh == null)
-// lastRefresh = new Date();
-// long timeDifference = (timeNow.getTime() - lastRefresh.getTime()) / 60000;
-// return timeDifference;
-// }
-
public boolean isSynchronizing() {
return currentlySynchronizing;
}
@@ -115,7 +108,6 @@ public abstract class AbstractRepositoryTask extends Task {
*/
public String getIdentifyingLabel() {
return taskId;
-// return RepositoryTaskHandleUtil.getTaskId(handleIdentifier);
}
public boolean isDirty() {
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractQueryHit.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractQueryHit.java
index f47ca6bd5..7bd016f86 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractQueryHit.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractQueryHit.java
@@ -25,7 +25,7 @@ public abstract class AbstractQueryHit implements ITaskListElement {
protected String repositoryUrl;
- protected String description;
+ protected String summary;
protected String priority = PriorityLevel.getDefault().toString();
@@ -37,11 +37,11 @@ public abstract class AbstractQueryHit implements ITaskListElement {
private AbstractRepositoryQuery parent;
- protected AbstractQueryHit(TaskList taskList, String repositoryUrl, String description, String id) {
+ protected AbstractQueryHit(TaskList taskList, String repositoryUrl, String description, String taskId) {
this.taskList = taskList;
this.repositoryUrl = repositoryUrl;
- this.description = description;
- this.taskId = id;
+ this.summary = description;
+ this.taskId = taskId;
}
public AbstractRepositoryQuery getParent() {
@@ -64,7 +64,7 @@ public abstract class AbstractQueryHit implements ITaskListElement {
if (task != null) {
return task.getSummary();
} else {
- return description;
+ return summary;
}
}
@@ -109,7 +109,7 @@ public abstract class AbstractQueryHit implements ITaskListElement {
this.completed = completed;
}
- public String getHandleIdentifier() {
+ public final String getHandleIdentifier() {
if (task != null) {
return task.getHandleIdentifier();
}
@@ -173,8 +173,8 @@ public abstract class AbstractQueryHit implements ITaskListElement {
this.priority = priority;
}
- public void setDescription(String description) {
- this.description = description;
+ public void setSummary(String description) {
+ this.summary = description;
}
public void setHandleIdentifier(String id) {
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 b225cbb62..431420f2f 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
@@ -95,7 +95,7 @@ public abstract class AbstractRepositoryConnector {
IProgressMonitor monitor, QueryHitCollector resultCollector);
/**
- * The connector's description i.e. "JIRA (supports 3.3.1 and later)"
+ * The connector's summary i.e. "JIRA (supports 3.3.1 and later)"
*/
public abstract String getLabel();
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryQuery.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryQuery.java
index 1465c6bbe..4d4125fa0 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryQuery.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryQuery.java
@@ -97,7 +97,7 @@ public abstract class AbstractRepositoryQuery extends AbstractTaskContainer {
hit.setCorrespondingTask((AbstractRepositoryTask) correspondingTask);
}
}
- // Always replace even if exists (may have new description etc.)
+ // Always replace even if exists (may have new summary etc.)
taskList.addQueryHit(hit);
// TODO: this is meaningless since only one hit object exists now
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryTask.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryTask.java
index 3681a805a..26932a56e 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryTask.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryTask.java
@@ -50,8 +50,9 @@ public abstract class AbstractRepositoryTask extends Task {
protected IStatus status = null;
- public AbstractRepositoryTask(String repositoryUrl, String taskId, String label, boolean newTask) {
- super(null, label, newTask);
+ public AbstractRepositoryTask(String repositoryUrl, String taskId, String summary, boolean newTask) {
+ // NOTE: Repository tasks specify their own handle format.
+ super(null, summary, newTask);
this.repositoryUrl = repositoryUrl;
this.taskId = taskId;
}
@@ -93,14 +94,6 @@ public abstract class AbstractRepositoryTask extends Task {
return false;
}
-// public static long getLastRefreshTimeInMinutes(Date lastRefresh) {
-// Date timeNow = new Date();
-// if (lastRefresh == null)
-// lastRefresh = new Date();
-// long timeDifference = (timeNow.getTime() - lastRefresh.getTime()) / 60000;
-// return timeDifference;
-// }
-
public boolean isSynchronizing() {
return currentlySynchronizing;
}
@@ -115,7 +108,6 @@ public abstract class AbstractRepositoryTask extends Task {
*/
public String getIdentifyingLabel() {
return taskId;
-// return RepositoryTaskHandleUtil.getTaskId(handleIdentifier);
}
public boolean isDirty() {
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTaskContainer.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTaskContainer.java
index f6c4b3805..4c8f7476e 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTaskContainer.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTaskContainer.java
@@ -113,7 +113,7 @@ public abstract class AbstractTaskContainer implements ITaskListElement {
}
/**
- * The handle for most containers is their description. Override to specify a
+ * The handle for most containers is their summary. Override to specify a
* different natural ordering.
*/
public int compareTo(ITaskListElement taskListElement) {
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DateRangeActivityDelegate.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DateRangeActivityDelegate.java
index 4861fb6dd..74dfe52c4 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DateRangeActivityDelegate.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DateRangeActivityDelegate.java
@@ -248,4 +248,8 @@ public class DateRangeActivityDelegate implements ITask {
public int compareTo(ITaskListElement taskListElement) {
return task.toString().compareTo(((Task)taskListElement).toString());
}
+
+ public void setDescription(String description) {
+ task.setDescription(description);
+ }
}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DateRangeContainer.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DateRangeContainer.java
index 30dc1ae64..e6720f54b 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DateRangeContainer.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DateRangeContainer.java
@@ -71,7 +71,7 @@ public class DateRangeContainer extends AbstractTaskContainer {
startDate.setTime(time);
endDate = new GregorianCalendar();
endDate.setTime(time2);
- // this.description = description;
+ // this.description = summary;
}
public boolean includes(Calendar cal) {
@@ -198,7 +198,7 @@ public class DateRangeContainer extends AbstractTaskContainer {
}
/**
- * The handle for most containers is their description. Override to specify a
+ * The handle for most containers is their summary. Override to specify a
* different natural ordering.
*/
@Override
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DelegatingTaskExternalizer.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DelegatingTaskExternalizer.java
index b98e269e5..18775a57d 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DelegatingTaskExternalizer.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/DelegatingTaskExternalizer.java
@@ -112,8 +112,6 @@ public class DelegatingTaskExternalizer implements ITaskListExternalizer {
public static final String KEY_REMINDED = "Reminded";
- // public static final String LABEL_AUTOMATIC = "<automatic>";
-
/**
* This element holds the date stamp recorded upon last transition to a
* synchronized state.
@@ -259,18 +257,20 @@ public class DelegatingTaskExternalizer implements ITaskListExternalizer {
NodeList list = node.getChildNodes();
for (int i = 0; i < list.getLength(); i++) {
Node child = list.item(i);
- boolean read = false;
try {
- for (ITaskListExternalizer externalizer : delegateExternalizers) {
- // LEGACY: categories used to contain tasks
- if (externalizer.canReadTask(child)) {
- externalizer.readTask(child, taskList, category, null);
- read = true;
- }
- }
- if (!read && canReadTask(child)) {
- category.add(readTask(child, taskList, category, null));
- }
+ // LEGACY: categories used to contain tasks?
+ category.add(readTask(child, taskList, category, null));
+// boolean read = false;
+// for (ITaskListExternalizer externalizer : delegateExternalizers) {
+// // LEGACY: categories used to contain tasks
+// if (externalizer.canReadTask(child)) {
+// externalizer.createTask(child, taskList, category, null);
+// read = true;
+// }
+// }
+// if (!read && canReadTask(child)) {
+// category.add(createTask(child, taskList, category, null));
+// }
} catch (Throwable t) {
hasCaughtException = true;
}
@@ -280,54 +280,67 @@ public class DelegatingTaskExternalizer implements ITaskListExternalizer {
}
}
+ /**
+ * First tries to use a delegate externalizer to read, if none available, reads itself.
+ */
+ public final ITask readTask(Node node, TaskList taskList, AbstractTaskContainer category, ITask parent) throws TaskExternalizationException {
+ ITask task = null;
+ String taskId = null;
+ String repositoryUrl = null;
+ String summary = "";
+ boolean alreadyRead = false;
+
+ Element element = (Element)node;
+ if (element.hasAttribute(KEY_HANDLE)) {
+ String handle = element.getAttribute(KEY_HANDLE);
+ repositoryUrl = RepositoryTaskHandleUtil.getRepositoryUrl(handle);
+ taskId = RepositoryTaskHandleUtil.getTaskId(handle);
+ } else {
+ throw new TaskExternalizationException("Handle not stored for repository task");
+ }
+ if (element.hasAttribute(KEY_LABEL)) {
+ summary = element.getAttribute(KEY_LABEL);
+ }
+
+ for (ITaskListExternalizer externalizer : delegateExternalizers) {
+ if (!alreadyRead && externalizer.canReadTask(node)) {
+ task = externalizer.createTask(repositoryUrl, taskId, summary, element, taskList, category, parent);
+ alreadyRead = true;
+ }
+ }
+
+ if (!alreadyRead && this.canReadTask(node)) {
+ task = this.createTask(repositoryUrl, taskId, summary, element, taskList, category, parent);
+ alreadyRead = true;
+ }
+ if (task != null) {
+ readTaskInfo(task, taskList, element, parent, category);
+ }
+ return task;
+ }
+
public boolean canReadTask(Node node) {
return node.getNodeName().equals(getTaskTagName());
}
- public ITask readTask(Node node, TaskList taskList, AbstractTaskContainer category, ITask parent)
+ /**
+ * Override for connector-specific implementation
+ */
+ public ITask createTask(String repositoryUrl, String taskId, String summary, Element element, TaskList taskList, AbstractTaskContainer category, ITask parent)
throws TaskExternalizationException {
- Element element = (Element) node;
String handle;
- String label;
if (element.hasAttribute(KEY_HANDLE)) {
handle = element.getAttribute(KEY_HANDLE);
} else {
throw new TaskExternalizationException("Handle not stored for task");
}
- if (element.hasAttribute(KEY_LABEL)) {
- label = element.getAttribute(KEY_LABEL);
- } else {
- label = "Description was corrupted in stored tasklist";
- }
-
- Task task = new Task(handle, label, false);
- readTaskInfo(task, taskList, element, parent, category);
+ Task task = new Task(handle, summary, false);
return task;
}
- protected void readTaskInfo(ITask task, TaskList taskList, Element element, ITask parent,
+ private void readTaskInfo(ITask task, TaskList taskList, Element element, ITask parent,
AbstractTaskContainer legacyCategory) throws TaskExternalizationException {
-
- // TODO: move this
- if (task instanceof AbstractRepositoryTask) {
- AbstractRepositoryTask abstractTask = (AbstractRepositoryTask) task;
- if (element.hasAttribute(KEY_HANDLE)) {
- String handle = element.getAttribute(KEY_HANDLE);
- String repositoryUrl = RepositoryTaskHandleUtil.getRepositoryUrl(handle);
- String taskId = RepositoryTaskHandleUtil.getTaskId(handle);
- abstractTask.setRepositoryUrl(repositoryUrl);
- abstractTask.setTaskId(taskId);
- } else {
- throw new TaskExternalizationException("Handle not stored for repository task");
- }
- if (element.hasAttribute(KEY_LABEL)) {
- String label = element.getAttribute(KEY_LABEL);
- abstractTask.setDescription(label);
- } else {
- throw new TaskExternalizationException("Label not stored for repository task");
- }
- }
-
+
String categoryHandle = null;
if (element.hasAttribute(KEY_CATEGORY)) {
categoryHandle = element.getAttribute(KEY_CATEGORY);
@@ -423,6 +436,13 @@ public class DelegatingTaskExternalizer implements ITaskListExternalizer {
if (task instanceof AbstractRepositoryTask) {
AbstractRepositoryTask abstractTask = (AbstractRepositoryTask) task;
abstractTask.setCurrentlySynchronizing(false);
+
+ if (element.hasAttribute(KEY_REPOSITORY_URL)) {
+ abstractTask.setRepositoryUrl(element.getAttribute(KEY_REPOSITORY_URL));
+ } else {
+ throw new TaskExternalizationException("Repository URL not stored for repository task");
+ }
+
if (element.hasAttribute(KEY_LAST_MOD_DATE) && !element.getAttribute(KEY_LAST_MOD_DATE).equals("")) {
abstractTask.setLastSyncDateStamp(element.getAttribute(KEY_LAST_MOD_DATE));
}
@@ -466,6 +486,25 @@ public class DelegatingTaskExternalizer implements ITaskListExternalizer {
}
}
+// /**
+// * @return task ID, or null if not found
+// */
+// protected void readLegacyHandleFormat(ITask task, Element element) throws TaskExternalizationException {
+// if (task instanceof AbstractRepositoryTask) {
+// AbstractRepositoryTask abstractTask = (AbstractRepositoryTask) task;
+//
+// if (element.hasAttribute(KEY_HANDLE)) {
+// String handle = element.getAttribute(KEY_HANDLE);
+// String repositoryUrl = RepositoryTaskHandleUtil.getRepositoryUrl(handle);
+// String taskId = RepositoryTaskHandleUtil.getTaskId(handle);
+// abstractTask.setRepositoryUrl(repositoryUrl);
+// abstractTask.setTaskId(taskId);
+// } else {
+// throw new TaskExternalizationException("Handle not stored for repository task");
+// }
+// }
+// }
+
protected void readTaskData(AbstractRepositoryTask task) {
RepositoryTaskData data = taskDataManager.getRepositoryTaskData(task.getHandleIdentifier());
// RepositoryTaskData data =
@@ -571,27 +610,61 @@ public class DelegatingTaskExternalizer implements ITaskListExternalizer {
}
parent.appendChild(node);
return node;
- // return null;
}
public boolean canReadQueryHit(Node node) {
return false;
}
-
- public void readQueryHit(Node node, TaskList tlist, AbstractRepositoryQuery query)
- throws TaskExternalizationException {
- // doesn't know how to read a query hit
+
+ public final void readQueryHit(Element element, TaskList taskList, AbstractRepositoryQuery query)
+ throws TaskExternalizationException {
+ AbstractQueryHit hit = null;
+ String summary = "";
+ if (element.hasAttribute(KEY_NAME)) {
+ summary = element.getAttribute(KEY_NAME);
+ }
+
+ if (element.hasAttribute(KEY_HANDLE)) {
+ String handle = element.getAttribute(KEY_HANDLE);
+ String repositoryUrl = RepositoryTaskHandleUtil.getRepositoryUrl(handle);
+ String taskId = RepositoryTaskHandleUtil.getTaskId(handle);
+ for (ITaskListExternalizer externalizer : delegateExternalizers) {
+ if (externalizer.canReadQueryHit((Node)element)) {
+ hit = externalizer.createQueryHit(repositoryUrl, taskId, summary, element, taskList, query);
+ break;
+ }
+ }
+ } else {
+ throw new TaskExternalizationException("Handle not stored for repository task");
+ }
+
+ if (hit != null) {
+ readQueryHitInfo(hit, taskList, query, element);
+ }
+ }
+
+ /**
+ * Subclasses should override.
+ */
+ public AbstractQueryHit createQueryHit(String repositoryUrl, String taskId, String summary, Element element, TaskList taskList, AbstractRepositoryQuery query)
+ throws TaskExternalizationException {
+ // no default hit reading behavior
+ return null;
}
- public void readQueryHitInfo(AbstractQueryHit hit, TaskList taskList, AbstractRepositoryQuery query, Element element)
+ private void readQueryHitInfo(AbstractQueryHit hit, TaskList taskList, AbstractRepositoryQuery query, Element element)
throws TaskExternalizationException {
- if (element.hasAttribute(KEY_NAME)) {
- hit.setDescription(element.getAttribute(KEY_NAME));
- }
if (element.hasAttribute(KEY_PRIORITY)) {
hit.setPriority(element.getAttribute(KEY_PRIORITY));
}
+ if (element.hasAttribute(KEY_COMPLETE)
+ && element.getAttribute(KEY_COMPLETE).compareTo(VAL_TRUE) == 0) {
+ hit.setCompleted(true);
+ } else {
+ hit.setCompleted(false);
+ }
+
if (element.hasAttribute(KEY_NOTIFIED_INCOMING)
&& element.getAttribute(KEY_NOTIFIED_INCOMING).compareTo(VAL_TRUE) == 0) {
hit.setNotified(true);
@@ -599,14 +672,6 @@ public class DelegatingTaskExternalizer implements ITaskListExternalizer {
hit.setNotified(false);
}
- if (element.hasAttribute(KEY_HANDLE)) {
- String handle = element.getAttribute(KEY_HANDLE);
- hit.setRepositoryUrl(RepositoryTaskHandleUtil.getRepositoryUrl(handle));
- hit.setTaskId(RepositoryTaskHandleUtil.getTaskId(handle));
- } else {
- throw new TaskExternalizationException("Handle not stored for bug report");
- }
-
ITask correspondingTask = taskList.getTask(hit.getHandleIdentifier());
if (correspondingTask instanceof AbstractRepositoryTask) {
hit.setCorrespondingTask((AbstractRepositoryTask) correspondingTask);
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITask.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITask.java
index b2c9fc776..8a65c1a11 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITask.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITask.java
@@ -85,4 +85,6 @@ public interface ITask extends ITaskListElement {
public abstract void setReminded(boolean reminded);
public abstract boolean isPastReminder();
+
+ public abstract void setDescription(String attribute);
}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskListExternalizer.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskListExternalizer.java
index 180711760..ed48bd3a7 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskListExternalizer.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/ITaskListExternalizer.java
@@ -52,7 +52,7 @@ public interface ITaskListExternalizer {
public abstract boolean canReadTask(Node node);
- public abstract ITask readTask(Node node, TaskList tlist, AbstractTaskContainer category, ITask parent)
+ public abstract ITask createTask(String repositoryUrl, String taskId, String summary, Element element, TaskList tlist, AbstractTaskContainer category, ITask parent)
throws TaskExternalizationException;
public abstract boolean canCreateElementFor(AbstractRepositoryQuery category);
@@ -69,6 +69,6 @@ public interface ITaskListExternalizer {
public abstract boolean canReadQueryHit(Node node);
- public abstract void readQueryHit(Node node, TaskList tlist, AbstractRepositoryQuery query)
+ public abstract AbstractQueryHit createQueryHit(String repositoryUrl, String taskId, String summary, Element element, TaskList tlist, AbstractRepositoryQuery query)
throws TaskExternalizationException;
}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryTaskData.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryTaskData.java
index 6b72af066..2cad6f7d5 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryTaskData.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/RepositoryTaskData.java
@@ -259,7 +259,7 @@ public final class RepositoryTaskData extends AttributeContainer implements Seri
public RepositoryTaskAttribute getDescriptionAttribute() {
RepositoryTaskAttribute attribute = getAttribute(RepositoryTaskAttribute.DESCRIPTION);
// TODO: Remove the following after 1.0 release as we now just have a
- // description attribute
+ // summary attribute
if (attribute == null) {
List<TaskComment> coms = this.getComments();
if (coms != null && coms.size() > 0) {
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/Task.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/Task.java
index d803433d7..09101a605 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/Task.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/Task.java
@@ -107,7 +107,7 @@ public class Task implements ITask {
private boolean hasReminded = false;
- private String description;
+ private String summary;
private String priority = PriorityLevel.getDefault().toString();
@@ -140,12 +140,12 @@ public class Task implements ITask {
@Override
public String toString() {
- return description;
+ return summary;
}
- public Task(String handle, String label, boolean newTask) {
+ public Task(String handle, String summary, boolean newTask) {
this.handleIdentifier = handle;
- this.description = label;
+ this.summary = summary;
if (newTask) {
creationDate = new Date();
}
@@ -155,10 +155,6 @@ public class Task implements ITask {
return handleIdentifier;
}
-// public void setHandleIdentifier(String taskId) {
-// this.handleIdentifier = taskId;
-// }
-
public ITask getParent() {
return parent;
}
@@ -221,6 +217,9 @@ public class Task implements ITask {
this.priority = priority;
}
+ /**
+ * TODO: consider removing
+ */
public void setTaskUrl(String url) {
this.taskUrl = url;
}
@@ -282,7 +281,7 @@ public class Task implements ITask {
}
public String getSummary() {
- return description;
+ return summary;
}
public boolean isLocal() {
@@ -319,8 +318,8 @@ public class Task implements ITask {
this.creationDate = date;
}
- public void setDescription(String description) {
- this.description = description;
+ public void setDescription(String summary) {
+ this.summary = summary;
}
public void setCompletionDate(Date completionDate) {
@@ -366,6 +365,6 @@ public class Task implements ITask {
}
public int compareTo(ITaskListElement taskListElement) {
- return description.compareTo(((Task)taskListElement).description);
+ return summary.compareTo(((Task)taskListElement).summary);
}
}

Back to the top