01: package util;
02:
03: import javax.security.auth.login.LoginContext;
04: import hero.client.test.SimpleCallbackHandler;
05:
06: import hero.interfaces.*;
07:
08: import java.util.*;
09:
10: public class Delete_model {
11:
12: static public void main(String[] args) throws Exception {
13:
14: try {
15: char[] password = { 'b', 's', 'o', 'a' };
16: SimpleCallbackHandler handler = new SimpleCallbackHandler(
17: "bsoa", password);
18: LoginContext lc = new LoginContext("TestClient", handler);
19: lc.login();
20:
21: UserSessionHome userSessionh = UserSessionUtil.getHome();
22: UserSession us = userSessionh.create();
23:
24: Collection instances = us
25: .getProjectInstancesNames("Approval_workflow");
26:
27: Iterator i = instances.iterator();
28: while (i.hasNext()) {
29: String instName = (String) i.next();
30: us.removeProject(instName);
31: }
32:
33: ProjectSessionHome projectSessionh = ProjectSessionUtil
34: .getHome();
35: ProjectSession ps = projectSessionh.create();
36: if (ps.existingProject("Approval_workflow"))
37: us.removeProject("Approval_workflow");
38: } catch (Exception e) {
39: throw new Exception("An error was produced during the "
40: + args[0] + " model delete: " + e.getMessage());
41: }
42: }
43: }
|