UddiEntityPublisher rootPublisher, String rootPartition, Configuration config)
throws DispositionReportFaultMessage {
// A supplied businessService can't be null
if (businessService == null)
throw new ValueNotAllowedException(new ErrorMessage("errors.businessservice.NullInput"));
// A business key doesn't have to be provided, but if it is, it should match the parent business's key
String parentKey = businessService.getBusinessKey();
if (parentKey != null && parentKey.length()> 0) {
if (!parentKey.equalsIgnoreCase(parent.getBusinessKey()))
throw new InvalidKeyPassedException(new ErrorMessage("errors.invalidkey.ParentBusinessNotFound", parentKey));
}
// Retrieve the service's passed key
String entityKey = businessService.getServiceKey();
if (entityKey == null || entityKey.length() == 0) {
entityKey = rootPartition + KeyGenerator.PARTITION_SEPARATOR + UUID.randomUUID();
businessService.setServiceKey(entityKey);
}
else {
// Per section 4.4: keys must be case-folded
entityKey = entityKey.toLowerCase();
businessService.setServiceKey(entityKey);
ValidateUDDIKey.validateUDDIv3Key(entityKey);
String keyPartition = entityKey.substring(0, entityKey.lastIndexOf(KeyGenerator.PARTITION_SEPARATOR));
if (!rootPartition.equalsIgnoreCase(keyPartition))
throw new KeyUnavailableException(new ErrorMessage("errors.keyunavailable.BadPartition", entityKey));
}
ValidatePublish validatePublish = new ValidatePublish(rootPublisher);
validatePublish.validateNames(businessService.getName());
validatePublish.validateCategoryBag(businessService.getCategoryBag(), config);
org.uddi.api_v3.BindingTemplates bindingTemplates = businessService.getBindingTemplates();
if (bindingTemplates != null) {
List<org.uddi.api_v3.BindingTemplate> bindingTemplateList = bindingTemplates.getBindingTemplate();
if (bindingTemplateList == null || bindingTemplateList.size() == 0)
throw new ValueNotAllowedException(new ErrorMessage("errors.bindingtemplates.NoInput"));
for (org.uddi.api_v3.BindingTemplate bindingTemplate : bindingTemplateList) {
validateRootBindingTemplate(bindingTemplate, businessService, rootPublisher, rootPartition, config);
}
}