KickJava   Java API By Example, From Geeks To Geeks.

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


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

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