001: /**
002: * Miroslav Popov, Dec 13, 2005 miroslav.popov@gmail.com
003: */package org.enhydra.jawe.base.xpdlvalidator;
004:
005: import java.util.Properties;
006:
007: import org.enhydra.jawe.AdditionalResourceManager;
008: import org.enhydra.jawe.JaWEComponent;
009: import org.enhydra.jawe.JaWEComponentSettings;
010: import org.enhydra.shark.xpdl.StandardPackageValidator;
011:
012: /**
013: * @author Miroslav Popov
014: */
015: public class XPDLValidatorSettings extends JaWEComponentSettings {
016:
017: public void init(JaWEComponent comp) {
018: PROPERTYFILE_PATH = "org/enhydra/jawe/base/xpdlvalidator/properties/";
019: PROPERTYFILE_NAME = "xpdlvalidator.properties";
020: super .init(comp);
021: }
022:
023: public void loadDefault(JaWEComponent comp, Properties properties) {
024: // defaults
025: arm = new AdditionalResourceManager(properties);
026:
027: componentSettings
028: .put(
029: StandardPackageValidator.VALIDATE_SUBFLOW_REFERENCES,
030: new Boolean(
031: properties
032: .getProperty(
033: StandardPackageValidator.VALIDATE_SUBFLOW_REFERENCES,
034: "true").equals("true")));
035: componentSettings
036: .put(
037: StandardPackageValidator.VALIDATE_PERFORMER_EXPRESSIONS,
038: new Boolean(
039: properties
040: .getProperty(
041: StandardPackageValidator.VALIDATE_PERFORMER_EXPRESSIONS,
042: "true").equals("true")));
043: componentSettings
044: .put(
045: StandardPackageValidator.VALIDATE_ACTUAL_PARAMETER_EXPRESSIONS,
046: new Boolean(
047: properties
048: .getProperty(
049: StandardPackageValidator.VALIDATE_ACTUAL_PARAMETER_EXPRESSIONS,
050: "true").equals("true")));
051: componentSettings
052: .put(
053: StandardPackageValidator.VALIDATE_CONDITION_EXPRESSIONS,
054: new Boolean(
055: properties
056: .getProperty(
057: StandardPackageValidator.VALIDATE_CONDITION_EXPRESSIONS,
058: "true").equals("true")));
059: componentSettings
060: .put(
061: StandardPackageValidator.VALIDATE_CONDITION_BY_TYPE,
062: new Boolean(
063: properties
064: .getProperty(
065: StandardPackageValidator.VALIDATE_CONDITION_BY_TYPE,
066: "true").equals("true")));
067: componentSettings
068: .put(
069: StandardPackageValidator.VALIDATE_DEADLINE_EXPRESSIONS,
070: new Boolean(
071: properties
072: .getProperty(
073: StandardPackageValidator.VALIDATE_DEADLINE_EXPRESSIONS,
074: "true").equals("true")));
075: componentSettings
076: .put(
077: StandardPackageValidator.VALIDATE_UNUSED_VARIABLES,
078: new Boolean(
079: properties
080: .getProperty(
081: StandardPackageValidator.VALIDATE_UNUSED_VARIABLES,
082: "true").equals("true")));
083: componentSettings.put(
084: StandardPackageValidator.ALLOW_UNDEFINED_START,
085: new Boolean(properties.getProperty(
086: StandardPackageValidator.ALLOW_UNDEFINED_START,
087: "true").equals("true")));
088: componentSettings.put(
089: StandardPackageValidator.ALLOW_UNDEFINED_END,
090: new Boolean(properties.getProperty(
091: StandardPackageValidator.ALLOW_UNDEFINED_END,
092: "true").equals("true")));
093:
094: }
095:
096: public boolean shouldValidateSubflowReferences() {
097: return ((Boolean) componentSettings
098: .get(StandardPackageValidator.VALIDATE_SUBFLOW_REFERENCES))
099: .booleanValue();
100: }
101:
102: public boolean shouldValidatePeformerExpressions() {
103: return ((Boolean) componentSettings
104: .get(StandardPackageValidator.VALIDATE_PERFORMER_EXPRESSIONS))
105: .booleanValue();
106: }
107:
108: public boolean shouldValidateActualParameterExpressions() {
109: return ((Boolean) componentSettings
110: .get(StandardPackageValidator.VALIDATE_ACTUAL_PARAMETER_EXPRESSIONS))
111: .booleanValue();
112: }
113:
114: public boolean shouldValidateDeadlineExpressions() {
115: return ((Boolean) componentSettings
116: .get(StandardPackageValidator.VALIDATE_DEADLINE_EXPRESSIONS))
117: .booleanValue();
118: }
119:
120: public boolean shouldValidateConditionExpressions() {
121: return ((Boolean) componentSettings
122: .get(StandardPackageValidator.VALIDATE_CONDITION_EXPRESSIONS))
123: .booleanValue();
124: }
125:
126: public boolean shouldValidateUnusedVariables() {
127: return ((Boolean) componentSettings
128: .get(StandardPackageValidator.VALIDATE_UNUSED_VARIABLES))
129: .booleanValue();
130: }
131:
132: public boolean shouldValidateConditionByType() {
133: return ((Boolean) componentSettings
134: .get(StandardPackageValidator.VALIDATE_CONDITION_BY_TYPE))
135: .booleanValue();
136: }
137:
138: public boolean shouldAllowUndefinedStart() {
139: return ((Boolean) componentSettings
140: .get(StandardPackageValidator.ALLOW_UNDEFINED_START))
141: .booleanValue();
142: }
143:
144: public boolean shouldAllowUndefinedEnd() {
145: return ((Boolean) componentSettings
146: .get(StandardPackageValidator.ALLOW_UNDEFINED_END))
147: .booleanValue();
148: }
149:
150: public Properties getProperties() {
151: Properties props = new Properties();
152: props
153: .put(
154: StandardPackageValidator.VALIDATE_SUBFLOW_REFERENCES,
155: componentSettings
156: .get(
157: StandardPackageValidator.VALIDATE_SUBFLOW_REFERENCES)
158: .toString());
159: props
160: .put(
161: StandardPackageValidator.VALIDATE_PERFORMER_EXPRESSIONS,
162: componentSettings
163: .get(
164: StandardPackageValidator.VALIDATE_PERFORMER_EXPRESSIONS)
165: .toString());
166: props
167: .put(
168: StandardPackageValidator.VALIDATE_ACTUAL_PARAMETER_EXPRESSIONS,
169: componentSettings
170: .get(
171: StandardPackageValidator.VALIDATE_ACTUAL_PARAMETER_EXPRESSIONS)
172: .toString());
173: props
174: .put(
175: StandardPackageValidator.VALIDATE_DEADLINE_EXPRESSIONS,
176: componentSettings
177: .get(
178: StandardPackageValidator.VALIDATE_DEADLINE_EXPRESSIONS)
179: .toString());
180: props
181: .put(
182: StandardPackageValidator.VALIDATE_UNUSED_VARIABLES,
183: componentSettings
184: .get(
185: StandardPackageValidator.VALIDATE_UNUSED_VARIABLES)
186: .toString());
187: props
188: .put(
189: StandardPackageValidator.VALIDATE_CONDITION_EXPRESSIONS,
190: componentSettings
191: .get(
192: StandardPackageValidator.VALIDATE_CONDITION_EXPRESSIONS)
193: .toString());
194: props
195: .put(
196: StandardPackageValidator.VALIDATE_CONDITION_BY_TYPE,
197: componentSettings
198: .get(
199: StandardPackageValidator.VALIDATE_CONDITION_BY_TYPE)
200: .toString());
201: props.put(StandardPackageValidator.ALLOW_UNDEFINED_START,
202: componentSettings.get(
203: StandardPackageValidator.ALLOW_UNDEFINED_START)
204: .toString());
205: props.put(StandardPackageValidator.ALLOW_UNDEFINED_END,
206: componentSettings.get(
207: StandardPackageValidator.ALLOW_UNDEFINED_END)
208: .toString());
209: return props;
210: }
211:
212: }
|