+ * Parses the contexts from the given fields.
+ *
+ * @param prefix
+ * The prefix to use to access the contexts
+ * @param fields
+ * The fields to parse the contexts from
+ * @return The parsed contexts
+ */
+ private Set<String> parseContexts(String prefix, SimpleFieldSet fields) {
+ Set<String> contexts = new HashSet<String>();
+ int contextCounter = -1;
+ while (true) {
+ String context = fields.get(prefix + "Context" + ++contextCounter);
+ if (context == null) {
+ break;
+ }
+ contexts.add(context);
+ }
+ return contexts;
+ }
+
+ /**
+ * Parses the properties from the given fields.
+ *
+ * @param prefix
+ * The prefix to use to access the properties
+ * @param fields
+ * The fields to parse the properties from
+ * @return The parsed properties
+ */
+ private Map<String, String> parseProperties(String prefix, SimpleFieldSet fields) {
+ Map<String, String> properties = new HashMap<String, String>();
+ int propertiesCounter = -1;
+ while (true) {
+ String propertyName = fields.get(prefix + "Property" + ++propertiesCounter + ".Name");
+ if (propertyName == null) {
+ break;
+ }
+ String propertyValue = fields.get(prefix + "Property" + propertiesCounter + ".Value");
+ properties.put(propertyName, propertyValue);
+ }
+ return properties;
+ }
+
+ /**