\r
/** Extracts the ticket id from the ref name */\r
private long getTicketId(String refName) {\r
+ if (refName.indexOf('%') > -1) {\r
+ refName = refName.substring(0, refName.indexOf('%'));\r
+ }\r
if (refName.startsWith(Constants.R_FOR)) {\r
String ref = refName.substring(Constants.R_FOR.length());\r
- if (ref.indexOf('%') > -1) {\r
- ref = ref.substring(0, ref.indexOf('%'));\r
- }\r
try {\r
return Long.parseLong(ref);\r
} catch (Exception e) {\r
for (String item : items) {
list.add(prefix + item);
}
- setField(field, join(list, ","));
+ if (hasField(field)) {
+ String flat = getString(field);
+ if (isEmpty(flat)) {
+ // field is empty, use this list
+ setField(field, join(list, ","));
+ } else {
+ // merge this list into the existing field list
+ Set<String> set = new TreeSet<String>(Arrays.asList(flat.split(",")));
+ set.addAll(list);
+ setField(field, join(set, ","));
+ }
+ } else {
+ // does not have a list for this field
+ setField(field, join(list, ","));
+ }
}
public String getId() {