// add the port addresses to the portRefData
Map<QName,PortRefData> portsByQName = new HashMap<QName,PortRefData>();
List<PortRefData> ports = new ArrayList<PortRefData>(portRefs.size() + portAddresses.size());
for (PortRefData portRef : portRefs) {
PortRefData port = new PortRefData(portRef);
if (port.getQName() != null) {
portsByQName.put(port.getQName(), port);
}
ports.add(port);
}
// add PortRefData for any portAddress not added above
for (PortAddress portAddress : portAddresses) {
PortRefData port = portsByQName.get(portAddress.getPortQName());
if (port == null) {
port = new PortRefData();
port.setQName(portAddress.getPortQName());
port.setServiceEndpointInterface(portAddress.getServiceEndpointInterface());
port.getAddresses().add(portAddress.getAddress());
ports.add(port);
} else {
port.getAddresses().add(portAddress.getAddress());
if (port.getServiceEndpointInterface() == null) {
port.setServiceEndpointInterface(portAddress.getServiceEndpointInterface());
}
}
}
ProviderWrapper.beforeCreate(ports);