diff options
author | fbecker | 2010-02-13 22:32:34 +0000 |
---|---|---|
committer | fbecker | 2010-02-13 22:32:34 +0000 |
commit | e31d3852ce263ac11223ed0f6e4fc2b309047e18 (patch) | |
tree | bd802d2c0b3055196899e4d607577a7a8b3b4467 /org.eclipse.mylyn.bugzilla.core | |
parent | e8b6353612e5af89e50ea9d75b401f88eb7f2a60 (diff) | |
download | org.eclipse.mylyn.tasks-e31d3852ce263ac11223ed0f6e4fc2b309047e18.tar.gz org.eclipse.mylyn.tasks-e31d3852ce263ac11223ed0f6e4fc2b309047e18.tar.xz org.eclipse.mylyn.tasks-e31d3852ce263ac11223ed0f6e4fc2b309047e18.zip |
ASSIGNED - bug 302654: support for Bugzilla 3.6
https://bugs.eclipse.org/bugs/show_bug.cgi?id=302654
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.core')
4 files changed, 33 insertions, 6 deletions
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttribute.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttribute.java index aafae75e3..64a7ac743 100644 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttribute.java +++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttribute.java @@ -185,7 +185,10 @@ public enum BugzillaAttribute { BUGS(Messages.BugzillaAttribute_used_by_search_engine_bugs, "bugs", null, false, false), //$NON-NLS-1$ - QUERY_TIMESTAMP(Messages.BugzillaAttribute_Query_Timestamp, "query_timestamp", null, false, false); //$NON-NLS-1$ + QUERY_TIMESTAMP(Messages.BugzillaAttribute_Query_Timestamp, "query_timestamp", null, false, false), //$NON-NLS-1$ + + // new in Bugzilla 3.6 + ATTACHER(Messages.BugzillaAttribute_Attacher, "attacher", null, false, false); //$NON-NLS-1$ private final boolean isHidden; diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/Messages.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/Messages.java index 80388a123..5902d326f 100644 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/Messages.java +++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/Messages.java @@ -177,6 +177,8 @@ public class Messages extends NLS { public static String BugzillaAttribute_Worked; + public static String BugzillaAttribute_Attacher; + public static String BugzillaAttachmentMapper_Author; public static String BugzillaAttachmentMapper_Content_Type; diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java index c86d3fdfc..33762fa15 100644 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java +++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java @@ -11,6 +11,8 @@ package org.eclipse.mylyn.internal.bugzilla.core; +import java.text.ParseException; +import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -75,6 +77,8 @@ public class SaxMultiBugReportContentHandler extends DefaultHandler { private final BugzillaRepositoryConnector connector; + private final SimpleDateFormat simpleFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm"); //$NON-NLS-1$ + public SaxMultiBugReportContentHandler(TaskAttributeMapper mapper, TaskDataCollector collector, Map<String, TaskData> taskDataMap, List<BugzillaCustomField> customFields, BugzillaRepositoryConnector connector) { @@ -341,7 +345,14 @@ public class SaxMultiBugReportContentHandler extends DefaultHandler { attachment.setToken(null); break; case DATE: - // ignore + if (attachment != null) { + try { + attachment.setCreationDate(simpleFormatter.parse(parsedText)); + break; + } catch (ParseException e) { + } catch (NumberFormatException e) { + } + } break; case DESC: if (attachment != null) { @@ -457,6 +468,14 @@ public class SaxMultiBugReportContentHandler extends DefaultHandler { token = parsedText; } break; + case ATTACHER: + if (attachment != null) { + IRepositoryPerson author = repositoryTaskData.getAttributeMapper().getTaskRepository().createPerson( + parsedText); + author.setName(parsedText); + attachment.setAuthor(author); + } + break; default: TaskAttribute defaultAttribute = repositoryTaskData.getRoot().getMappedAttribute(tag.getKey()); if (defaultAttribute == null) { @@ -521,10 +540,12 @@ public class SaxMultiBugReportContentHandler extends DefaultHandler { repositoryTaskData, TaskAttribute.TYPE_ATTACHMENT); for (TaskAttribute attachment : taskAttachments) { BugzillaAttachmentMapper attachmentMapper = BugzillaAttachmentMapper.createFrom(attachment); - TaskCommentMapper taskComment = attachIdToComment.get(attachmentMapper.getAttachmentId()); - if (taskComment != null) { - attachmentMapper.setAuthor(taskComment.getAuthor()); - attachmentMapper.setCreationDate(taskComment.getCreationDate()); + if (attachmentMapper.getAuthor() == null || attachmentMapper.getCreationDate() == null) { + TaskCommentMapper taskComment = attachIdToComment.get(attachmentMapper.getAttachmentId()); + if (taskComment != null) { + attachmentMapper.setAuthor(taskComment.getAuthor()); + attachmentMapper.setCreationDate(taskComment.getCreationDate()); + } } attachmentMapper.setUrl(repositoryTaskData.getRepositoryUrl() + IBugzillaConstants.URL_GET_ATTACHMENT_SUFFIX + attachmentMapper.getAttachmentId()); diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/messages.properties b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/messages.properties index ce3cb9ae0..623a07340 100644 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/messages.properties +++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/messages.properties @@ -84,6 +84,7 @@ BugzillaAttribute_Votes=Votes: BugzillaAttribute_who=who BugzillaAttribute_who_name=who_name BugzillaAttribute_Worked=Worked: +BugzillaAttribute_BugzillaAttribute_Attacher=Attacher BugzillaAttachmentMapper_Author=Attachment Author: BugzillaAttachmentMapper_Content_Type=Content Type: |