boolean foundMatch = false;
Iterator bindingOperationsIt = bindingOperations.iterator();
while (bindingOperationsIt.hasNext())
{
BindingOperation bindingOperation = (BindingOperation)bindingOperationsIt.next();
if (namesEqual(bindingOperation.getName(), operation.getName()))
{
foundMatch = true;
break;
}
}
if (!foundMatch)
{
newBindingOpsNeeded.add(operation);
}
}
// newBindingOpsNeeded is the List of Operations needing new corresponding
// BindingOperation's
List newBindingOps = createNewBindingOperations(newBindingOpsNeeded);
// don't add required namespace if nothing is really being added
if (!newBindingOps.isEmpty()) {
addRequiredNamespaces(binding);
}
// Generate the contents of the new BindingOperation's
Iterator newBindingOpsIt = newBindingOps.iterator();
while (newBindingOpsIt.hasNext())
{
BindingOperation newBindingOp = (BindingOperation)newBindingOpsIt.next();
generateBindingOperation(newBindingOp);
generateBindingOperationContent(newBindingOp);
}
}
generateBindingContent(binding);
}
else
{
// Overwrite
if (portType == null)
{
// We need to blow away everything under the Binding. No PortType associated with this Binding
bindingOperations.clear();
return binding;
}
else
{
addRequiredNamespaces(binding);
List operations = portType.getOperations();
/******************************************************
* Compare the Operations
******************************************************/
// Remove any BindingOperations which are no longer used
for (int index = 0; index < bindingOperations.size(); index++)
{
BindingOperation bindingOperation = (BindingOperation)bindingOperations.get(index);
boolean foundMatch = false;
Iterator operationsIt = operations.iterator();
while (operationsIt.hasNext())
{
Operation operation = (Operation)operationsIt.next();
if (namesEqual(bindingOperation.getName(), operation.getName()))
{
foundMatch = true;
break;
}
}
if (!foundMatch)
{
// We need to remove this BindingFault from the bindingFaults List
bindingOperations.remove(index);
index--;
}
}
// Remove any Operations which already exists in bindingOperations. What we
// have left are the Operations which needs newly created BindingOperations
List bindingOperationsNeeded = new ArrayList();
for (int index = 0; index < operations.size(); index++)
{
Operation operation = (Operation)operations.get(index);
boolean foundMatch = false;
Iterator bindingOperationsIt = bindingOperations.iterator();
while (bindingOperationsIt.hasNext())
{
BindingOperation bindingOperation = (BindingOperation)bindingOperationsIt.next();
if (namesEqual(bindingOperation.getName(), operation.getName()))
{
foundMatch = true;
break;
}
}