}
private static Subscription BuildClientSubscriptionSpecificItem(Map map, AtomicReference<String> outmsg, String locale) {
try {
Subscription sub = new Subscription();
String alertCritera = ((String[]) map.get("alertCriteraSingleItem"))[0];
List<String> keys = new ArrayList<String>();
String ItemKey = ((String[]) map.get("itemKey"))[0];
if (ItemKey == null) {
outmsg.set("no item defined");
return null;
}
//TODO this is an issue. Unknown if commas can be included within UDDI keys
if (ItemKey.contains(",")) {
String[] k2 = ItemKey.split(",");
for (int i = 0; i < k2.length; i++) {
if (k2[i] == null) {
continue;
}
if (k2[i].trim().isEmpty()) {
continue;
}
keys.add(k2[i].trim());
}
} else {
keys.add(ItemKey);
}
sub.setSubscriptionFilter(new SubscriptionFilter());
if (alertCritera != null) {
if (alertCritera.equalsIgnoreCase("binding")) {
sub.getSubscriptionFilter().setGetBindingDetail(new GetBindingDetail());
sub.getSubscriptionFilter().getGetBindingDetail().getBindingKey().addAll(keys);
} else if (alertCritera.equalsIgnoreCase("service")) {
sub.getSubscriptionFilter().setGetServiceDetail(new GetServiceDetail());
sub.getSubscriptionFilter().getGetServiceDetail().getServiceKey().addAll(keys);
} else if (alertCritera.equalsIgnoreCase("business")) {
sub.getSubscriptionFilter().setGetBusinessDetail(new GetBusinessDetail());
sub.getSubscriptionFilter().getGetBusinessDetail().getBusinessKey().addAll(keys);
} else if (alertCritera.equalsIgnoreCase("publisherAssertion")) {
//unknow if this will work
sub.getSubscriptionFilter().setGetAssertionStatusReport(new GetAssertionStatusReport());
sub.getSubscriptionFilter().getGetAssertionStatusReport().setCompletionStatus(CompletionStatus.valueOf(((String[]) map.get("assertionStatus"))[0]));
} else if (alertCritera.equalsIgnoreCase("relatedBusiness")) {
outmsg.set("relatedBusiness is not supported for single item subscriptions");
return null;
} else if (alertCritera.equalsIgnoreCase("tmodel")) {
sub.getSubscriptionFilter().setGetTModelDetail(new GetTModelDetail());
sub.getSubscriptionFilter().getGetTModelDetail().getTModelKey().addAll(keys);
} else {
outmsg.set("alert critera invalid");
return null;
}
} else {