1 package org.jbpm.bpel.service.def; 2 3 import java.util.Iterator ; 4 5 import org.jbpm.bpel.def.BpelDefinition; 6 import org.jbpm.bpel.def.BpelVisitorSupport; 7 import org.jbpm.bpel.def.Scope; 8 9 13 class PartnerLinkFinder extends BpelVisitorSupport { 14 15 private final long partnerLinkId; 16 private PartnerLinkDefinition partnerLink; 17 18 PartnerLinkFinder(long id) { 19 partnerLinkId = id; 20 } 21 22 public PartnerLinkDefinition getPartnerLink() { 23 return partnerLink; 24 } 25 26 public void visit(BpelDefinition process) { 27 visit(process.getScope()); 28 } 29 30 public void visit(Scope scope) { 31 Iterator partnerLinkIt = scope.getPartnerLinks().iterator(); 32 while (partnerLinkIt.hasNext()) { 33 PartnerLinkDefinition aPartnerLink = (PartnerLinkDefinition) partnerLinkIt.next(); 34 if (aPartnerLink.getId() == partnerLinkId) { 35 partnerLink = aPartnerLink; 36 return; 37 } 38 } 39 propagate(scope); 40 } 41 } 42 | Popular Tags |