From 7a1fb15ee8302de48aa989085d2211593ba22406 Mon Sep 17 00:00:00 2001 From: bdaniel Date: Fri, 17 Jun 2011 21:27:59 +0000 Subject: Correctly remove policies from endpoints and endpoint references when there are multiple endpoints git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1137040 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/builder/impl/PolicyAppliesToBuilderImpl.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'sca-java-2.x/trunk/modules/builder/src/main/java/org') diff --git a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/PolicyAppliesToBuilderImpl.java b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/PolicyAppliesToBuilderImpl.java index c4dd9b4182..64fcc2bc77 100644 --- a/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/PolicyAppliesToBuilderImpl.java +++ b/sca-java-2.x/trunk/modules/builder/src/main/java/org/apache/tuscany/sca/builder/impl/PolicyAppliesToBuilderImpl.java @@ -101,23 +101,23 @@ public class PolicyAppliesToBuilderImpl extends PolicyAttachmentBuilderImpl { for (Component component : topComposite.getComponents()) { for (ComponentService componentService : component.getServices()) { - for (Endpoint ep : componentService.getEndpoints()) { - List policySetsToRemove = checkAppliesToSubject(document, appliesToSubjects, topComposite, (PolicySubject)ep.getService(), ep.getService().getPolicySets()); + List policySetsToRemove = checkAppliesToSubject(document, appliesToSubjects, topComposite, componentService, componentService.getPolicySets()); + for (Endpoint ep : componentService.getEndpoints()) { ep.getPolicySets().removeAll(policySetsToRemove); if (ep.getBinding() instanceof PolicySubject) { - policySetsToRemove = checkAppliesToSubject(document, appliesToSubjects, topComposite, (PolicySubject)ep.getBinding(), ((PolicySubject)ep.getBinding()).getPolicySets()); - ep.getPolicySets().removeAll(policySetsToRemove); + List bindingPolicySetsToRemove = checkAppliesToSubject(document, appliesToSubjects, topComposite, (PolicySubject)ep.getBinding(), ((PolicySubject)ep.getBinding()).getPolicySets()); + ep.getPolicySets().removeAll(bindingPolicySetsToRemove); } } } for (ComponentReference componentReference : component.getReferences()) { - for (EndpointReference epr : componentReference.getEndpointReferences()) { - List policySetsToRemove = checkAppliesToSubject(document, appliesToSubjects, topComposite, (PolicySubject)epr.getReference(), epr.getReference().getPolicySets()); + List policySetsToRemove = checkAppliesToSubject(document, appliesToSubjects, topComposite, componentReference, componentReference.getPolicySets()); + for (EndpointReference epr : componentReference.getEndpointReferences()) { epr.getPolicySets().removeAll(policySetsToRemove); if (epr.getBinding() instanceof PolicySubject) { - policySetsToRemove = checkAppliesToSubject(document, appliesToSubjects, topComposite, (PolicySubject)epr.getBinding(), ((PolicySubject)epr.getBinding()).getPolicySets()); - epr.getPolicySets().removeAll(policySetsToRemove); + List bindingPolicySetsToRemove = checkAppliesToSubject(document, appliesToSubjects, topComposite, (PolicySubject)epr.getBinding(), ((PolicySubject)epr.getBinding()).getPolicySets()); + epr.getPolicySets().removeAll(bindingPolicySetsToRemove); } } } -- cgit v1.2.3