/** * This method returns the service with the specified business key and service key. If it does not * exist in the list, then null is returned. * * @param oEntities The list of businesses to search. * @param sBusinessKey The business key for the business entity. * @param sServiceKey The service key to look for. * @return The item from the list that matches the business key. */ private CMBusinessService findSpecificService( List<CMBusinessEntity> oaEntities, String sBusinessKey, String sServiceKey) { CMBusinessService oService = null; CMBusinessEntity oEntity = findSpecificBusiness(oaEntities, sBusinessKey); if ((oEntity != null) && (oEntity.getBusinessServices() != null) && (oEntity.getBusinessServices().getBusinessService() != null) && (oEntity.getBusinessServices().getBusinessService().size() > 0)) { for (CMBusinessService oTempService : oEntity.getBusinessServices().getBusinessService()) { if ((oTempService.getServiceKey() != null) && (oTempService.getServiceKey().equals(sServiceKey))) { oService = oTempService; break; // We found it - get out of the loop... } } } return oService; }
/** * This method retrieves the service information from the UDDI server for each of the business * entities. * * @param oEntities The business entities for which services should be retrieved. The information * is placed in the appropriate location in this object. * @throws UDDIAccessorException */ private void retrieveDetailedServiceInfoFromUDDI(CMBusinessEntities oEntities) throws UDDIAccessorException { if ((oEntities == null) || (oEntities.getBusinessEntity() == null) || (oEntities.getBusinessEntity().size() <= 0)) { return; // we are done there is nothing to retrieve. } ServiceDetail oResult = null; try { GetServiceDetail oSearchParams = new GetServiceDetail(); // Load up the list of service keys to retrieve the details of... // -------------------------------------------------------- for (CMBusinessEntity oEntity : oEntities.getBusinessEntity()) { if ((oEntity.getBusinessServices() != null) && (oEntity.getBusinessServices().getBusinessService() != null) && (oEntity.getBusinessServices().getBusinessService().size() > 0)) { for (CMBusinessService oService : oEntity.getBusinessServices().getBusinessService()) { if ((oService.getServiceKey() != null) && (oService.getServiceKey().length() > 0)) { oSearchParams.getServiceKey().add(oService.getServiceKey()); } } // for (CMBusinessService oService : oEntity.getBusinessServices().getBusinessService()) } // if ((oEntity.getBusinessServices() != null) && ... } // for (CMBusinessEntity oEntity : oEntities.getBusinessEntity()) UDDIInquiryPortType oPort = getUDDIInquiryWebService(); oResult = oPort.getServiceDetail(oSearchParams); } catch (Exception e) { String sErrorMessage = "Failed to call UDDI web service get_serviceDetail method. Error: " + e.getMessage(); log.error(sErrorMessage, e); throw new UDDIAccessorException(sErrorMessage, e); } // Now let's process the results... // --------------------------------- if ((oResult != null) && (oResult.getBusinessService() != null) && (oResult.getBusinessService().size() > 0)) { // Now put the returned information back into our structure. // ----------------------------------------------------------- for (BusinessService oUDDIService : oResult.getBusinessService()) { if ((oUDDIService.getServiceKey() != null) && (oUDDIService.getServiceKey().length() > 0) && (oUDDIService.getBusinessKey() != null) && (oUDDIService.getBusinessKey().length() > 0)) { CMBusinessService oService = findSpecificService( oEntities.getBusinessEntity(), oUDDIService.getBusinessKey(), oUDDIService.getServiceKey()); if (oService != null) { // Binding Service Name // ---------------------- if ((oUDDIService.getName() != null) && (oUDDIService.getName().size() > 0)) { CMBindingNames oNames = new CMBindingNames(); oService.setNames(oNames); for (Name oUDDIName : oUDDIService.getName()) { if ((oUDDIName.getValue() != null) && (oUDDIName.getValue().length() > 0)) { oService.getNames().getName().add(oUDDIName.getValue()); } } } // if ((oUDDIService.getName() != null) && // Binding Descriptions // --------------------- if ((oUDDIService.getDescription() != null) && (oUDDIService.getDescription().size() > 0)) { CMBindingDescriptions oDescripts = new CMBindingDescriptions(); oService.setDescriptions(oDescripts); for (Description oUDDIDescript : oUDDIService.getDescription()) { if ((oUDDIDescript.getValue() != null) && (oUDDIDescript.getValue().length() > 0)) { oService.getDescriptions().getDescription().add(oUDDIDescript.getValue()); } } } // if ((oUDDIService.getDescription() != null) && ... // Binding Template Information // ----------------------------- if ((oUDDIService.getBindingTemplates() != null) && (oUDDIService.getBindingTemplates().getBindingTemplate() != null) && (oUDDIService.getBindingTemplates().getBindingTemplate().size() > 0)) { CMBindingTemplates oTemplates = new CMBindingTemplates(); for (BindingTemplate oUDDITemplate : oUDDIService.getBindingTemplates().getBindingTemplate()) { CMBindingTemplate oTemplate = new CMBindingTemplate(); boolean bHaveData = false; // Endpoint URL // -------------- if ((oUDDITemplate.getAccessPoint() != null) && (oUDDITemplate.getAccessPoint().getValue() != null) && (oUDDITemplate.getAccessPoint().getValue().length() > 0)) { oTemplate.setEndpointURL(oUDDITemplate.getAccessPoint().getValue()); bHaveData = true; } // Service Version // --------------- if ((oUDDITemplate.getCategoryBag() != null) && (oUDDITemplate.getCategoryBag().getKeyedReference() != null) && (oUDDITemplate.getCategoryBag().getKeyedReference().size() > 0)) { List<String> oServiceVersions = findAndGetValueFromKeyedReference( oUDDITemplate.getCategoryBag().getKeyedReference(), SERVICE_VERSION_KEY); if (oServiceVersions != null && oServiceVersions.size() == 1) { for (String sValue : oServiceVersions) { if ((sValue != null) && (sValue.length() > 0)) { oTemplate.setServiceVersion(sValue); bHaveData = true; } } } else { log.debug( "A single Service Version is NOT detected for UDDI Service " + oUDDIService.getBusinessKey() + " - " + oUDDIService.getServiceKey()); } } if (bHaveData) { oTemplates.getBindingTemplate().add(oTemplate); } } if ((oTemplates.getBindingTemplate() != null) && (oTemplates.getBindingTemplate().size() > 0)) { oService.setBindingTemplates(oTemplates); } } // Uniform Service Name // // Multiple Uniform Service Names will result in the // creation of oService copies so this should be the last // population to be performed. // ---------------------------------------- populateUniformServiceNameAndReplicateService(oUDDIService, oEntities, oService); } // if (oService != null) } // if ((oUDDIService.getServiceKey() != null) && ... } // for (BusinessService oUDDIService : oResult.getBusinessService()) } // if ((oResult != null) && }