diff options
5 files changed, 47 insertions, 1 deletions
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttachmentMapper.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttachmentMapper.java index b3f57f3cf..d659aa47c 100644 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttachmentMapper.java +++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttachmentMapper.java @@ -11,6 +11,8 @@ package org.eclipse.mylyn.internal.bugzilla.core; +import java.util.Date; + import org.eclipse.core.runtime.Assert; import org.eclipse.mylyn.tasks.core.data.TaskAttachmentMapper; import org.eclipse.mylyn.tasks.core.data.TaskAttribute; @@ -24,6 +26,8 @@ import org.eclipse.mylyn.tasks.core.data.TaskData; public class BugzillaAttachmentMapper extends TaskAttachmentMapper { private String token; + private Date deltaDate; + public String getToken() { return token; } @@ -41,7 +45,7 @@ public class BugzillaAttachmentMapper extends TaskAttachmentMapper { if (getAttachmentId() != null) { mapper.setValue(taskAttribute, getAttachmentId()); } - if (getAuthor() != null) { + if (getAuthor() != null && getAuthor().getPersonId() != null) { TaskAttribute child = taskAttribute.createMappedAttribute(TaskAttribute.ATTACHMENT_AUTHOR); TaskAttributeMetaData defaults = child.getMetaData().defaults(); defaults.setType(TaskAttribute.TYPE_PERSON); @@ -111,6 +115,13 @@ public class BugzillaAttachmentMapper extends TaskAttachmentMapper { defaults.setLabel(Messages.BugzillaAttachmentMapper_Token); mapper.setValue(child, getToken()); } + if (getDeltaDate() != null) { + TaskAttribute child = taskAttribute.createMappedAttribute(BugzillaAttribute.DELTA_TS.getKey()); + TaskAttributeMetaData defaults = child.getMetaData().defaults(); + defaults.setType(TaskAttribute.TYPE_DATE); + defaults.setLabel(Messages.BugzillaAttachmentMapper_DELTA_TS); + mapper.setDateValue(child, getDeltaDate()); + } } public static BugzillaAttachmentMapper createFrom(TaskAttribute taskAttribute) { @@ -161,6 +172,18 @@ public class BugzillaAttachmentMapper extends TaskAttachmentMapper { if (child != null) { attachment.setToken(mapper.getValue(child)); } + child = taskAttribute.getMappedAttribute(BugzillaAttribute.DELTA_TS.getKey()); + if (child != null) { + attachment.setDeltaDate(mapper.getDateValue(child)); + } return attachment; } + + public Date getDeltaDate() { + return deltaDate; + } + + public void setDeltaDate(Date deltaDate) { + this.deltaDate = deltaDate; + } } diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java index 026168442..961117824 100644 --- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java +++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java @@ -1072,6 +1072,9 @@ public class BugzillaClient { while (itr.hasNext()) { TaskAttribute attrib = itr.next(); String id = attrib.getId(); + if (id.equals(BugzillaAttribute.DELTA_TS.getKey())) { + continue; + } String value = attrib.getValue(); if (id.equals(TaskAttribute.ATTACHMENT_AUTHOR) || id.equals("date") || id.equals("size") //$NON-NLS-1$ //$NON-NLS-2$ || id.equals(TaskAttribute.ATTACHMENT_URL)) { 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 88d53bcfd..766f9dd51 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 @@ -197,6 +197,8 @@ public class Messages extends NLS { public static String BugzillaAttachmentMapper_Creation_Date; + public static String BugzillaAttachmentMapper_DELTA_TS; + public static String BugzillaAttachmentMapper_Description; public static String BugzillaAttachmentMapper_Filename; 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 070d4a299..aedf7d494 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 @@ -393,6 +393,23 @@ public class SaxMultiBugReportContentHandler extends DefaultHandler { attachment.setContentType(parsedText); } break; + case DELTA_TS: + if (attachment != null) { + try { + if (parsedText != null) { + try { + attachment.setDeltaDate(simpleFormatter.parse(parsedText)); + } catch (ParseException e) { + } + } + } catch (NumberFormatException e) { + // ignore + } + } else { + createAttrribute(parsedText, tag); + } + break; + case SIZE: if (attachment != null) { try { 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 119c132b2..c6871571f 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 @@ -95,6 +95,7 @@ BugzillaAttribute_Attacher=Attacher BugzillaAttachmentMapper_Author=Attachment Author: BugzillaAttachmentMapper_Content_Type=Content Type: BugzillaAttachmentMapper_Creation_Date=Creation Date: +BugzillaAttachmentMapper_DELTA_TS=Modification Date BugzillaAttachmentMapper_Description=Description: BugzillaAttachmentMapper_Filename=Filename: BugzillaAttachmentMapper_obsolete=obsolete |