Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.mylyn.tasks.core')
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/LocalRepositoryConnector.java10
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/LocalTask.java4
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ScheduledTaskDelegate.java12
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractAttachmentHandler.java148
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractAttributeFactory.java9
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryConnector.java165
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryQuery.java25
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryTask.java0
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTask.java127
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/IAttachmentHandler.java48
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepositoryManager.java12
11 files changed, 273 insertions, 287 deletions
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/LocalRepositoryConnector.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/LocalRepositoryConnector.java
index a8b47146b..f160f677a 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/LocalRepositoryConnector.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/LocalRepositoryConnector.java
@@ -17,12 +17,12 @@ import java.util.Set;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.mylyn.tasks.core.AbstractAttachmentHandler;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryQuery;
import org.eclipse.mylyn.tasks.core.AbstractTask;
-import org.eclipse.mylyn.tasks.core.IAttachmentHandler;
-import org.eclipse.mylyn.tasks.core.ITaskCollector;
import org.eclipse.mylyn.tasks.core.AbstractTaskDataHandler;
+import org.eclipse.mylyn.tasks.core.ITaskCollector;
import org.eclipse.mylyn.tasks.core.RepositoryTaskData;
import org.eclipse.mylyn.tasks.core.TaskRepository;
@@ -57,7 +57,7 @@ public class LocalRepositoryConnector extends AbstractRepositoryConnector {
}
@Override
- public IAttachmentHandler getAttachmentHandler() {
+ public AbstractAttachmentHandler getAttachmentHandler() {
// TODO: Implement local attachments
return null;
}
@@ -74,7 +74,7 @@ public class LocalRepositoryConnector extends AbstractRepositoryConnector {
}
@Override
- public String getRepositoryType() {
+ public String getConnectorKind() {
return REPOSITORY_KIND;
}
@@ -97,7 +97,7 @@ public class LocalRepositoryConnector extends AbstractRepositoryConnector {
}
@Override
- public String getTaskWebUrl(String repositoryUrl, String taskId) {
+ public String getTaskUrl(String repositoryUrl, String taskId) {
// ignore
return null;
}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/LocalTask.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/LocalTask.java
index b70740a3f..f3c199b45 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/LocalTask.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/LocalTask.java
@@ -30,7 +30,7 @@ public class LocalTask extends AbstractTask {
}
@Override
- public String getRepositoryKind() {
+ public String getConnectorKind() {
return LocalRepositoryConnector.REPOSITORY_KIND;
}
@@ -38,7 +38,7 @@ public class LocalTask extends AbstractTask {
return true;
}
- public String getLastSyncDateStamp() {
+ public String getLastReadTimeStamp() {
return SYNC_DATE_NOW;
}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ScheduledTaskDelegate.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ScheduledTaskDelegate.java
index 68dd9dbbd..f77be2d42 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ScheduledTaskDelegate.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/ScheduledTaskDelegate.java
@@ -150,8 +150,8 @@ public class ScheduledTaskDelegate extends AbstractTask {
return task.getTaskUrl();
}
- public boolean hasBeenReminded() {
- return task.hasBeenReminded();
+ public boolean isReminded() {
+ return task.isReminded();
}
public boolean hasValidUrl() {
@@ -204,8 +204,8 @@ public class ScheduledTaskDelegate extends AbstractTask {
// task.setHandleIdentifier(taskId);
// }
- public void setKind(String kind) {
- task.setKind(kind);
+ public void setTaskKind(String kind) {
+ task.setTaskKind(kind);
}
public void setNotes(String notes) {
@@ -250,7 +250,7 @@ public class ScheduledTaskDelegate extends AbstractTask {
}
@Override
- public String getRepositoryKind() {
- return task.getRepositoryKind();
+ public String getConnectorKind() {
+ return task.getConnectorKind();
}
}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractAttachmentHandler.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractAttachmentHandler.java
index 01cd315da..bc21ca0b6 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractAttachmentHandler.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractAttachmentHandler.java
@@ -9,24 +9,63 @@
package org.eclipse.mylyn.tasks.core;
import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.util.HashSet;
+import java.util.Set;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.mylyn.context.core.ContextCorePlugin;
import org.eclipse.mylyn.internal.monitor.core.util.StatusManager;
+import org.eclipse.mylyn.internal.tasks.core.TaskDataManager;
+import org.eclipse.mylyn.tasks.core.AbstractTask.RepositoryTaskSyncState;
/**
+ * Extend to provide facility for downloading files from the task repository.
+ *
* @author Steffen Pingel
+ * @since 2.0
*/
-public abstract class AbstractAttachmentHandler implements IAttachmentHandler {
+public abstract class AbstractAttachmentHandler {
protected static final int BUFFER_SIZE = 1024;
+
+ private TaskDataManager taskDataManager = null;
+ public static final String MESSAGE_ATTACHMENTS_NOT_SUPPORTED = "Attachments not supported by connector: ";
+
+ public static final String MYLAR_CONTEXT_DESCRIPTION_LEGACY = "mylar/context/zip";
+
+ public final static String MYLAR_CONTEXT_FILENAME = "mylyn-context.zip";
+
+ public static final String MYLAR_CONTEXT_DESCRIPTION = "mylyn/context/zip";
+
+ public abstract void uploadAttachment(TaskRepository repository, AbstractTask task, ITaskAttachment attachment,
+ String comment, IProgressMonitor monitor) throws CoreException;
+
+ public abstract InputStream getAttachmentAsStream(TaskRepository repository, RepositoryAttachment attachment,
+ IProgressMonitor monitor) throws CoreException;
+
+ public abstract boolean canUploadAttachment(TaskRepository repository, AbstractTask task);
+
+ public abstract boolean canDownloadAttachment(TaskRepository repository, AbstractTask task);
+
+ public abstract boolean canDeprecate(TaskRepository repository, RepositoryAttachment attachment);
+
+ /**
+ * To deprecate, change the attribute on the RepositoryAttachment and pass
+ * to this method
+ */
+ public abstract void updateAttachment(TaskRepository repository, RepositoryAttachment attachment) throws CoreException;
+
public void downloadAttachment(TaskRepository repository, RepositoryAttachment attachment, OutputStream out,
IProgressMonitor monitor) throws CoreException {
monitor.beginTask("Downloading attachment", IProgressMonitor.UNKNOWN);
@@ -61,4 +100,111 @@ public abstract class AbstractAttachmentHandler implements IAttachmentHandler {
}
}
+ public final boolean hasRepositoryContext(TaskRepository repository, AbstractTask task) {
+ if (repository == null || task == null) {
+ return false;
+ } else {
+ Set<RepositoryAttachment> remoteContextAttachments = getContextAttachments(repository, task);
+ return (remoteContextAttachments != null && remoteContextAttachments.size() > 0);
+ }
+ }
+
+ /**
+ * Implementors of this repositoryOperations must perform it locally without going to the server since it is used
+ * for frequent repositoryOperations such as decoration.
+ *
+ * @return an empty set if no contexts
+ */
+ public final Set<RepositoryAttachment> getContextAttachments(TaskRepository repository, AbstractTask task) {
+ Set<RepositoryAttachment> contextAttachments = new HashSet<RepositoryAttachment>();
+
+ if (taskDataManager != null) {
+ RepositoryTaskData newData = taskDataManager.getNewTaskData(task.getRepositoryUrl(), task.getTaskId());
+ if (newData != null) {
+ for (RepositoryAttachment attachment : newData.getAttachments()) {
+ if (attachment.getDescription().equals(MYLAR_CONTEXT_DESCRIPTION)) {
+ contextAttachments.add(attachment);
+ } else if (attachment.getDescription().equals(MYLAR_CONTEXT_DESCRIPTION_LEGACY)) {
+ contextAttachments.add(attachment);
+ }
+ }
+ }
+ }
+ return contextAttachments;
+ }
+
+ /**
+ * Attaches the associated context to <code>task</code>.
+ *
+ * @return false, if operation is not supported by repository
+ */
+ public final boolean attachContext(TaskRepository repository, AbstractTask task, String longComment,
+ IProgressMonitor monitor) throws CoreException {
+ ContextCorePlugin.getContextManager().saveContext(task.getHandleIdentifier());
+ final File sourceContextFile = ContextCorePlugin.getContextManager().getFileForContext(
+ task.getHandleIdentifier());
+
+ RepositoryTaskSyncState previousState = task.getSynchronizationState();
+
+ if (sourceContextFile != null && sourceContextFile.exists()) {
+ try {
+ task.setSubmitting(true);
+ task.setSynchronizationState(RepositoryTaskSyncState.OUTGOING);
+ FileAttachment attachment = new FileAttachment(sourceContextFile);
+ attachment.setDescription(AbstractAttachmentHandler.MYLAR_CONTEXT_DESCRIPTION);
+ attachment.setFilename(AbstractAttachmentHandler.MYLAR_CONTEXT_FILENAME);
+ uploadAttachment(repository, task, attachment, longComment, monitor);
+ } catch (CoreException e) {
+ // TODO: Calling method should be responsible for returning
+ // state of task. Wizard will have different behaviour than
+ // editor.
+ task.setSynchronizationState(previousState);
+ throw e;
+ } catch (OperationCanceledException e) {
+ return true;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Retrieves a context stored in <code>attachment</code> from <code>task</code>.
+ *
+ * @return false, if operation is not supported by repository
+ */
+ public final boolean retrieveContext(TaskRepository repository, AbstractTask task, RepositoryAttachment attachment,
+ String destinationPath, IProgressMonitor monitor) throws CoreException {
+
+ File destinationContextFile = ContextCorePlugin.getContextManager().getFileForContext(
+ task.getHandleIdentifier());
+
+ // TODO: add functionality for not overwriting previous context
+ if (destinationContextFile.exists()) {
+ if (!destinationContextFile.delete()) {
+ return false;
+ }
+ }
+ FileOutputStream out;
+ try {
+ out = new FileOutputStream(destinationContextFile);
+ try {
+ downloadAttachment(repository, attachment, out, monitor);
+ } finally {
+ try {
+ out.close();
+ } catch (IOException e) {
+ StatusManager.fail(e, "Could not close context file", false);
+ }
+ }
+ } catch (FileNotFoundException e) {
+ throw new CoreException(new RepositoryStatus(IStatus.ERROR, "org.eclipse.mylyn.tasks.core",
+ RepositoryStatus.ERROR_INTERNAL, "Could not create context file", e));
+ }
+ return true;
+ }
+
+ public void setTaskDataManager(TaskDataManager taskDataManager) {
+ this.taskDataManager = taskDataManager;
+ }
+
}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractAttributeFactory.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractAttributeFactory.java
index ec4c36c7d..eab845474 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractAttributeFactory.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractAttributeFactory.java
@@ -16,24 +16,27 @@ import java.util.Date;
/**
+ * Extend to provide mapping between repository task attribute IDs and native repository IDs.
+ *
* @author Rob Elves
+ * @since 2.0
*/
public abstract class AbstractAttributeFactory implements Serializable {
public RepositoryTaskAttribute createAttribute(String key) {
String mapped = mapCommonAttributeKey(key);
- RepositoryTaskAttribute attribute = new RepositoryTaskAttribute(mapped, getName(mapped), getIsHidden(mapped));
+ RepositoryTaskAttribute attribute = new RepositoryTaskAttribute(mapped, getName(mapped), isHidden(mapped));
attribute.setReadOnly(isReadOnly(mapped));
return attribute;
}
public abstract String mapCommonAttributeKey(String key);
- public abstract boolean getIsHidden(String key);
-
public abstract String getName(String key);
public abstract boolean isReadOnly(String key);
+
+ public abstract boolean isHidden(String key);
/**
* @return null if date cannot be parsed
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 f265e0be4..9b3ad09de 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
@@ -32,21 +32,15 @@ import org.eclipse.mylyn.internal.tasks.core.TaskDataManager;
import org.eclipse.mylyn.tasks.core.AbstractTask.RepositoryTaskSyncState;
/**
- * Operations on a task repository
+ * Encapsulates common operations that can be performed on a task repository. Extend to
+ * connect with a Java API or WS API for accessing the repository.
*
* @author Mik Kersten
* @author Rob Elves
+ * @since 2.0
*/
public abstract class AbstractRepositoryConnector {
- public static final String MESSAGE_ATTACHMENTS_NOT_SUPPORTED = "Attachments not supported by connector: ";
-
- public static final String MYLAR_CONTEXT_DESCRIPTION_LEGACY = "mylar/context/zip";
-
- public static final String MYLAR_CONTEXT_DESCRIPTION = "mylyn/context/zip";
-
- public final static String MYLAR_CONTEXT_FILENAME = "mylyn-context.zip";
-
protected Set<RepositoryTemplate> templates = new LinkedHashSet<RepositoryTemplate>();
protected TaskList taskList;
@@ -58,11 +52,22 @@ public abstract class AbstractRepositoryConnector {
public void init(TaskList taskList) {
this.taskList = taskList;
}
+
+ /**
+ * Set upon construction
+ */
+ public void setTaskDataManager(TaskDataManager taskDataManager) {
+ this.taskDataManager = taskDataManager;
+ AbstractAttachmentHandler handler = getAttachmentHandler();
+ if (handler != null) {
+ handler.setTaskDataManager(taskDataManager);
+ }
+ }
/**
* @return null if not supported
*/
- public abstract IAttachmentHandler getAttachmentHandler();
+ public abstract AbstractAttachmentHandler getAttachmentHandler();
/**
* @return null if not supported
@@ -73,7 +78,7 @@ public abstract class AbstractRepositoryConnector {
public abstract String getTaskIdFromTaskUrl(String taskFullUrl);
- public abstract String getTaskWebUrl(String repositoryUrl, String taskId);
+ public abstract String getTaskUrl(String repositoryUrl, String taskId);
public String[] getTaskIdsFromComment(TaskRepository repository, String comment) {
return null;
@@ -179,9 +184,9 @@ public abstract class AbstractRepositoryConnector {
public abstract String getLabel();
/**
- * @return the unique type of the repository, e.g. "bugzilla"
+ * @return the unique kind of the repository, e.g. "bugzilla"
*/
- public abstract String getRepositoryType();
+ public abstract String getConnectorKind();
/**
* Updates the properties of <code>repositoryTask</code>. Invoked when on task synchronization if
@@ -227,14 +232,6 @@ public abstract class AbstractRepositoryConnector {
existingTask.setSummary(queryHit.getSummary());
changed = true;
}
-// if (hasTaskPropertyChanged(existingTask.getCompletionDate(), queryHit.getCompletionDate())) {
-// existingTask.setCompletionDate(queryHit.getCompletionDate());
-// changed = true;
-// }
-// if (hasTaskPropertyChanged(existingTask.getCreationDate(), newTask.getCreationDate())) {
-// existingTask.setCreationDate(newTask.getCreationDate());
-// changed = true;
-// }
if (hasTaskPropertyChanged(existingTask.getDueDate(), queryHit.getDueDate())) {
existingTask.setDueDate(queryHit.getDueDate());
changed = true;
@@ -263,46 +260,12 @@ public abstract class AbstractRepositoryConnector {
return (existingProperty == null) ? true : !existingProperty.equals(newProperty);
}
- public String[] repositoryPropertyNames() {
+ public String[] getPepositoryPropertyNames() {
return new String[] { IRepositoryConstants.PROPERTY_VERSION, IRepositoryConstants.PROPERTY_TIMEZONE,
IRepositoryConstants.PROPERTY_ENCODING };
}
/**
- * Implementors of this repositoryOperations must perform it locally without going to the server since it is used
- * for frequent repositoryOperations such as decoration.
- *
- * @return an empty set if no contexts
- */
- public final Set<RepositoryAttachment> getContextAttachments(TaskRepository repository, AbstractTask task) {
- Set<RepositoryAttachment> contextAttachments = new HashSet<RepositoryAttachment>();
-
- if (taskDataManager != null) {
- RepositoryTaskData newData = taskDataManager.getNewTaskData(task.getRepositoryUrl(), task.getTaskId());
- if (newData != null) {
- for (RepositoryAttachment attachment : newData.getAttachments()) {
- if (attachment.getDescription().equals(MYLAR_CONTEXT_DESCRIPTION)) {
- contextAttachments.add(attachment);
- } else if (attachment.getDescription().equals(MYLAR_CONTEXT_DESCRIPTION_LEGACY)) {
- contextAttachments.add(attachment);
- }
- }
- }
- }
- return contextAttachments;
- }
-
- // TODO: move
- public final boolean hasRepositoryContext(TaskRepository repository, AbstractTask task) {
- if (repository == null || task == null) {
- return false;
- } else {
- Set<RepositoryAttachment> remoteContextAttachments = getContextAttachments(repository, task);
- return (remoteContextAttachments != null && remoteContextAttachments.size() > 0);
- }
- }
-
- /**
* Of <code>tasks</code> provided, return all that have changed since last synchronization of
* <code>repository</code>.
*
@@ -324,85 +287,6 @@ public abstract class AbstractRepositoryConnector {
public abstract boolean markStaleTasks(TaskRepository repository, Set<AbstractTask> tasks, IProgressMonitor monitor)
throws CoreException;
- /**
- * Attaches the associated context to <code>task</code>.
- *
- * @return false, if operation is not supported by repository
- */
- public final boolean attachContext(TaskRepository repository, AbstractTask task, String longComment,
- IProgressMonitor monitor) throws CoreException {
- ContextCorePlugin.getContextManager().saveContext(task.getHandleIdentifier());
- final File sourceContextFile = ContextCorePlugin.getContextManager().getFileForContext(
- task.getHandleIdentifier());
-
- RepositoryTaskSyncState previousState = task.getSyncState();
-
- if (sourceContextFile != null && sourceContextFile.exists()) {
- IAttachmentHandler handler = getAttachmentHandler();
- if (handler == null) {
- return false;
- }
-
- try {
- task.setSubmitting(true);
- task.setSyncState(RepositoryTaskSyncState.OUTGOING);
- FileAttachment attachment = new FileAttachment(sourceContextFile);
- attachment.setDescription(MYLAR_CONTEXT_DESCRIPTION);
- attachment.setFilename(MYLAR_CONTEXT_FILENAME);
- handler.uploadAttachment(repository, task, attachment, longComment, monitor);
- } catch (CoreException e) {
- // TODO: Calling method should be responsible for returning
- // state of task. Wizard will have different behaviour than
- // editor.
- task.setSyncState(previousState);
- throw e;
- } catch (OperationCanceledException e) {
- return true;
- }
- }
- return true;
- }
-
- /**
- * Retrieves a context stored in <code>attachment</code> from <code>task</code>.
- *
- * @return false, if operation is not supported by repository
- */
- public final boolean retrieveContext(TaskRepository repository, AbstractTask task, RepositoryAttachment attachment,
- String destinationPath, IProgressMonitor monitor) throws CoreException {
- IAttachmentHandler attachmentHandler = getAttachmentHandler();
- if (attachmentHandler == null) {
- return false;
- }
-
- File destinationContextFile = ContextCorePlugin.getContextManager().getFileForContext(
- task.getHandleIdentifier());
-
- // TODO: add functionality for not overwriting previous context
- if (destinationContextFile.exists()) {
- if (!destinationContextFile.delete()) {
- return false;
- }
- }
- FileOutputStream out;
- try {
- out = new FileOutputStream(destinationContextFile);
- try {
- attachmentHandler.downloadAttachment(repository, attachment, out, monitor);
- } finally {
- try {
- out.close();
- } catch (IOException e) {
- StatusManager.fail(e, "Could not close context file", false);
- }
- }
- } catch (FileNotFoundException e) {
- throw new CoreException(new RepositoryStatus(IStatus.ERROR, "org.eclipse.mylyn.tasks.core",
- RepositoryStatus.ERROR_INTERNAL, "Could not create context file", e));
- }
- return true;
- }
-
public void addTemplate(RepositoryTemplate template) {
this.templates.add(template);
}
@@ -425,6 +309,10 @@ public abstract class AbstractRepositoryConnector {
return null;
}
+ /**
+ * Used for referring to the task in the UI.
+ * @return
+ */
public String getTaskIdPrefix() {
return "task";
}
@@ -481,11 +369,4 @@ public abstract class AbstractRepositoryConnector {
return taskDataManager;
}
- /**
- * Set upon construction
- */
- public void setTaskDataManager(TaskDataManager taskDataManager) {
- this.taskDataManager = taskDataManager;
- }
-
}
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 6c5ebee77..2a4913b56 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
@@ -14,17 +14,20 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.mylyn.tasks.core.AbstractTask.PriorityLevel;
/**
+ * Extend to provide a repository query that can be used in the Task List.
+ *
* @author Mik Kersten
* @author Eugene Kuleshov
* @author Rob Elves
+ * @since 2.0
*/
public abstract class AbstractRepositoryQuery extends AbstractTaskContainer {
protected String repositoryUrl;
- protected String lastRefreshTimeStamp = "<never>";
+ protected String lastSynchronizedStamp = "<never>";
- private boolean currentlySynchronizing = false;
+ private boolean synchronizing = false;
protected IStatus status = null;
@@ -61,26 +64,26 @@ public abstract class AbstractRepositoryQuery extends AbstractTaskContainer {
}
public boolean isSynchronizing() {
- return currentlySynchronizing;
+ return synchronizing;
}
- public void setCurrentlySynchronizing(boolean currentlySynchronizing) {
- this.currentlySynchronizing = currentlySynchronizing;
+ public void setSynchronizing(boolean synchronizing) {
+ this.synchronizing = synchronizing;
}
- public String getLastRefreshTimeStamp() {
- return lastRefreshTimeStamp;
+ public String getLastSynchronizedTimeStamp() {
+ return lastSynchronizedStamp;
}
- public void setLastRefreshTimeStamp(String lastRefreshTimeStamp) {
- this.lastRefreshTimeStamp = lastRefreshTimeStamp;
+ public void setLastSynchronizedStamp(String lastRefreshTimeStamp) {
+ this.lastSynchronizedStamp = lastRefreshTimeStamp;
}
- public IStatus getStatus() {
+ public IStatus getSynchronizationStatus() {
return status;
}
- public void setStatus(IStatus status) {
+ public void setSynchronizationStatus(IStatus status) {
this.status = status;
}
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
deleted file mode 100644
index e69de29bb..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractRepositoryTask.java
+++ /dev/null
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTask.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTask.java
index df1511308..813f00bcc 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTask.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/AbstractTask.java
@@ -21,60 +21,63 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.mylyn.internal.tasks.core.RepositoryTaskHandleUtil;
/**
+ * Encapsulates tasks that reside on a repository or local computer and participate in synchronization with the source
+ * that contains their data.
+ *
* @author Mik Kersten
* @author Rob Elves
+ * @since 2.0
*/
public abstract class AbstractTask extends AbstractTaskContainer {
-
+
public static final String DEFAULT_TASK_KIND = "task";
-
+
private String repositoryUrl;
- private String kind = DEFAULT_TASK_KIND;
-
+ private String taskKind = DEFAULT_TASK_KIND;
+
private String taskId;
-
+
private String owner;
-
+
private boolean active = false;
-
+
private String summary;
private String priority = PriorityLevel.getDefault().toString();
private boolean completed;
-
+
private boolean isNotifiedIncoming = false;
-
- private boolean hasReminded = false;
+
+ private boolean reminded = false;
private String taskUrl = "";
private Set<AbstractTaskContainer> containers = new HashSet<AbstractTaskContainer>();
-
-
+
// ************ Synch ****************
-
+
/** The last time this task's bug report was in a synchronized (read?) state. */
- private String lastSynchronizedDateStamp;
+ private String lastReadTimeStamp;
- private boolean currentlySynchronizing;
+ private boolean synchronizing;
private boolean submitting;
-
- private RepositoryTaskSyncState syncState = RepositoryTaskSyncState.SYNCHRONIZED;
+
+ private RepositoryTaskSyncState synchronizationState = RepositoryTaskSyncState.SYNCHRONIZED;
// transient
- private IStatus errorStatus = null;
+ private IStatus synchronizationStatus = null;
private boolean stale = false;
-
+
public enum RepositoryTaskSyncState {
OUTGOING, SYNCHRONIZED, INCOMING, CONFLICT
}
-
+
// ************ Planning ****************
-
+
private Date completionDate = null;
private Date creationDate = null;
@@ -82,14 +85,14 @@ public abstract class AbstractTask extends AbstractTaskContainer {
private Date scheduledForDate = null;
private Date dueDate = null;
-
+
private String notes = "";
private int estimatedTimeHours = 1;
-
+
public enum PriorityLevel {
P1, P2, P3, P4, P5;
-
+
@Override
public String toString() {
switch (this) {
@@ -107,7 +110,7 @@ public abstract class AbstractTask extends AbstractTaskContainer {
return "P3";
}
}
-
+
public String getDescription() {
switch (this) {
case P1:
@@ -124,7 +127,7 @@ public abstract class AbstractTask extends AbstractTaskContainer {
return "";
}
}
-
+
public static PriorityLevel fromString(String string) {
if (string.equals("P1"))
return P1;
@@ -138,7 +141,7 @@ public abstract class AbstractTask extends AbstractTaskContainer {
return P5;
return getDefault();
}
-
+
public static PriorityLevel fromDescription(String string) {
if (string == null)
return null;
@@ -154,12 +157,12 @@ public abstract class AbstractTask extends AbstractTaskContainer {
return P5;
return getDefault();
}
-
+
public static PriorityLevel getDefault() {
return P3;
}
}
-
+
public AbstractTask(String repositoryUrl, String taskId, String summary) {
super(RepositoryTaskHandleUtil.getHandle(repositoryUrl, taskId));
this.repositoryUrl = repositoryUrl;
@@ -172,35 +175,35 @@ public abstract class AbstractTask extends AbstractTaskContainer {
}
/**
- * True for tasks that can be modified without a round-trip to a server. For example,
- * such a task can be marked completed via the Task List.
+ * True for tasks that can be modified without a round-trip to a server. For example, such a task can be marked
+ * completed via the Task List.
*/
public abstract boolean isLocal();
-
- public abstract String getRepositoryKind();
- public String getLastSyncDateStamp() {
- return lastSynchronizedDateStamp;
+ public abstract String getConnectorKind();
+
+ public String getLastReadTimeStamp() {
+ return lastReadTimeStamp;
}
- public void setLastSyncDateStamp(String lastSyncDateStamp) {
- this.lastSynchronizedDateStamp = lastSyncDateStamp;
+ public void setLastReadTimeStamp(String lastReadTimeStamp) {
+ this.lastReadTimeStamp = lastReadTimeStamp;
}
- public void setSyncState(RepositoryTaskSyncState syncState) {
- this.syncState = syncState;
+ public void setSynchronizationState(RepositoryTaskSyncState syncState) {
+ this.synchronizationState = syncState;
}
- public RepositoryTaskSyncState getSyncState() {
- return syncState;
+ public RepositoryTaskSyncState getSynchronizationState() {
+ return synchronizationState;
}
public boolean isSynchronizing() {
- return currentlySynchronizing;
+ return synchronizing;
}
- public void setCurrentlySynchronizing(boolean currentlySychronizing) {
- this.currentlySynchronizing = currentlySychronizing;
+ public void setSynchronizing(boolean sychronizing) {
+ this.synchronizing = sychronizing;
}
public boolean isNotified() {
@@ -219,12 +222,12 @@ public abstract class AbstractTask extends AbstractTaskContainer {
this.owner = owner;
}
- public IStatus getStatus() {
- return errorStatus;
+ public IStatus getSynchronizationStatus() {
+ return synchronizationStatus;
}
- public void setStatus(IStatus status) {
- this.errorStatus = status;
+ public void setSynchronizationStatus(IStatus status) {
+ this.synchronizationStatus = status;
}
public final String getTaskId() {
@@ -240,15 +243,13 @@ public abstract class AbstractTask extends AbstractTaskContainer {
}
/**
- * User identifiable key for the task to be used in UI facilities such as
- * label displays and hyperlinked references. Can return the same as the ID
- * (e.g. in the case of Bugzilla). Can return null if no such label exists.
+ * User identifiable key for the task to be used in UI facilities such as label displays and hyperlinked references.
+ * Can return the same as the ID (e.g. in the case of Bugzilla). Can return null if no such label exists.
*/
public String getTaskKey() {
return taskId;
}
-
public boolean isSubmitting() {
return submitting;
}
@@ -276,7 +277,7 @@ public abstract class AbstractTask extends AbstractTaskContainer {
@Override
public boolean equals(Object obj) {
if (obj instanceof AbstractTask && obj != null) {
- return this.getHandleIdentifier().compareTo(((AbstractTask)obj).getHandleIdentifier()) == 0;
+ return this.getHandleIdentifier().compareTo(((AbstractTask) obj).getHandleIdentifier()) == 0;
} else {
return false;
}
@@ -350,7 +351,7 @@ public abstract class AbstractTask extends AbstractTaskContainer {
public void removeParentContainer(AbstractTaskContainer container) {
containers.remove(container);
}
-
+
public Set<AbstractTaskContainer> getParentContainers() {
return containers;
}
@@ -371,12 +372,12 @@ public abstract class AbstractTask extends AbstractTaskContainer {
return scheduledForDate;
}
- public boolean hasBeenReminded() {
- return hasReminded;
+ public boolean isReminded() {
+ return reminded;
}
public void setReminded(boolean reminded) {
- this.hasReminded = reminded;
+ this.reminded = reminded;
}
public Date getCreationDate() {
@@ -424,15 +425,15 @@ public abstract class AbstractTask extends AbstractTaskContainer {
}
public String getTaskKind() {
- return kind;
+ return taskKind;
}
- public void setKind(String kind) {
- this.kind = kind;
+ public void setTaskKind(String kind) {
+ this.taskKind = kind;
}
public int compareTo(AbstractTaskContainer taskListElement) {
- return summary.compareTo(((AbstractTask)taskListElement).summary);
+ return summary.compareTo(((AbstractTask) taskListElement).summary);
}
public Date getDueDate() {
@@ -446,9 +447,9 @@ public abstract class AbstractTask extends AbstractTaskContainer {
public boolean isStale() {
return stale;
}
-
+
public void setStale(boolean stale) {
this.stale = stale;
}
-
+
}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/IAttachmentHandler.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/IAttachmentHandler.java
deleted file mode 100644
index 20667b182..000000000
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/IAttachmentHandler.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004 - 2006 University Of British Columbia and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * University Of British Columbia - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylyn.tasks.core;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-/**
- * @author Mik Kersten
- * @author Rob Elves
- * @author Steffen Pingel
- */
-public interface IAttachmentHandler {
-
- public void uploadAttachment(TaskRepository repository, AbstractTask task, ITaskAttachment attachment,
- String comment, IProgressMonitor monitor) throws CoreException;
-
- public void downloadAttachment(TaskRepository repository, RepositoryAttachment attachment, OutputStream target,
- IProgressMonitor monitor) throws CoreException;
-
- public InputStream getAttachmentAsStream(TaskRepository repository, RepositoryAttachment attachment,
- IProgressMonitor monitor) throws CoreException;
-
- public boolean canUploadAttachment(TaskRepository repository, AbstractTask task);
-
- public boolean canDownloadAttachment(TaskRepository repository, AbstractTask task);
-
- public boolean canDeprecate(TaskRepository repository, RepositoryAttachment attachment);
-
- /**
- * To deprecate, change the attribute on the RepositoryAttachment and pass
- * to this method
- */
- public void updateAttachment(TaskRepository repository, RepositoryAttachment attachment) throws CoreException;
-
-}
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepositoryManager.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepositoryManager.java
index 11ba1cf60..5ec533438 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepositoryManager.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepositoryManager.java
@@ -66,13 +66,13 @@ public class TaskRepositoryManager {
}
public AbstractRepositoryConnector getRepositoryConnector(AbstractTask task) {
- return getRepositoryConnector(task.getRepositoryKind());
+ return getRepositoryConnector(task.getConnectorKind());
}
public void addRepositoryConnector(AbstractRepositoryConnector repositoryConnector) {
if (!repositoryConnectors.values().contains(repositoryConnector)) {
repositoryConnector.init(taskList);
- repositoryConnectors.put(repositoryConnector.getRepositoryType(), repositoryConnector);
+ repositoryConnectors.put(repositoryConnector.getConnectorKind(), repositoryConnector);
}
}
@@ -162,7 +162,7 @@ public class TaskRepositoryManager {
public AbstractRepositoryConnector getConnectorForRepositoryTaskUrl(String url) {
for (AbstractRepositoryConnector connector : getRepositoryConnectors()) {
if (connector.getRepositoryUrlFromTaskUrl(url) != null) {
- for (TaskRepository repository : getRepositories(connector.getRepositoryType())) {
+ for (TaskRepository repository : getRepositories(connector.getConnectorKind())) {
if (url.startsWith(repository.getUrl())) {
return connector;
}
@@ -183,8 +183,8 @@ public class TaskRepositoryManager {
public List<TaskRepository> getAllRepositories() {
List<TaskRepository> repositories = new ArrayList<TaskRepository>();
for (AbstractRepositoryConnector repositoryConnector : repositoryConnectors.values()) {
- if (repositoryMap.containsKey(repositoryConnector.getRepositoryType())) {
- repositories.addAll(repositoryMap.get(repositoryConnector.getRepositoryType()));
+ if (repositoryMap.containsKey(repositoryConnector.getConnectorKind())) {
+ repositories.addAll(repositoryMap.get(repositoryConnector.getConnectorKind()));
}
}
return repositories;
@@ -251,7 +251,7 @@ public class TaskRepositoryManager {
// Will only load repositories for which a connector exists
for (AbstractRepositoryConnector repositoryConnector : repositoryConnectors.values()) {
- repositoryMap.put(repositoryConnector.getRepositoryType(), new HashSet<TaskRepository>());
+ repositoryMap.put(repositoryConnector.getConnectorKind(), new HashSet<TaskRepository>());
}
if (repositoriesFile.exists()) {
Set<TaskRepository> repositories = externalizer.readRepositoriesFromXML(repositoriesFile);

Back to the top