Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Becker2012-11-18 19:59:08 +0000
committerFrank Becker2012-11-18 19:59:08 +0000
commit72b8c9fd60941718cbd8b35285e1b59421b9af9d (patch)
tree772c19015888227d7cfc00104403e25247ec981b
parent0c7924dc3215b1403bf760edc4cf97f4d054c65c (diff)
downloadorg.eclipse.mylyn.tasks-72b8c9fd60941718cbd8b35285e1b59421b9af9d.tar.gz
org.eclipse.mylyn.tasks-72b8c9fd60941718cbd8b35285e1b59421b9af9d.tar.xz
org.eclipse.mylyn.tasks-72b8c9fd60941718cbd8b35285e1b59421b9af9d.zip
372600: redesign of RepositoryConfiguration
change the storage structure Change-Id: I0000000000000000000000000000000000000000 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=372600
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/core/data/RepositoryConfigurationData.java116
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/core/data/RepositoryConfigurationItem.java33
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/core/data/RepositoryConfigurationProductItem.java42
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/core/data/RepositoryConfigurationSubItem.java50
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/RepositoryConfiguration.java269
5 files changed, 327 insertions, 183 deletions
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/core/data/RepositoryConfigurationData.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/core/data/RepositoryConfigurationData.java
new file mode 100644
index 000000000..e0d24d22b
--- /dev/null
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/core/data/RepositoryConfigurationData.java
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Frank Becker and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Frank Becker - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.bugzilla.core.data;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttribute;
+
+public class RepositoryConfigurationData implements Serializable {
+
+ private static final long serialVersionUID = -6370616800459566227L;
+
+ private final Map<BugzillaAttribute, List<RepositoryConfigurationItem>> itemsByAttribute;
+
+ private final Map<BugzillaAttribute, Map<String, RepositoryConfigurationItem>> itemsByNamedAttribute;
+
+ public RepositoryConfigurationData() {
+ itemsByAttribute = new HashMap<BugzillaAttribute, List<RepositoryConfigurationItem>>();
+ itemsByNamedAttribute = new HashMap<BugzillaAttribute, Map<String, RepositoryConfigurationItem>>();
+ }
+
+ public List<RepositoryConfigurationItem> getConfigurationItems(BugzillaAttribute element) {
+ Assert.isNotNull(element);
+ return itemsByAttribute.get(element);
+ }
+
+ public boolean containsItemWithName(BugzillaAttribute element, String name) {
+ Assert.isNotNull(element);
+ Assert.isNotNull(name);
+ List<RepositoryConfigurationItem> items = itemsByAttribute.get(element);
+ if (items == null) {
+ return false;
+ }
+ for (RepositoryConfigurationItem repositoryConfigurationItem : items) {
+ if (repositoryConfigurationItem.equals(name)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public RepositoryConfigurationItem getNamedItem(BugzillaAttribute element, String name) {
+ if (itemsByNamedAttribute.get(element) != null) {
+ return itemsByNamedAttribute.get(element).get(name);
+ }
+ return null;
+ }
+
+ public void addItem(BugzillaAttribute element, RepositoryConfigurationItem item) {
+ Assert.isNotNull(element);
+ Assert.isNotNull(item);
+ if (itemsByAttribute.get(element) == null) {
+ itemsByAttribute.put(element, new ArrayList<RepositoryConfigurationItem>());
+ }
+ itemsByAttribute.get(element).add(item);
+ }
+
+ public void addNamedItem(BugzillaAttribute element, RepositoryConfigurationItem item) {
+ Assert.isNotNull(element);
+ Assert.isNotNull(item);
+ if (itemsByNamedAttribute.get(element) == null) {
+ itemsByNamedAttribute.put(element, new HashMap<String, RepositoryConfigurationItem>());
+ }
+ itemsByNamedAttribute.get(element).put(item.getName(), item);
+ }
+
+ public RepositoryConfigurationItem[] getConfigurationItemsArray(BugzillaAttribute element) {
+ Assert.isNotNull(element);
+ return itemsByAttribute.get(element) != null ? itemsByAttribute.get(element).toArray(
+ new RepositoryConfigurationItem[0]) : null;
+ }
+
+ public List<String> getConfigurationItemsAsStringList(BugzillaAttribute element) {
+ Assert.isNotNull(element);
+ synchronized (this) {
+ List<RepositoryConfigurationItem> items = itemsByAttribute.get(element);
+ if (items != null) {
+ List<String> result = new ArrayList<String>(items.size());
+ for (RepositoryConfigurationItem repositoryConfigurationItem : items) {
+ result.add(repositoryConfigurationItem.getName());
+ }
+ return result;
+ }
+ return Collections.emptyList();
+ }
+ }
+
+ public List<String> getConfigurationNamedItemsAsStringList(BugzillaAttribute element) {
+ Assert.isNotNull(element);
+ synchronized (this) {
+ Map<String, RepositoryConfigurationItem> namedItem = itemsByNamedAttribute.get(element);
+ if (namedItem != null) {
+ ArrayList<String> namedItemKeyList = new ArrayList<String>(namedItem.keySet());
+ Collections.sort(namedItemKeyList, String.CASE_INSENSITIVE_ORDER);
+ return namedItemKeyList;
+ }
+ return Collections.emptyList();
+ }
+ }
+
+}
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/core/data/RepositoryConfigurationItem.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/core/data/RepositoryConfigurationItem.java
new file mode 100644
index 000000000..ecef613d4
--- /dev/null
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/core/data/RepositoryConfigurationItem.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Frank Becker and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Frank Becker - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.bugzilla.core.data;
+
+import java.io.Serializable;
+
+import org.eclipse.core.runtime.Assert;
+
+public class RepositoryConfigurationItem implements Serializable {
+
+ private static final long serialVersionUID = -2915368043846801298L;
+
+ private final String name;
+
+ public RepositoryConfigurationItem(String name) {
+ Assert.isNotNull(name);
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+}
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/core/data/RepositoryConfigurationProductItem.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/core/data/RepositoryConfigurationProductItem.java
new file mode 100644
index 000000000..4190d0776
--- /dev/null
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/core/data/RepositoryConfigurationProductItem.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Frank Becker and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Frank Becker - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.bugzilla.core.data;
+
+public class RepositoryConfigurationProductItem extends RepositoryConfigurationSubItem {
+
+ private static final long serialVersionUID = 958830945072017152L;
+
+ private String defaultMilestone = null;
+
+ private Boolean unconfirmedAllowed = false;
+
+ public RepositoryConfigurationProductItem(String name) {
+ super(name);
+ }
+
+ public String getDefaultMilestone() {
+ return defaultMilestone;
+ }
+
+ public void setDefaultMilestone(String defaultMilestone) {
+ this.defaultMilestone = defaultMilestone;
+ }
+
+ public Boolean getUnconfirmedAllowed() {
+ return unconfirmedAllowed;
+ }
+
+ public void setUnconfirmedAllowed(Boolean unconfirmedAllowed) {
+ this.unconfirmedAllowed = unconfirmedAllowed;
+ }
+
+}
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/core/data/RepositoryConfigurationSubItem.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/core/data/RepositoryConfigurationSubItem.java
new file mode 100644
index 000000000..b4afec904
--- /dev/null
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/bugzilla/core/data/RepositoryConfigurationSubItem.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Frank Becker and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Frank Becker - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.bugzilla.core.data;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttribute;
+
+public class RepositoryConfigurationSubItem extends RepositoryConfigurationItem {
+
+ private static final long serialVersionUID = 5876901980766940630L;
+
+ private final RepositoryConfigurationData data = new RepositoryConfigurationData();
+
+ public RepositoryConfigurationSubItem(String name) {
+ super(name);
+ // ignore
+ }
+
+ public void addItem(BugzillaAttribute element, RepositoryConfigurationItem item) {
+ Assert.isNotNull(element);
+ Assert.isNotNull(item);
+ if (!data.containsItemWithName(element, item.getName())) {
+ data.addItem(element, item);
+ }
+ }
+
+ public List<String> getConfigurationItemsAsStringList(BugzillaAttribute element) {
+ return data.getConfigurationItemsAsStringList(element);
+ }
+
+ public RepositoryConfigurationItem[] getConfigurationItemsArray(BugzillaAttribute element) {
+ return data.getConfigurationItemsArray(element);
+ }
+
+ public RepositoryConfigurationItem getNamedItem(BugzillaAttribute element, String name) {
+ return data.getNamedItem(element, name);
+ }
+
+}
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 ad32855fc..f18c0d6cc 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
@@ -16,14 +16,16 @@ import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
-import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
-import java.util.Map;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.mylyn.bugzilla.core.data.RepositoryConfigurationData;
+import org.eclipse.mylyn.bugzilla.core.data.RepositoryConfigurationItem;
+import org.eclipse.mylyn.bugzilla.core.data.RepositoryConfigurationProductItem;
+import org.eclipse.mylyn.bugzilla.core.data.RepositoryConfigurationSubItem;
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;
@@ -46,33 +48,11 @@ public class RepositoryConfiguration implements Serializable {
private String repositoryUrl = "<unknown>"; //$NON-NLS-1$
- private final Map<String, ProductEntry> products = new HashMap<String, ProductEntry>();
-
- private final List<String> platforms = new ArrayList<String>();
-
- private final List<String> operatingSystems = new ArrayList<String>();
-
- private final List<String> priorities = new ArrayList<String>();
-
- private final List<String> severities = new ArrayList<String>();
-
- private final List<String> bugStatus = new ArrayList<String>();
-
private final List<String> openStatusValues = new ArrayList<String>();
private final List<String> closedStatusValues = new ArrayList<String>();
- private final List<String> resolutionValues = new ArrayList<String>();
-
- private final List<String> keywords = new ArrayList<String>();
-
- // master lists
-
- private final List<String> versions = new ArrayList<String>();
-
- private final List<String> components = new ArrayList<String>();
-
- private final List<String> milestones = new ArrayList<String>();
+ private final RepositoryConfigurationData data = new RepositoryConfigurationData();
private final List<BugzillaCustomField> customFields = new ArrayList<BugzillaCustomField>();
@@ -95,9 +75,11 @@ public class RepositoryConfiguration implements Serializable {
* Adds a product to the configuration.
*/
public void addProduct(String name) {
- if (!products.containsKey(name)) {
- ProductEntry product = new ProductEntry(name);
- products.put(name, product);
+ RepositoryConfigurationProductItem entry = (RepositoryConfigurationProductItem) data.getNamedItem(
+ BugzillaAttribute.PRODUCT, name);
+ if (entry == null) {
+ entry = new RepositoryConfigurationProductItem(name);
+ data.addNamedItem(BugzillaAttribute.PRODUCT, entry);
}
}
@@ -105,9 +87,7 @@ public class RepositoryConfiguration implements Serializable {
* Returns an array of names of current products.
*/
private List<String> getProducts() {
- ArrayList<String> productList = new ArrayList<String>(products.keySet());
- Collections.sort(productList, String.CASE_INSENSITIVE_ORDER);
- return productList;
+ return data.getConfigurationNamedItemsAsStringList(BugzillaAttribute.PRODUCT);
}
/**
@@ -115,12 +95,12 @@ public class RepositoryConfiguration implements Serializable {
* not exist.
*/
private List<String> getComponents(String product) {
- ProductEntry entry = products.get(product);
- if (entry != null) {
- return entry.getComponents();
- } else {
- return Collections.emptyList();
+ RepositoryConfigurationItem productData = data.getNamedItem(BugzillaAttribute.PRODUCT, product);
+ if (productData instanceof RepositoryConfigurationSubItem) {
+ RepositoryConfigurationSubItem productConfiguration = (RepositoryConfigurationSubItem) productData;
+ return productConfiguration.getConfigurationItemsAsStringList(BugzillaAttribute.COMPONENT);
}
+ return Collections.emptyList();
}
/**
@@ -128,39 +108,43 @@ public class RepositoryConfiguration implements Serializable {
* exist.
*/
private List<String> getVersions(String product) {
- ProductEntry entry = products.get(product);
- if (entry != null) {
- return entry.getVersions();
- } else {
- return Collections.emptyList();
+ RepositoryConfigurationItem productData = data.getNamedItem(BugzillaAttribute.PRODUCT, product);
+ if (productData instanceof RepositoryConfigurationSubItem) {
+ RepositoryConfigurationSubItem productConfiguration = (RepositoryConfigurationSubItem) productData;
+ return productConfiguration.getConfigurationItemsAsStringList(BugzillaAttribute.VERSION);
}
+ return Collections.emptyList();
}
/**
* Adds a component to the given product.
*/
private void addComponent(String product, String component) {
- if (!components.contains(component)) {
- components.add(component);
+ List<String> subData = data.getConfigurationItemsAsStringList(BugzillaAttribute.COMPONENT);
+ if (subData == null || !subData.contains(component)) {
+ data.addItem(BugzillaAttribute.COMPONENT, new RepositoryConfigurationItem(component));
}
- ProductEntry entry = products.get(product);
+ RepositoryConfigurationProductItem entry = (RepositoryConfigurationProductItem) data.getNamedItem(
+ BugzillaAttribute.PRODUCT, product);
if (entry == null) {
- entry = new ProductEntry(product);
- products.put(product, entry);
+ entry = new RepositoryConfigurationProductItem(product);
+ data.addNamedItem(BugzillaAttribute.PRODUCT, entry);
}
- entry.addComponent(component);
+ entry.addItem(BugzillaAttribute.COMPONENT, new RepositoryConfigurationItem(component));
}
private void addVersion(String product, String version) {
- if (!versions.contains(version)) {
- versions.add(version);
+ List<String> subData = data.getConfigurationItemsAsStringList(BugzillaAttribute.VERSION);
+ if (subData == null || !subData.contains(version)) {
+ data.addItem(BugzillaAttribute.VERSION, new RepositoryConfigurationItem(version));
}
- ProductEntry entry = products.get(product);
+ RepositoryConfigurationProductItem entry = (RepositoryConfigurationProductItem) data.getNamedItem(
+ BugzillaAttribute.PRODUCT, product);
if (entry == null) {
- entry = new ProductEntry(product);
- products.put(product, entry);
+ entry = new RepositoryConfigurationProductItem(product);
+ data.addNamedItem(BugzillaAttribute.PRODUCT, entry);
}
- entry.addVersion(version);
+ entry.addItem(BugzillaAttribute.VERSION, new RepositoryConfigurationItem(version));
}
public void setInstallVersion(String version) {
@@ -172,106 +156,38 @@ public class RepositoryConfiguration implements Serializable {
}
private void addTargetMilestone(String product, String target) {
- if (!milestones.contains(target)) {
- milestones.add(target);
+ List<String> subData = data.getConfigurationItemsAsStringList(BugzillaAttribute.TARGET_MILESTONE);
+ if (subData == null || !subData.contains(target)) {
+ data.addItem(BugzillaAttribute.TARGET_MILESTONE, new RepositoryConfigurationItem(target));
}
- ProductEntry entry = products.get(product);
+ RepositoryConfigurationProductItem entry = (RepositoryConfigurationProductItem) data.getNamedItem(
+ BugzillaAttribute.PRODUCT, product);
if (entry == null) {
- entry = new ProductEntry(product);
- products.put(product, entry);
+ entry = new RepositoryConfigurationProductItem(product);
+ data.addNamedItem(BugzillaAttribute.PRODUCT, entry);
}
-
- entry.addTargetMilestone(target);
-
+ entry.addItem(BugzillaAttribute.TARGET_MILESTONE, new RepositoryConfigurationItem(target));
}
private List<String> getTargetMilestones(String product) {
- ProductEntry entry = products.get(product);
- if (entry != null) {
- return entry.getTargetMilestones();
- } else {
- return Collections.emptyList();
+ RepositoryConfigurationItem productData = data.getNamedItem(BugzillaAttribute.PRODUCT, product);
+ if (productData instanceof RepositoryConfigurationSubItem) {
+ RepositoryConfigurationSubItem productConfiguration = (RepositoryConfigurationSubItem) productData;
+ return productConfiguration.getConfigurationItemsAsStringList(BugzillaAttribute.TARGET_MILESTONE);
}
+ return Collections.emptyList();
}
public void addUnconfirmedAllowed(String product, Boolean unconfirmedAllowed) {
- ProductEntry entry = products.get(product);
+ RepositoryConfigurationProductItem entry = (RepositoryConfigurationProductItem) data.getNamedItem(
+ BugzillaAttribute.PRODUCT, product);
if (entry == null) {
- entry = new ProductEntry(product);
- products.put(product, entry);
+ entry = new RepositoryConfigurationProductItem(product);
+ data.addNamedItem(BugzillaAttribute.PRODUCT, entry);
}
entry.setUnconfirmedAllowed(unconfirmedAllowed);
}
- /**
- * Container for product information: name, components.
- */
- private static class ProductEntry implements Serializable {
-
- private static final long serialVersionUID = 4120139521246741120L;
-
- @SuppressWarnings("unused")
- String productName;
-
- List<String> components = new ArrayList<String>();
-
- List<String> versions = new ArrayList<String>();
-
- List<String> milestones = new ArrayList<String>();
-
- String defaultMilestone = null;
-
- Boolean unconfirmedAllowed = false;
-
- ProductEntry(String name) {
- this.productName = name;
- }
-
- List<String> getComponents() {
- return components;
- }
-
- void addComponent(String componentName) {
- if (!components.contains(componentName)) {
- components.add(componentName);
- }
- }
-
- List<String> getVersions() {
- return versions;
- }
-
- void addVersion(String name) {
- if (!versions.contains(name)) {
- versions.add(name);
- }
- }
-
- List<String> getTargetMilestones() {
- return milestones;
- }
-
- void addTargetMilestone(String target) {
- milestones.add(target);
- }
-
- public String getDefaultMilestone() {
- return defaultMilestone;
- }
-
- 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() {
return openStatusValues;
}
@@ -338,28 +254,19 @@ public class RepositoryConfiguration implements Serializable {
public List<String> getOptionValues(BugzillaAttribute element) {
switch (element) {
- case PRODUCT:
- return getProducts();
case TARGET_MILESTONE:
- return milestones;
+ case RESOLUTION:
case BUG_STATUS:
- return bugStatus;
- case VERSION:
- return versions;
- case COMPONENT:
- return components;
+ case KEYWORDS:
case REP_PLATFORM:
- return platforms;
case OP_SYS:
- return operatingSystems;
- case PRIORITY:
- return priorities;
+ case VERSION:
+ case COMPONENT:
case BUG_SEVERITY:
- return severities;
- case KEYWORDS:
- return keywords;
- case RESOLUTION:
- return resolutionValues;
+ case PRIORITY:
+ return data.getConfigurationItemsAsStringList(element);
+ case PRODUCT:
+ return getProducts();
default:
return Collections.emptyList();
}
@@ -380,25 +287,14 @@ public class RepositoryConfiguration implements Serializable {
public void addItem2Configuration(BugzillaAttribute element, String value) {
switch (element) {
- case BUG_STATUS:
- bugStatus.add(value);
- break;
case RESOLUTION:
- resolutionValues.add(value);
- break;
+ case BUG_STATUS:
case KEYWORDS:
- keywords.add(value);
- break;
case REP_PLATFORM:
- platforms.add(value);
- case OP_SYS:
- operatingSystems.add(value);
- break;
case PRIORITY:
- priorities.add(value);
- break;
+ case OP_SYS:
case BUG_SEVERITY:
- severities.add(value);
+ data.addItem(element, new RepositoryConfigurationItem(value));
break;
case PRODUCT:
addProduct(value);
@@ -694,7 +590,13 @@ public class RepositoryConfiguration implements Serializable {
} else {
TaskAttribute everConfirmed = bugReport.getRoot().getAttribute(BugzillaAttribute.EVERCONFIRMED.getKey());
TaskAttribute product = bugReport.getRoot().getMappedAttribute(TaskAttribute.PRODUCT);
- Boolean unconfirmedAllowed = products.get(product.getValue()).getUnconfirmedAllowed();
+ Boolean unconfirmedAllowed = false;
+
+ RepositoryConfigurationProductItem entry = (RepositoryConfigurationProductItem) data.getNamedItem(
+ BugzillaAttribute.PRODUCT, product.getValue());
+ if (entry != null) {
+ unconfirmedAllowed = entry.getUnconfirmedAllowed();
+ }
switch (status) {
case START:
@@ -1195,19 +1097,20 @@ public class RepositoryConfiguration implements Serializable {
}
public String getDefaultMilestones(String product) {
- ProductEntry entry = products.get(product);
- if (entry != null) {
- return entry.getDefaultMilestone();
- } else {
- return null;
+ RepositoryConfigurationItem productData = data.getNamedItem(BugzillaAttribute.PRODUCT, product);
+ if (productData instanceof RepositoryConfigurationProductItem) {
+ RepositoryConfigurationProductItem productConfiguration = (RepositoryConfigurationProductItem) productData;
+ return productConfiguration.getDefaultMilestone();
}
+ return null;
}
public void setDefaultMilestone(String product, String defaultMilestone) {
- ProductEntry entry = products.get(product);
+ RepositoryConfigurationProductItem entry = (RepositoryConfigurationProductItem) data.getNamedItem(
+ BugzillaAttribute.PRODUCT, product);
if (entry == null) {
- entry = new ProductEntry(product);
- products.put(product, entry);
+ entry = new RepositoryConfigurationProductItem(product);
+ data.addNamedItem(BugzillaAttribute.PRODUCT, entry);
}
entry.setDefaultMilestone(defaultMilestone);
}
@@ -1221,11 +1124,11 @@ public class RepositoryConfiguration implements Serializable {
}
public Boolean getUnconfirmedAllowed(String product) {
- ProductEntry entry = products.get(product);
- if (entry != null) {
- return entry.getUnconfirmedAllowed();
- } else {
- return null;
+ RepositoryConfigurationItem productData = data.getNamedItem(BugzillaAttribute.PRODUCT, product);
+ if (productData instanceof RepositoryConfigurationProductItem) {
+ RepositoryConfigurationProductItem productConfiguration = (RepositoryConfigurationProductItem) productData;
+ return productConfiguration.getUnconfirmedAllowed();
}
+ return null;
}
}

Back to the top