KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jbpm > bpel > service > def > PartnerLinkFinder


1 package org.jbpm.bpel.service.def;
2
3 import java.util.Iterator JavaDoc;
4
5 import org.jbpm.bpel.def.BpelDefinition;
6 import org.jbpm.bpel.def.BpelVisitorSupport;
7 import org.jbpm.bpel.def.Scope;
8
9 /**
10  * @author Alejandro Guízar
11  * @version $Revision: 1.1 $ $Date: 2005/05/18 01:54:54 $
12  */

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 JavaDoc 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