Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2009-01-20 03:49:32 +0000
committerspingel2009-01-20 03:49:32 +0000
commitcb0803a7ee4862168e7397e79be8f8f4610cffae (patch)
tree9a5b3d93e366c02a0877af1b6ec33bc2920055c1
parent0e48ca97785ea222c7f1344752816b470ec145db (diff)
downloadorg.eclipse.mylyn.tasks-cb0803a7ee4862168e7397e79be8f8f4610cffae.tar.gz
org.eclipse.mylyn.tasks-cb0803a7ee4862168e7397e79be8f8f4610cffae.tar.xz
org.eclipse.mylyn.tasks-cb0803a7ee4862168e7397e79be8f8f4610cffae.zip
NEW - bug 259289: ensure Bugzilla 3.2 support or migration path for ganymede update 2
https://bugs.eclipse.org/bugs/show_bug.cgi?id=259289
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java164
1 files changed, 125 insertions, 39 deletions
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 61297723d..c299b92c7 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
@@ -979,7 +979,8 @@ public class BugzillaClient {
} else if (a.getId().equals(BugzillaAttribute.REPORTER.getKey())
|| a.getId().equals(BugzillaAttribute.CC.getKey())
|| a.getId().equals(BugzillaAttribute.REMOVECC.getKey())
- || a.getId().equals(BugzillaAttribute.CREATION_TS.getKey())) {
+ || a.getId().equals(BugzillaAttribute.CREATION_TS.getKey())
+ || a.getId().equals(BugzillaAttribute.BUG_STATUS.getKey())) {
continue;
}
@@ -1015,46 +1016,141 @@ public class BugzillaClient {
}
// add the operation to the bug post
- TaskAttribute attributeOperation = model.getRoot().getMappedAttribute(TaskAttribute.OPERATION);
- if (attributeOperation == null) {
- fields.put(KEY_KNOB, new NameValuePair(KEY_KNOB, VAL_NONE));
+ String bugzillaVersion = null;
+ if (repositoryConfiguration != null) {
+ bugzillaVersion = repositoryConfiguration.getInstallVersion();
} else {
- TaskAttribute originalOperation = model.getRoot().getAttribute(
- TaskAttribute.PREFIX_OPERATION + attributeOperation.getValue());
- if (originalOperation == null) {
- // Work around for bug#241012
+ bugzillaVersion = "2.18";
+ }
+ if (bugzillaVersion.compareTo("3.2") < 0) {
+
+ TaskAttribute attributeOperation = model.getRoot().getMappedAttribute(TaskAttribute.OPERATION);
+ if (attributeOperation == null) {
fields.put(KEY_KNOB, new NameValuePair(KEY_KNOB, VAL_NONE));
} else {
- String inputAttributeId = originalOperation.getMetaData().getValue(
- TaskAttribute.META_ASSOCIATED_ATTRIBUTE_ID);
+ TaskAttribute originalOperation = model.getRoot().getAttribute(
+ TaskAttribute.PREFIX_OPERATION + attributeOperation.getValue());
if (originalOperation == null) {
+ // Work around for bug#241012
fields.put(KEY_KNOB, new NameValuePair(KEY_KNOB, VAL_NONE));
- } else if (inputAttributeId == null || inputAttributeId.equals("")) {
- String sel = attributeOperation.getValue();
- fields.put(KEY_KNOB, new NameValuePair(KEY_KNOB, sel));
} else {
- fields.put(KEY_KNOB, new NameValuePair(KEY_KNOB, attributeOperation.getValue()));
- TaskAttribute inputAttribute = attributeOperation.getTaskData().getRoot().getAttribute(
- inputAttributeId);
- if (inputAttribute != null) {
- if (inputAttribute.getOptions().size() > 0) {
- String sel = inputAttribute.getValue();
- String knob = inputAttribute.getId();
- if (knob.equals(BugzillaOperation.resolve.getInputId())) {
- knob = BugzillaAttribute.RESOLUTION.getKey();
+ String inputAttributeId = originalOperation.getMetaData().getValue(
+ TaskAttribute.META_ASSOCIATED_ATTRIBUTE_ID);
+ if (originalOperation == null) {
+ fields.put(KEY_KNOB, new NameValuePair(KEY_KNOB, VAL_NONE));
+ } else if (inputAttributeId == null || inputAttributeId.equals("")) {
+ String sel = attributeOperation.getValue();
+ fields.put(KEY_KNOB, new NameValuePair(KEY_KNOB, sel));
+ } else {
+ fields.put(KEY_KNOB, new NameValuePair(KEY_KNOB, attributeOperation.getValue()));
+ TaskAttribute inputAttribute = attributeOperation.getTaskData().getRoot().getAttribute(
+ inputAttributeId);
+ if (inputAttribute != null) {
+ if (inputAttribute.getOptions().size() > 0) {
+ String sel = inputAttribute.getValue();
+ String knob = inputAttribute.getId();
+ if (knob.equals(BugzillaOperation.resolve.getInputId())) {
+ knob = BugzillaAttribute.RESOLUTION.getKey();
+ }
+ fields.put(knob, new NameValuePair(knob, inputAttribute.getOption(sel)));
+ } else {
+ String sel = inputAttribute.getValue();
+ String knob = attributeOperation.getValue();
+ if (knob.equals(BugzillaOperation.reassign.toString())) {
+ knob = BugzillaAttribute.ASSIGNED_TO.getKey();
+ }
+ fields.put(knob, new NameValuePair(knob, sel));
}
- fields.put(knob, new NameValuePair(knob, inputAttribute.getOption(sel)));
- } else {
- String sel = inputAttribute.getValue();
- String knob = attributeOperation.getValue();
- if (knob.equals(BugzillaOperation.reassign.toString())) {
- knob = BugzillaAttribute.ASSIGNED_TO.getKey();
+ }
+ }
+ }
+ if (model.getRoot().getMappedAttribute(TaskAttribute.COMMENT_NEW) != null
+ && model.getRoot().getMappedAttribute(TaskAttribute.COMMENT_NEW).getValue().length() > 0) {
+ fields.put(KEY_COMMENT, new NameValuePair(KEY_COMMENT, model.getRoot().getMappedAttribute(
+ TaskAttribute.COMMENT_NEW).getValue()));
+ } else if (attributeOperation != null
+ && attributeOperation.getValue().equals(BugzillaOperation.duplicate.toString())) {
+ // fix for bug#198677
+ fields.put(KEY_COMMENT, new NameValuePair(KEY_COMMENT, ""));
+ }
+ }
+ } else {
+ String fieldName = BugzillaAttribute.BUG_STATUS.getKey();
+ TaskAttribute attributeStatus = model.getRoot().getMappedAttribute(TaskAttribute.STATUS);
+ TaskAttribute attributeOperation = model.getRoot().getMappedAttribute(TaskAttribute.OPERATION);
+ if (attributeOperation == null) {
+ fields.put(fieldName, new NameValuePair(fieldName, attributeStatus.getValue()));
+ } else {
+ TaskAttribute originalOperation = model.getRoot().getAttribute(
+ TaskAttribute.PREFIX_OPERATION + attributeOperation.getValue());
+ if (originalOperation == null) {
+ // Work around for bug#241012
+ fields.put(fieldName, new NameValuePair(fieldName, attributeStatus.getValue()));
+ } else {
+ String inputAttributeId = originalOperation.getMetaData().getValue(
+ TaskAttribute.META_ASSOCIATED_ATTRIBUTE_ID);
+ if (originalOperation == null) {
+ fields.put(fieldName, new NameValuePair(fieldName, attributeStatus.getValue()));
+ } else {
+ String selOp = attributeOperation.getValue().toUpperCase();
+ if (selOp.equals("NONE")) {
+ selOp = attributeStatus.getValue();
+ }
+ if (selOp.equals("ACCEPT")) {
+ selOp = "ASSIGNED";
+ }
+ if (selOp.equals("RESOLVE")) {
+ selOp = "RESOLVED";
+ }
+ if (selOp.equals("VERIFY")) {
+ selOp = "VERIFIED";
+ }
+ if (selOp.equals("CLOSE")) {
+ selOp = "CLOSED";
+ }
+ if (selOp.equals("REOPEN")) {
+ selOp = "REOPENED";
+ }
+ if (selOp.equals("DUPLICATE")) {
+ selOp = "RESOLVED";
+ String knob = BugzillaAttribute.RESOLUTION.getKey();
+ fields.put(knob, new NameValuePair(knob, "DUPLICATE"));
+ }
+
+ fields.put(fieldName, new NameValuePair(fieldName, selOp));
+ if (inputAttributeId != null && !inputAttributeId.equals("")) {
+ TaskAttribute inputAttribute = attributeOperation.getTaskData().getRoot().getAttribute(
+ inputAttributeId);
+ if (inputAttribute != null) {
+ if (inputAttribute.getOptions().size() > 0) {
+ String sel = inputAttribute.getValue();
+ String knob = inputAttribute.getId();
+ if (knob.equals(BugzillaOperation.resolve.getInputId())) {
+ knob = BugzillaAttribute.RESOLUTION.getKey();
+ }
+ fields.put(knob, new NameValuePair(knob, inputAttribute.getOption(sel)));
+ } else {
+ String sel = inputAttribute.getValue();
+ String knob = attributeOperation.getValue();
+ if (knob.equals("duplicate")) {
+ knob = inputAttributeId;
+ }
+ if (knob.equals(BugzillaOperation.reassign.toString())) {
+ knob = BugzillaAttribute.ASSIGNED_TO.getKey();
+ }
+ fields.put(knob, new NameValuePair(knob, sel));
+ }
}
- fields.put(knob, new NameValuePair(knob, sel));
}
}
}
}
+
+ if (model.getRoot().getMappedAttribute(TaskAttribute.COMMENT_NEW) != null
+ && model.getRoot().getMappedAttribute(TaskAttribute.COMMENT_NEW).getValue().length() > 0) {
+ fields.put(KEY_COMMENT, new NameValuePair(KEY_COMMENT, model.getRoot().getMappedAttribute(
+ TaskAttribute.COMMENT_NEW).getValue()));
+ }
}
if (model.getRoot().getMappedAttribute(BugzillaAttribute.SHORT_DESC.getKey()) != null) {
@@ -1062,16 +1158,6 @@ public class BugzillaClient {
BugzillaAttribute.SHORT_DESC.getKey()).getValue()));
}
- if (model.getRoot().getMappedAttribute(TaskAttribute.COMMENT_NEW) != null
- && model.getRoot().getMappedAttribute(TaskAttribute.COMMENT_NEW).getValue().length() > 0) {
- fields.put(KEY_COMMENT, new NameValuePair(KEY_COMMENT, model.getRoot().getMappedAttribute(
- TaskAttribute.COMMENT_NEW).getValue()));
- } else if (attributeOperation != null
- && attributeOperation.getValue().equals(BugzillaOperation.duplicate.toString())) {
- // fix for bug#198677
- fields.put(KEY_COMMENT, new NameValuePair(KEY_COMMENT, ""));
- }
-
TaskAttribute attributeRemoveCC = model.getRoot().getMappedAttribute(BugzillaAttribute.REMOVECC.getKey());
if (attributeRemoveCC != null) {
List<String> removeCC = attributeRemoveCC.getValues();

Back to the top