01: /**
02: * Miroslav Popov, Dec 8, 2005
03: * miroslav.popov@gmail.com
04: */package org.enhydra.jawe.base.transitionhandler;
05:
06: import java.util.List;
07: import java.util.Properties;
08:
09: import org.enhydra.jawe.AdditionalResourceManager;
10: import org.enhydra.jawe.JaWEComponent;
11: import org.enhydra.jawe.JaWEComponentSettings;
12: import org.enhydra.jawe.ResourceManager;
13:
14: /**
15: * @author Miroslav Popov
16: *
17: */
18: public class TransitionHandlerSettings extends JaWEComponentSettings {
19:
20: public void init(JaWEComponent comp) {
21: PROPERTYFILE_PATH = "org/enhydra/jawe/base/xpdlvalidator/properties/";
22: PROPERTYFILE_NAME = "transitionhandler.properties";
23: super .init(comp);
24: }
25:
26: public void loadDefault(JaWEComponent comp, Properties properties) {
27: // defaults
28: arm = new AdditionalResourceManager(properties);
29:
30: componentSettings.put(
31: "ACTIVITY_BLOCKCanHaveMoreOutgoingTranstion",
32: new Boolean(true));
33: componentSettings.put(
34: "ACTIVITY_BLOCKCanHaveMoreIncomingTranstion",
35: new Boolean(true));
36: componentSettings.put(
37: "ACTIVITY_NOCanHaveMoreOutgoingTranstion", new Boolean(
38: true));
39: componentSettings.put(
40: "ACTIVITY_NOCanHaveMoreIncomingTranstion", new Boolean(
41: true));
42: componentSettings.put(
43: "ACTIVITY_ROUTECanHaveMoreOutgoingTranstion",
44: new Boolean(true));
45: componentSettings.put(
46: "ACTIVITY_ROUTECanHaveMoreIncomingTranstion",
47: new Boolean(true));
48: componentSettings.put(
49: "ACTIVITY_SUBFLOWCanHaveMoreOutgoingTranstion",
50: new Boolean(true));
51: componentSettings.put(
52: "ACTIVITY_SUBFLOWCanHaveMoreIncomingTranstion",
53: new Boolean(true));
54: componentSettings.put(
55: "ACTIVITY_TOOLCanHaveMoreOutgoingTranstion",
56: new Boolean(true));
57: componentSettings.put(
58: "ACTIVITY_TOOLCanHaveMoreIncomingTranstion",
59: new Boolean(true));
60:
61: List out = ResourceManager.getResourceStrings(properties,
62: "Transitions.moreOutgoing.Activity.Type.", false);
63: for (int i = 0; i < out.size(); i++) {
64: componentSettings.put(out.get(i)
65: + "CanHaveMoreOutgoingTranstion", new Boolean(
66: ResourceManager.getResourceString(properties,
67: "Transitions.moreOutgoing.Activity.Type."
68: + out.get(i))));
69: }
70:
71: List in = ResourceManager.getResourceStrings(properties,
72: "Transitions.moreIncoming.Activity.Type.", false);
73: for (int i = 0; i < in.size(); i++) {
74: componentSettings.put(in.get(i)
75: + "CanHaveMoreIncomingTranstion", new Boolean(
76: ResourceManager.getResourceString(properties,
77: "Transitions.moreIncoming.Activity.Type."
78: + in.get(i))));
79: }
80: }
81:
82: public boolean canHaveMoreOutgoingTransition(String type) {
83: try {
84: return ((Boolean) componentSettings.get(type
85: + "CanHaveMoreOutgoingTranstion")).booleanValue();
86: } catch (Exception ex) {
87: return true;
88: }
89: }
90:
91: public boolean canHaveMoreIncomingTransition(String type) {
92: try {
93: return ((Boolean) componentSettings.get(type
94: + "CanHaveMoreIncomingTranstion")).booleanValue();
95: } catch (Exception ex) {
96: return true;
97: }
98: }
99: }
|