public static void handle(Clerk fromClerk, Clerk toClerk, SubscriptionResultsList list) {
if (list.getServiceList()!=null) {
for (ServiceInfo serviceInfo : list.getServiceList().getServiceInfos().getServiceInfo() ) {
UDDIClerk uddiToClerk = new UDDIClerk(toClerk);
try {
BusinessEntity existingEntity = uddiToClerk.findBusiness(serviceInfo.getBusinessKey(), toClerk.getNode());
if (existingEntity!=null) {
log.info("Found business with key " + existingEntity.getBusinessKey() + ". No need to add it again");
} else {
log.info("Business was not found in the destination UDDI " + toClerk.getNode().getName()
+ ", going to add it in.");
new XRegistration(serviceInfo.getBusinessKey(), new UDDIClerk(fromClerk), new UDDIClerk(toClerk)).xRegisterBusiness();
}
new XRegistration(serviceInfo.getServiceKey(), new UDDIClerk(fromClerk), new UDDIClerk(toClerk)).xRegisterService();
} catch (Exception e) {
log.error(e.getMessage(),e);
}
}
}