KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > shark > swingclient > workflowadmin > instantiation > actions > DisableDefinition


1 package org.enhydra.shark.swingclient.workflowadmin.instantiation.actions;
2
3 import java.awt.event.*;
4
5
6 import org.enhydra.shark.api.client.wfmodel.*;
7
8 import org.enhydra.shark.api.client.wfservice.*;
9 import org.enhydra.shark.swingclient.*;
10 import org.enhydra.shark.swingclient.workflowadmin.*;
11 import org.enhydra.shark.swingclient.workflowadmin.instantiation.*;
12 import org.enhydra.jawe.xml.elements.Package;
13
14 /**
15  * Changes the state of the process manager (or all process managers for
16  * some package) to disabled.
17  *
18  * @author Sasa Bojanic
19  * @version 1.0
20  */

21 public class DisableDefinition extends ActionBase {
22
23    public DisableDefinition (ProcessInstantiationManagement pim) {
24       super(pim);
25    }
26
27    public void actionPerformed(ActionEvent e) {
28       ProcessInstantiationManagement pim=(ProcessInstantiationManagement)actionPanel;
29
30       Object JavaDoc userObject=pim.getSelectedUserObject();
31       if (userObject instanceof Package JavaDoc) {
32          Package JavaDoc pkg=(Package JavaDoc)userObject;
33          try {
34             WfProcessMgrIterator wpmgi=SharkClient.getCommonExpressionBuilder().getEnabledOrDisabledManagersForPackage(pkg.get("Id").toString(),true);
35             WfProcessMgr[] mgrs=wpmgi.get_next_n_sequence(0);
36             if (mgrs!=null) {
37                for (int i=0; i<mgrs.length; i++) {
38                   try {
39                      mgrs[i].set_process_mgr_state(process_mgr_stateType.disabled);
40                   } catch (TransitionNotAllowed tna){
41                   } catch (Exception JavaDoc ex){}
42                }
43             }
44          } catch (Exception JavaDoc ex) {}
45       } else if (userObject instanceof WfProcessMgr) {
46          try {
47             ((WfProcessMgr)userObject).set_process_mgr_state(process_mgr_stateType.disabled);
48             pim.getTreeSelectionListener().valueChanged(null);
49          } catch (TransitionNotAllowed tna){
50          } catch (Exception JavaDoc ex){}
51       }
52    }
53 }
54
Popular Tags