Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrelves2006-11-28 18:12:57 -0500
committerrelves2006-11-28 18:12:57 -0500
commit764175789411dbaaee6f125d60c412b846d9a649 (patch)
tree3f5b1859f976895018a70766c8b7a165c0d1f1a0 /org.eclipse.mylyn.trac.core/src
parent86fd512f03cb464919976a309df1331712162678 (diff)
downloadorg.eclipse.mylyn.tasks-764175789411dbaaee6f125d60c412b846d9a649.tar.gz
org.eclipse.mylyn.tasks-764175789411dbaaee6f125d60c412b846d9a649.tar.xz
org.eclipse.mylyn.tasks-764175789411dbaaee6f125d60c412b846d9a649.zip
NEW - bug 165498: Create unified abstract support for task submission to repository
https://bugs.eclipse.org/bugs/show_bug.cgi?id=165498
Diffstat (limited to 'org.eclipse.mylyn.trac.core/src')
-rw-r--r--org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracAttachmentHandler.java6
-rw-r--r--org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracOfflineTaskHandler.java16
-rw-r--r--org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracRepositoryConnector.java9
3 files changed, 19 insertions, 12 deletions
diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracAttachmentHandler.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracAttachmentHandler.java
index cfe600c1c..7fc0f8228 100644
--- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracAttachmentHandler.java
+++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracAttachmentHandler.java
@@ -39,7 +39,7 @@ public class TracAttachmentHandler implements IAttachmentHandler {
this.connector = connector;
}
- public void downloadAttachment(TaskRepository repository, String taskId, RepositoryAttachment attachment, File file) throws CoreException {
+ public void downloadAttachment(TaskRepository repository, RepositoryAttachment attachment, File file) throws CoreException {
String filename = attachment.getAttributeValue(RepositoryTaskAttribute.ATTACHMENT_FILENAME);
if (filename == null) {
throw new CoreException(new Status(IStatus.ERROR, TracCorePlugin.PLUGIN_ID, IStatus.OK, "Attachment download from " + repository.getUrl() + " failed, missing attachment filename.", null));
@@ -47,7 +47,7 @@ public class TracAttachmentHandler implements IAttachmentHandler {
try {
ITracClient client = connector.getClientManager().getRepository(repository);
- int id = Integer.parseInt(taskId);
+ int id = Integer.parseInt(attachment.getTaskId());
byte[] data = client.getAttachmentData(id, filename);
writeData(file, data);
} catch (Exception e) {
@@ -114,7 +114,7 @@ public class TracAttachmentHandler implements IAttachmentHandler {
// ignore
}
- public byte[] getAttachmentData(TaskRepository repository, String taskId) throws CoreException {
+ public byte[] getAttachmentData(TaskRepository repository, RepositoryAttachment attachment) throws CoreException {
// TODO Auto-generated method stub
return null;
}
diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracOfflineTaskHandler.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracOfflineTaskHandler.java
index 34018239a..0fd617b23 100644
--- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracOfflineTaskHandler.java
+++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracOfflineTaskHandler.java
@@ -34,7 +34,7 @@ import org.eclipse.mylar.internal.trac.core.model.TracTicket.Key;
import org.eclipse.mylar.internal.trac.core.util.TracUtils;
import org.eclipse.mylar.tasks.core.AbstractAttributeFactory;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
-import org.eclipse.mylar.tasks.core.IOfflineTaskHandler;
+import org.eclipse.mylar.tasks.core.ITaskDataHandler;
import org.eclipse.mylar.tasks.core.RepositoryAttachment;
import org.eclipse.mylar.tasks.core.RepositoryOperation;
import org.eclipse.mylar.tasks.core.RepositoryTaskAttribute;
@@ -45,7 +45,7 @@ import org.eclipse.mylar.tasks.core.TaskRepository;
/**
* @author Steffen Pingel
*/
-public class TracOfflineTaskHandler implements IOfflineTaskHandler {
+public class TracOfflineTaskHandler implements ITaskDataHandler {
private static final String CC_DELIMETER = ", ";
@@ -57,7 +57,7 @@ public class TracOfflineTaskHandler implements IOfflineTaskHandler {
this.connector = connector;
}
- public RepositoryTaskData downloadTaskData(TaskRepository repository, String taskId)
+ public RepositoryTaskData getTaskData(TaskRepository repository, String taskId)
throws CoreException {
int id = Integer.parseInt(taskId);
return downloadTaskData(repository, id);
@@ -143,8 +143,11 @@ public class TracOfflineTaskHandler implements IOfflineTaskHandler {
TracAttachment[] attachments = ticket.getAttachments();
if (attachments != null) {
for (int i = 0; i < attachments.length; i++) {
- RepositoryAttachment taskAttachment = new RepositoryAttachment(repository, factory);
+ RepositoryAttachment taskAttachment = new RepositoryAttachment(factory);
taskAttachment.setCreator(attachments[i].getAuthor());
+ taskAttachment.setRepositoryKind(TracCorePlugin.REPOSITORY_KIND);
+ taskAttachment.setRepositoryUrl(repository.getUrl());
+ taskAttachment.setTaskId(""+ticket.getId());
taskAttachment.setAttributeValue(Attribute.DESCRIPTION.getTracKey(), attachments[i].getDescription());
taskAttachment.setAttributeValue(RepositoryTaskAttribute.ATTACHMENT_FILENAME, attachments[i]
.getFilename());
@@ -299,4 +302,9 @@ public class TracOfflineTaskHandler implements IOfflineTaskHandler {
"could not determine changed tasks", e));
}
}
+
+ public String postTaskData(TaskRepository repository, RepositoryTaskData taskData) throws CoreException {
+ // TODO: implement
+ return null;
+ }
}
diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracRepositoryConnector.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracRepositoryConnector.java
index 12d03e2fb..a698601ef 100644
--- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracRepositoryConnector.java
+++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracRepositoryConnector.java
@@ -12,7 +12,6 @@
package org.eclipse.mylar.internal.trac.core;
import java.io.File;
-import java.net.Proxy;
import java.util.ArrayList;
import java.util.List;
@@ -29,8 +28,8 @@ import org.eclipse.mylar.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylar.tasks.core.AbstractRepositoryQuery;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
import org.eclipse.mylar.tasks.core.IAttachmentHandler;
-import org.eclipse.mylar.tasks.core.IOfflineTaskHandler;
import org.eclipse.mylar.tasks.core.ITask;
+import org.eclipse.mylar.tasks.core.ITaskDataHandler;
import org.eclipse.mylar.tasks.core.QueryHitCollector;
import org.eclipse.mylar.tasks.core.RepositoryOperation;
import org.eclipse.mylar.tasks.core.RepositoryTaskAttribute;
@@ -102,7 +101,7 @@ public class TracRepositoryConnector extends AbstractRepositoryConnector {
}
@Override
- public IOfflineTaskHandler getOfflineTaskHandler() {
+ public ITaskDataHandler getTaskDataHandler() {
return offlineTaskHandler;
}
@@ -147,9 +146,9 @@ public class TracRepositoryConnector extends AbstractRepositoryConnector {
return Status.OK_STATUS;
}
-
+
@Override
- public ITask createTaskFromExistingKey(TaskRepository repository, String id, Proxy proxySettings) throws CoreException {
+ public AbstractRepositoryTask createTaskFromExistingKey(TaskRepository repository, String id) throws CoreException {
int bugId = -1;
try {
bugId = Integer.parseInt(id);

Back to the top