KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > shark > WfDefaultRequester


1 package org.enhydra.shark;
2
3 import java.util.List JavaDoc;
4 import org.enhydra.shark.api.SharkTransaction;
5 import org.enhydra.shark.api.client.wfbase.BaseException;
6 import org.enhydra.shark.api.client.wfmodel.InvalidPerformer;
7 import org.enhydra.shark.api.client.wfmodel.WfEventAudit;
8 import org.enhydra.shark.api.client.wfmodel.WfRequester;
9 import org.enhydra.shark.api.internal.working.WfProcessInternal;
10 import org.enhydra.shark.api.internal.working.WfRequesterInternal;
11
12 /**
13  * WfRequesterImpl - Workflow Requester implementation
14  *
15  * @author Sasa Bojanic
16  */

17 public class WfDefaultRequester implements WfRequesterInternal {
18
19    private String JavaDoc resourceUsername;
20
21    private WfRequester externalRequester;
22
23    protected WfDefaultRequester (String JavaDoc resourceUsername,WfRequester extRequester) {
24       this.resourceUsername=resourceUsername;
25       this.externalRequester=extRequester;
26    }
27
28    public String JavaDoc getResourceRequesterUsername (SharkTransaction t) throws BaseException {
29       return resourceUsername;
30    }
31
32    public WfRequester getExternalRequester(SharkTransaction t) throws BaseException {
33       return externalRequester;
34    }
35
36    /**
37     * Receives notice of event status changes
38     */

39    public void receive_event (SharkTransaction t,WfEventAudit event,WfProcessInternal process) throws BaseException, InvalidPerformer {
40       //WfRequester external=SharkUtilities.getProcessRequester(process.key(t));
41
if (externalRequester!=null) {
42          try {
43             externalRequester.receive_event(t,event);
44          } catch (Throwable JavaDoc thr) {}
45       }
46    }
47
48    /**
49     * A list of processes
50     * @return List of WfProcessInternal objects.
51     */

52    private List JavaDoc getPerformerIds (SharkTransaction t) throws BaseException {
53       try {
54          return SharkEngineManager.getInstance().getInstancePersistenceManager().getResourceRequestersProcessIds(resourceUsername,t);
55       } catch (Exception JavaDoc ex) {
56          throw new BaseException(ex);
57       }
58    }
59
60    public String JavaDoc toString () {
61       return "Default requester - "+resourceUsername;
62    }
63
64 }
65
66
Popular Tags