Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfbecker2010-11-29 19:55:53 +0000
committerfbecker2010-11-29 19:55:53 +0000
commit30077d60ecd314f4f957ced682830d5cfde388b7 (patch)
treea92606922f50c237d9aa9feae41b89de09b1370e /org.eclipse.mylyn.bugzilla.core
parent27c93bf9056f8ba54c45f6ce2659eee533b61d27 (diff)
downloadorg.eclipse.mylyn.tasks-30077d60ecd314f4f957ced682830d5cfde388b7.tar.gz
org.eclipse.mylyn.tasks-30077d60ecd314f4f957ced682830d5cfde388b7.tar.xz
org.eclipse.mylyn.tasks-30077d60ecd314f4f957ced682830d5cfde388b7.zip
ASSIGNED - bug 329164: Bugzilla 4.0 - New Default Status Workflow
https://bugs.eclipse.org/bugs/show_bug.cgi?id=329164
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.core')
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java138
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaOperation.java20
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java11
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaVersion.java5
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java4
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/Messages.java14
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryConfiguration.java163
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxConfigurationContentHandler.java8
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/messages.properties7
9 files changed, 293 insertions, 77 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 4b76763c6..b9a67143b 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
@@ -226,7 +226,7 @@ public class BugzillaClient {
CustomTransitionManager validTransitions = new CustomTransitionManager();
String transitionsFileName = configParameters.get(IBugzillaConstants.BUGZILLA_DESCRIPTOR_FILE);
- if (transitionsFileName != null && !transitionsFileName.equals("")) {
+ if (transitionsFileName != null && !transitionsFileName.equals("")) { //$NON-NLS-1$
if (!validTransitions.parse(transitionsFileName)) {
throw new CoreException(new Status(IStatus.WARNING, BugzillaCorePlugin.ID_PLUGIN,
"Invalide Transition File Content")); //$NON-NLS-1$
@@ -452,10 +452,8 @@ public class BugzillaClient {
try {
BufferedReader in = new BufferedReader(new InputStreamReader(inputStream, getCharacterEncoding()));
HtmlStreamTokenizer tokenizer = new HtmlStreamTokenizer(in, null);
- String body = ""; //$NON-NLS-1$
try {
for (Token token = tokenizer.nextToken(); token.getType() != Token.EOF; token = tokenizer.nextToken()) {
- body += token.toString();
if (token.getType() == Token.TAG && ((HtmlTag) (token.getValue())).getTagType() == Tag.TD
&& !((HtmlTag) (token.getValue())).isEndTag()) {
HtmlTag ta = ((HtmlTag) token.getValue());
@@ -612,7 +610,6 @@ public class BugzillaClient {
for (BugzillaAttribute element : reportElements1) {
BugzillaTaskDataHandler.createAttribute(existingReport, element);
}
- String useParam = taskRepository.getProperty(IBugzillaConstants.BUGZILLA_PARAM_USETARGETMILESTONE);
BugzillaUtil.addAttributeIfUsed(BugzillaAttribute.TARGET_MILESTONE,
IBugzillaConstants.BUGZILLA_PARAM_USETARGETMILESTONE, taskRepository, existingReport, true);
for (BugzillaAttribute element : reportElements2) {
@@ -1191,6 +1188,12 @@ public class BugzillaClient {
private NameValuePair[] getPairsForNew(TaskData taskData) {
Map<String, NameValuePair> fields = new HashMap<String, NameValuePair>();
+ BugzillaVersion bugzillaVersion = null;
+ if (repositoryConfiguration != null) {
+ bugzillaVersion = repositoryConfiguration.getInstallVersion();
+ } else {
+ bugzillaVersion = BugzillaVersion.MIN_VERSION;
+ }
// go through all of the attributes and add them to
// the bug post
@@ -1205,6 +1208,16 @@ public class BugzillaClient {
continue;
}
String id = a.getId();
+ if (id.equals(BugzillaAttribute.BUG_STATUS.getKey())
+ && bugzillaVersion.compareMajorMinorOnly(BugzillaVersion.BUGZILLA_4_0) >= 0) {
+ TaskAttribute attributeOperation = taskData.getRoot().getMappedAttribute(TaskAttribute.OPERATION);
+ value = attributeOperation.getValue().toUpperCase();
+ if (!BugzillaOperation.new_default.toString().toUpperCase().equals(value)) {
+ fields.put(id, new NameValuePair(id, value != null ? value : "")); //$NON-NLS-1$
+ } else {
+ continue;
+ }
+ }
if (id.equals(BugzillaAttribute.NEWCC.getKey())) {
TaskAttribute b = taskData.getRoot().createAttribute(BugzillaAttribute.CC.getKey());
b.getMetaData()
@@ -1239,12 +1252,6 @@ public class BugzillaClient {
TaskAttribute descAttribute = taskData.getRoot().getMappedAttribute(TaskAttribute.DESCRIPTION);
if (descAttribute != null && !descAttribute.getValue().equals("")) { //$NON-NLS-1$
- BugzillaVersion bugzillaVersion = null;
- if (repositoryConfiguration != null) {
- bugzillaVersion = repositoryConfiguration.getInstallVersion();
- } else {
- bugzillaVersion = BugzillaVersion.MIN_VERSION;
- }
if (bugzillaVersion.compareMajorMinorOnly(BugzillaVersion.BUGZILLA_2_18) == 0) {
fields.put(KEY_COMMENT,
@@ -1458,65 +1465,60 @@ public class BugzillaClient {
} 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")) { //$NON-NLS-1$
- selOp = attributeStatus.getValue();
- }
- if (selOp.equals("ACCEPT")) { //$NON-NLS-1$
- selOp = "ASSIGNED"; //$NON-NLS-1$
- }
- if (selOp.equals("RESOLVE")) { //$NON-NLS-1$
+ String selOp = attributeOperation.getValue().toUpperCase();
+ if (selOp.equals("NONE")) { //$NON-NLS-1$
+ selOp = attributeStatus.getValue();
+ }
+ if (selOp.equals("ACCEPT")) { //$NON-NLS-1$
+ selOp = "ASSIGNED"; //$NON-NLS-1$
+ }
+ if (selOp.equals("RESOLVE")) { //$NON-NLS-1$
+ selOp = "RESOLVED"; //$NON-NLS-1$
+ }
+ if (selOp.equals("VERIFY")) { //$NON-NLS-1$
+ selOp = "VERIFIED"; //$NON-NLS-1$
+ }
+ if (selOp.equals("CLOSE")) { //$NON-NLS-1$
+ selOp = "CLOSED"; //$NON-NLS-1$
+ }
+ if (selOp.equals("REOPEN")) { //$NON-NLS-1$
+ selOp = "REOPENED"; //$NON-NLS-1$
+ }
+ if (selOp.equals("MARKNEW")) { //$NON-NLS-1$
+ selOp = "NEW"; //$NON-NLS-1$
+ }
+ if (selOp.equals("DUPLICATE")) { //$NON-NLS-1$
+ if (repositoryConfiguration != null) {
+ selOp = repositoryConfiguration.getDuplicateStatus();
+ } else {
selOp = "RESOLVED"; //$NON-NLS-1$
}
- if (selOp.equals("VERIFY")) { //$NON-NLS-1$
- selOp = "VERIFIED"; //$NON-NLS-1$
- }
- if (selOp.equals("CLOSE")) { //$NON-NLS-1$
- selOp = "CLOSED"; //$NON-NLS-1$
- }
- if (selOp.equals("REOPEN")) { //$NON-NLS-1$
- selOp = "REOPENED"; //$NON-NLS-1$
- }
- if (selOp.equals("MARKNEW")) { //$NON-NLS-1$
- selOp = "NEW"; //$NON-NLS-1$
- }
- if (selOp.equals("DUPLICATE")) { //$NON-NLS-1$
- if (repositoryConfiguration != null) {
- selOp = repositoryConfiguration.getDuplicateStatus();
+ String knob = BugzillaAttribute.RESOLUTION.getKey();
+ fields.put(knob, new NameValuePair(knob, "DUPLICATE")); //$NON-NLS-1$
+ }
+ fields.put(fieldName, new NameValuePair(fieldName, selOp));
+ if (inputAttributeId != null && !inputAttributeId.equals("")) { //$NON-NLS-1$
+ 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 {
- selOp = "RESOLVED"; //$NON-NLS-1$
- }
- String knob = BugzillaAttribute.RESOLUTION.getKey();
- fields.put(knob, new NameValuePair(knob, "DUPLICATE")); //$NON-NLS-1$
- }
-
- fields.put(fieldName, new NameValuePair(fieldName, selOp));
- if (inputAttributeId != null && !inputAttributeId.equals("")) { //$NON-NLS-1$
- 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.duplicate.toString())) {
- knob = inputAttributeId;
- }
- if (knob.equals(BugzillaOperation.reassign.toString())) {
- knob = BugzillaAttribute.ASSIGNED_TO.getKey();
- }
- fields.put(knob, new NameValuePair(knob, sel));
+ String sel = inputAttribute.getValue();
+ String knob = attributeOperation.getValue();
+ if (knob.equals(BugzillaOperation.duplicate.toString())) {
+ knob = inputAttributeId;
+ }
+ if (knob.equals(BugzillaOperation.reassign.toString())) {
+ knob = BugzillaAttribute.ASSIGNED_TO.getKey();
}
+ fields.put(knob, new NameValuePair(knob, sel));
}
}
}
@@ -1796,7 +1798,7 @@ public class BugzillaClient {
throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN,
IBugzillaConstants.REPOSITORY_STATUS_SUSPICIOUS_ACTION,
- repositoryUrl.toString(), "unknown reason because Bugzilla < 4.0 was used"));
+ repositoryUrl.toString(), "unknown reason because Bugzilla < 4.0 was used")); //$NON-NLS-1$
}
}
@@ -1829,8 +1831,8 @@ public class BugzillaClient {
String result = title.trim();
if (result.length() == 0) {
- if (body.contains("Bugzilla/Bug.pm line")) {
- result = "Bugzilla/Bug.pm line";
+ if (body.contains("Bugzilla/Bug.pm line")) { //$NON-NLS-1$
+ result = "Bugzilla/Bug.pm line"; //$NON-NLS-1$
}
}
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaOperation.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaOperation.java
index 5ee58d4d0..e95fe4348 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaOperation.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaOperation.java
@@ -21,7 +21,9 @@ import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
*/
public class BugzillaOperation extends AbstractBugzillaOperation {
- private static final long serialVersionUID = 1920016855179988829L;
+// old: private static final long serialVersionUID = 1920016855179988829L;
+
+ private static final long serialVersionUID = 5940437048263423786L;
public static final BugzillaOperation none = new BugzillaOperation(Messages.BugzillaOperation_Leave_as_X_X, "none"); //$NON-NLS-1$
@@ -55,6 +57,22 @@ public class BugzillaOperation extends AbstractBugzillaOperation {
public static final BugzillaOperation reassignbycomponent = new BugzillaOperation(
Messages.BugzillaOperation_Reassign_to_default_assignee, "reassignbycomponent"); //$NON-NLS-1$
+ // Bugzilla 4.0
+ public static final BugzillaOperation unconfirmed = new BugzillaOperation(Messages.BugzillaOperation_unconfirmed,
+ "unconfirmed"); //$NON-NLS-1$
+
+ public static final BugzillaOperation confirmed = new BugzillaOperation(Messages.BugzillaOperation_confirmed,
+ "confirmed"); //$NON-NLS-1$
+
+ public static final BugzillaOperation in_progress = new BugzillaOperation(Messages.BugzillaOperation_in_progress,
+ "in_progress"); //$NON-NLS-1$
+
+ public static final BugzillaOperation verify_with_resolution = new BugzillaOperation(
+ Messages.BugzillaOperation_verified, "resolutionInput", TaskAttribute.TYPE_SINGLE_SELECT, "verify"); //$NON-NLS-1$//$NON-NLS-2$
+
+ public static final BugzillaOperation new_default = new BugzillaOperation(Messages.BugzillaOperation_default,
+ "{Start}"); //$NON-NLS-1$
+
private final String value;
BugzillaOperation(String label) {
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java
index 77613b526..8a55ac06e 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskDataHandler.java
@@ -474,7 +474,16 @@ public class BugzillaTaskDataHandler extends AbstractTaskDataHandler {
attributeStatus.putOption(option, option);
}
- attributeStatus.setValue(repositoryConfiguration.getStartStatus());
+ BugzillaVersion bugzillaVersion = repositoryConfiguration.getInstallVersion();
+ if (bugzillaVersion == null) {
+ bugzillaVersion = BugzillaVersion.MIN_VERSION;
+ }
+ if (bugzillaVersion.compareMajorMinorOnly(BugzillaVersion.BUGZILLA_4_0) < 0) {
+ attributeStatus.setValue(repositoryConfiguration.getStartStatus());
+ } else {
+ attributeStatus.setValue(IBugzillaConstants.BUGZILLA_REPORT_STATUS_4_0.START.toString());
+ repositoryConfiguration.addValidOperations(taskData);
+ }
createAttribute(taskData, BugzillaAttribute.SHORT_DESC);
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaVersion.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaVersion.java
index a98c501ed..0f05bb931 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaVersion.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaVersion.java
@@ -38,7 +38,9 @@ public class BugzillaVersion implements Comparable<BugzillaVersion>, Serializabl
public final static BugzillaVersion BUGZILLA_3_6 = new BugzillaVersion("3.6"); //$NON-NLS-1$
- public final static BugzillaVersion MAX_VERSION = new BugzillaVersion("3.6"); //$NON-NLS-1$
+ public final static BugzillaVersion BUGZILLA_4_0 = new BugzillaVersion("4.0"); //$NON-NLS-1$
+
+ public final static BugzillaVersion MAX_VERSION = BUGZILLA_4_0;
private final int major;
@@ -57,6 +59,7 @@ public class BugzillaVersion implements Comparable<BugzillaVersion>, Serializabl
rc = false;
plus = false;
} else {
+ version = version.toUpperCase();
rc = version.contains("RC"); //$NON-NLS-1$
plus = version.contains("+"); //$NON-NLS-1$
if (plus) {
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java
index 370342620..379be9610 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java
@@ -212,6 +212,10 @@ public interface IBugzillaConstants {
UNCONFIRMED, NEW, ASSIGNED, REOPENED, RESOLVED, VERIFIED, CLOSED, SCHEDULED;
}
+ public static enum BUGZILLA_REPORT_STATUS_4_0 {
+ START, UNCONFIRMED, CONFIRMED, IN_PROGRESS, RESOLVED, VERIFIED;
+ }
+
public static enum BUGZILLA_RESOLUTION_2_0 {
FIXED, INVALID, WONTFIX, LATER, REMIND, WORKSFORME;
}
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 4f30414be..7b1a3ff80 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
@@ -211,8 +211,14 @@ public class Messages extends NLS {
public static String BugzillaOperation_Accept_to_ASSIGNED;
+ public static String BugzillaOperation_confirmed;
+
+ public static String BugzillaOperation_default;
+
public static String BugzillaOperation_Duplicate_of;
+ public static String BugzillaOperation_in_progress;
+
public static String BugzillaOperation_Leave_as_X_X;
public static String BugzillaOperation_Mark_as_NEW;
@@ -229,6 +235,10 @@ public class Messages extends NLS {
public static String BugzillaOperation_Reassign_to_default_assignee;
+ public static String BugzillaOperation_unconfirmed;
+
+ public static String BugzillaOperation_verified;
+
public static String BugzillaRepositoryConnector_BUGZILLA_CONNECTOR_LABEL;
public static String BugzillaRepositoryConnector_Check_repository_configuration;
@@ -291,4 +301,8 @@ public class Messages extends NLS {
public static String CustomTransitionManager_UnexpectedResponse;
+ public static String RepositoryConfiguration_new_default;
+
+ public static String RepositoryConfiguration_new_not_shure;
+
}
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryConfiguration.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryConfiguration.java
index 2b64d7bb7..bfb5a5730 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryConfiguration.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryConfiguration.java
@@ -25,6 +25,7 @@ import java.util.Map;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants.BUGZILLA_REPORT_STATUS;
+import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants.BUGZILLA_REPORT_STATUS_4_0;
import org.eclipse.mylyn.internal.bugzilla.core.service.BugzillaXmlRpcClient;
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
import org.eclipse.mylyn.tasks.core.data.TaskData;
@@ -261,6 +262,15 @@ public class RepositoryConfiguration implements Serializable {
}
}
+ public void addUnconfirmedAllowed(String product, Boolean unconfirmedAllowed) {
+ ProductEntry entry = products.get(product);
+ if (entry == null) {
+ entry = new ProductEntry(product);
+ products.put(product, entry);
+ }
+ entry.setUnconfirmedAllowed(unconfirmedAllowed);
+ }
+
/**
* Container for product information: name, components.
*/
@@ -279,6 +289,8 @@ public class RepositoryConfiguration implements Serializable {
String defaultMilestone = null;
+ Boolean unconfirmedAllowed = false;
+
ProductEntry(String name) {
this.productName = name;
}
@@ -318,6 +330,14 @@ public class RepositoryConfiguration implements Serializable {
public void setDefaultMilestone(String defaultMilestone) {
this.defaultMilestone = defaultMilestone;
}
+
+ public Boolean getUnconfirmedAllowed() {
+ return unconfirmedAllowed;
+ }
+
+ public void setUnconfirmedAllowed(Boolean unconfirmedAllowed) {
+ this.unconfirmedAllowed = unconfirmedAllowed;
+ }
}
public List<String> getOpenStatusValues() {
@@ -374,7 +394,9 @@ public class RepositoryConfiguration implements Serializable {
validTransitions = new CustomTransitionManager();
}
if (xmlClient == null) {
- validTransitions.parse(fileName);
+ if (!validTransitions.parse(fileName)) {
+ validTransitions = null;
+ }
} else {
validTransitions.parse(monitor, xmlClient);
}
@@ -626,6 +648,100 @@ public class RepositoryConfiguration implements Serializable {
}
public void addValidOperations(TaskData bugReport) {
+ BugzillaVersion bugzillaVersion = getInstallVersion();
+ if (bugzillaVersion == null) {
+ bugzillaVersion = BugzillaVersion.MIN_VERSION;
+ }
+ if (bugzillaVersion.compareMajorMinorOnly(BugzillaVersion.BUGZILLA_4_0) < 0) {
+ addValidOperationsBefore4(bugReport);
+ } else {
+ addValidOperationsAfter4(bugReport);
+ }
+ }
+
+ public void addValidOperationsAfter4(TaskData bugReport) {
+ TaskAttribute attributeStatus = bugReport.getRoot().getMappedAttribute(TaskAttribute.STATUS);
+ BUGZILLA_REPORT_STATUS_4_0 status = BUGZILLA_REPORT_STATUS_4_0.UNCONFIRMED;
+ if (attributeStatus != null) {
+ try {
+ status = BUGZILLA_REPORT_STATUS_4_0.valueOf(attributeStatus.getValue());
+ } catch (RuntimeException e) {
+ status = BUGZILLA_REPORT_STATUS_4_0.UNCONFIRMED;
+ }
+ }
+ if (validTransitions != null && attributeStatus != null && validTransitions.isValid()) {
+ //Handle custom operations. Currently only tuned for transitions based on default status names
+ addOperation(bugReport, BugzillaOperation.none);
+ for (AbstractBugzillaOperation b : validTransitions.getValidTransitions(attributeStatus.getValue())) {
+ //Special case: the CLOSED status needs a Resolution input.
+ //This happens automatically if current status is RESOLVED, else we need to supply one
+ if (b.toString().equals(BugzillaOperation.close.toString())) {
+ if (attributeStatus.getValue().equals("RESOLVED") && b.getInputId() != null) { //$NON-NLS-1$
+ //Do not add close with resolution operation if status is RESOLVED
+ continue;
+ } else if (!attributeStatus.getValue().equals("RESOLVED") && b.getInputId() == null) { //$NON-NLS-1$
+ //Do not add normal 'close' operation if status is not currently RESOLVED
+ continue;
+ }
+ }
+ addOperation(bugReport, b);
+ }
+ } else {
+ TaskAttribute everConfirmed = bugReport.getRoot().getAttribute(BugzillaAttribute.EVERCONFIRMED.getKey());
+ TaskAttribute product = bugReport.getRoot().getMappedAttribute(TaskAttribute.PRODUCT);
+ Boolean unconfirmedAllowed = products.get(product.getValue()).getUnconfirmedAllowed();
+
+ switch (status) {
+ case START:
+ addOperation(bugReport, BugzillaOperation.new_default);
+ addOperation(bugReport, BugzillaOperation.unconfirmed);
+ addOperation(bugReport, BugzillaOperation.confirmed);
+ addOperation(bugReport, BugzillaOperation.in_progress);
+ TaskAttribute operationAttribute = bugReport.getRoot().getAttribute(TaskAttribute.OPERATION);
+ TaskOperation.applyTo(operationAttribute, BugzillaOperation.new_default.toString(),
+ IBugzillaConstants.BUGZILLA_REPORT_STATUS_4_0.START.toString());
+ break;
+ case UNCONFIRMED:
+ addOperation(bugReport, BugzillaOperation.none);
+ addOperation(bugReport, BugzillaOperation.confirmed);
+ addOperation(bugReport, BugzillaOperation.in_progress);
+ addOperation(bugReport, BugzillaOperation.resolve);
+ break;
+ case CONFIRMED:
+ addOperation(bugReport, BugzillaOperation.none);
+ addOperation(bugReport, BugzillaOperation.in_progress);
+ addOperation(bugReport, BugzillaOperation.resolve);
+ break;
+ case IN_PROGRESS:
+ addOperation(bugReport, BugzillaOperation.none);
+ addOperation(bugReport, BugzillaOperation.confirmed);
+ addOperation(bugReport, BugzillaOperation.resolve);
+ break;
+ case RESOLVED:
+ addOperation(bugReport, BugzillaOperation.none);
+ if (everConfirmed == null && unconfirmedAllowed) {
+ addOperation(bugReport, BugzillaOperation.unconfirmed);
+ } else {
+ addOperation(bugReport, BugzillaOperation.confirmed);
+ }
+ addOperation(bugReport, BugzillaOperation.verify_with_resolution);
+ break;
+ case VERIFIED:
+ addOperation(bugReport, BugzillaOperation.none);
+ if (everConfirmed == null && unconfirmedAllowed) {
+ addOperation(bugReport, BugzillaOperation.unconfirmed);
+ } else {
+ addOperation(bugReport, BugzillaOperation.confirmed);
+ }
+ addOperation(bugReport, BugzillaOperation.resolve);
+ break;
+ }
+ addOperation(bugReport, BugzillaOperation.duplicate);
+ }
+
+ }
+
+ public void addValidOperationsBefore4(TaskData bugReport) {
TaskAttribute attributeStatus = bugReport.getRoot().getMappedAttribute(TaskAttribute.STATUS);
BUGZILLA_REPORT_STATUS status = BUGZILLA_REPORT_STATUS.NEW;
@@ -801,6 +917,23 @@ public class RepositoryConfiguration implements Serializable {
if (getResolutions().size() > 0) {
attrResolvedInput.setValue(getResolutions().get(0));
}
+ } else if (op.toString().equals(BugzillaOperation.verify_with_resolution.toString()) && op.getInputId() != null) {
+ TaskAttribute attributeResolution = bugReport.getRoot().getMappedAttribute(T