001: /*
002: * JFolder, Copyright 2001-2006 Gary Steinmetz
003: *
004: * Distributable under LGPL license.
005: * See terms of license at gnu.org.
006: */
007:
008: package org.jfolder.workflow.model.instance;
009:
010: //base classes
011: import java.util.HashMap;
012: import org.w3c.dom.Document;
013:
014: //project specific classes
015: import org.jfolder.common.UnexpectedSystemException;
016: import org.jfolder.common.tagging.BaseConceptTagPreferences;
017: import org.jfolder.common.tagging.ConceptTag;
018: import org.jfolder.common.tagging.ConceptTagCallContext;
019: import org.jfolder.common.tagging.ConceptTagMenuBranch;
020: import org.jfolder.common.tagging.ConceptTagMenuContext;
021: import org.jfolder.common.tagging.ConceptTagPreferences;
022: import org.jfolder.common.tagging.ConceptTagPreferencesHelper;
023: import org.jfolder.common.tagging.ConceptTagSetContext;
024: import org.jfolder.common.tagging.ConceptTagSetHolder;
025: import org.jfolder.common.tagging.DetermineClassConceptTagContext;
026: import org.jfolder.common.tagging.DetermineValueAndClassConceptTagContext;
027: import org.jfolder.common.tagging.InitializeConceptTagContext;
028: import org.jfolder.common.tagging.RootConceptTagHolder;
029: import org.jfolder.config.instance.ConfigInstance;
030: import org.jfolder.services.config.ConfigService;
031: import org.jfolder.services.config.ConfigServiceCaller;
032: import org.jfolder.services.config.ConfigServiceCallerFactory;
033:
034: //other classes
035:
036: public class WorkflowInstanceTagPreferences extends
037: BaseConceptTagPreferences {
038:
039: //private final static String WIT_BASE_NAMESPACE =
040: // "http://www.jfolder.org/dtds/apps/workflow/instance/";
041: //
042: //private final static String WIT_NAMESPACE_V1 =
043: // WIT_BASE_NAMESPACE + "v1/";
044: //private final static String WIT_NAMESPACE_V1_BASE =
045: // WIT_NAMESPACE_V1 + "base.dtd";
046: //private final static String WIT_NAMESPACE_V1_CORE =
047: // WIT_NAMESPACE_V1 + "core.dtd";
048: //private final static String WIT_NAMESPACE_V1_RETURNABLE =
049: // WIT_NAMESPACE_V1 + "returnable.dtd";
050: //
051: //private final static String WIT_NAME_V1_TEXT = "text";
052: //private final static String WIT_NAME_V1_COMPOUND = "compound";
053: //
054: //private final static String WIT_ATTR_V1_CONSTRAINT = "constraint";
055: //
056: //private final static String WIT_HANDLE_CONJUCTION = "$";
057: //
058: //private final static String ROOT_CONSTRAINT = "root";
059: //
060: //private final static String UNCONSTRAINED_SYMBOL = "@";
061:
062: //
063: private ConceptTagSetHolder ctsh = null;
064: private ConceptTagMenuBranch ctmb = null;
065: private ConceptTagMenuContext ctmc = null;
066: //
067: private ConceptTagSetContext ctsc = null;
068: //
069: private boolean validateOnlyMode = false;
070:
071: //
072: private RootConceptTagHolder rcth = null;
073:
074: public WorkflowInstanceTagPreferences() {
075: //
076: this .ctsc = ConceptTagSetContext.newInstance();
077: this .ctmc = ConceptTagMenuContext.newInstance();
078: //
079: ConfigService cs = ConfigServiceCallerFactory
080: .getConfigService();
081: //ConfigLifecycle cm = ConfigLifecycleFactory.getConfigLifecycle();
082: this .ctsh = cs
083: .accessConceptTagSet(
084: ConceptTagPreferencesHelper.CTP_PREF_HANDLE__WORKFLOW_INSTANCE,
085: this .ctsc);
086: this .ctmb = this .ctsh.getMenuBranch();
087: //this.ctmq = cm.getConceptTagMenuQualifier(
088: // ConfigInstance.WORKFLOW_INSTANCE, this.ctsh);
089: //cm.close();
090: //
091: this .validateOnlyMode = false;
092: }
093:
094: //
095: public void initialize(ConceptTagCallContext inCtcc) {
096: throw UnexpectedSystemException.notImplemented();
097: }
098:
099: //
100: public void bubba() {
101: throw UnexpectedSystemException.unknownState();
102: }
103:
104: //
105: public void setRootHolder(RootConceptTagHolder inRcth) {
106: if (this .rcth != null) {
107: throw new UnexpectedSystemException("Already set");
108: } else {
109: this .rcth = inRcth;
110: }
111: }
112:
113: public RootConceptTagHolder getRootHolder() {
114: return this .rcth;
115: }
116:
117: //
118: public boolean isStaticUsed() {
119: return true;
120: }
121:
122: public String getStaticNamespace() {
123: return ConceptTagPreferencesHelper.CTP_PREF_NS__COMMON_COMPONENTS__V1;
124: }
125:
126: public String getStaticName() {
127: return ConceptTagPreferencesHelper.CTP_PREF_STATIC_LOCAL_NAME__COMMON;
128: }
129:
130: //
131: public boolean isCompoundUsed() {
132: return true;
133: }
134:
135: public String getCompoundNamespace() {
136: return ConceptTagPreferencesHelper.CTP_PREF_NS__COMMON_COMPONENTS__V1;
137: }
138:
139: public String getCompoundName() {
140: return ConceptTagPreferencesHelper.CTP_PREF_COMPOUND_LOCAL_NAME__COMMON;
141: }
142:
143: //
144: public boolean isNonTerminalCharacterDataStripped() {
145: return true;
146: }
147:
148: //
149: public boolean isConstraintUsed() {
150: return true;
151: }
152:
153: public String getConstraintNamespace() {
154: return ConceptTagPreferencesHelper.CTP_PREF_NS__COMMON_COMPONENTS__V1;
155: }
156:
157: public String getConstraintName() {
158: return ConceptTagPreferencesHelper.CTP_PREF_CONSTRAINT_LOCAL_NAME__COMMON;
159: }
160:
161: //
162: public boolean isStyleUsed() {
163: return false;
164: }
165:
166: public String getStyleNamespace() {
167: return null;
168: }
169:
170: public String getStyleName() {
171: return null;
172: }
173:
174: //
175: public boolean isUnconstrainedAllowed() {
176: return false;
177: }
178:
179: public String getUnconstrainedSymbol() {
180: return ConceptTagPreferencesHelper.CTP_PREF_UNCONSTRAINED_SYMBOL_COMMON;
181: }
182:
183: //
184: public String getRootConstraint() {
185: return ConceptTagPreferencesHelper.CTP_PREF_ROOT_CONSTRAINT__COMMON;
186: }
187:
188: public String getRootHandle() {
189: return (getRootConstraint() + getHandleConjunction() + "0");
190: }
191:
192: //
193: public String getHandleConjunction() {
194: return ConceptTagPreferencesHelper.CTP_PREF_HANDLE_CONJUNCTION__COMMON;
195: }
196:
197: //
198: public ConceptTagSetHolder getSetHolder() {
199:
200: ConceptTagSetHolder outValue = null;
201:
202: outValue = this .ctsh;
203:
204: return outValue;
205: }
206:
207: public ConceptTagMenuBranch getMenuBase() {
208:
209: ConceptTagMenuBranch outValue = null;
210:
211: outValue = this .ctmb;
212:
213: return outValue;
214: }
215:
216: //
217: public String getRootClassName() {
218: return ("org.jfolder.workflow.model."
219: + "instance.v1.RootWorkflowInstanceTag");
220: }
221:
222: //
223: public InitializeConceptTagContext getInitializeContext() {
224: throw UnexpectedSystemException.notImplemented();
225: }
226:
227: public DetermineClassConceptTagContext getReturnClassContext() {
228: throw UnexpectedSystemException.notImplemented();
229: }
230:
231: public DetermineValueAndClassConceptTagContext getDetermineValueAndClassContext() {
232: throw UnexpectedSystemException.notImplemented();
233: }
234:
235: //
236: public ConceptTag createUnknownConceptTag(String inNs, String inName) {
237:
238: throw new UnexpectedSystemException("Unknown Script Tag - "
239: + "Namespace = ('" + inNs + "'), Name = ('" + inName
240: + "')");
241: }
242:
243: public HashMap getDefaultNamespaceAssignments() {
244: return new HashMap();
245: }
246:
247: public String getAttributeConstraintName() {
248: return ConceptTagPreferencesHelper.CTP_PREF_ATTRIBUTE_LOCAL_NAME__COMMON;
249: }
250:
251: public String getStyleConstraintName() {
252: return ConceptTagPreferencesHelper.CTP_PREF_STYLE_LOCAL_NAME__COMMON;
253: }
254:
255: //
256: public void setValidateOnlyMode(boolean inMode) {
257: this .validateOnlyMode = inMode;
258: }
259:
260: public boolean isValidateOnlyMode() {
261: return this .validateOnlyMode;
262: }
263:
264: //
265: public boolean isAttributeAndStyleForbidden() {
266: return true;
267: }
268:
269: //public boolean isGeneralContentForbidden() {
270: // return true;
271: //}
272: //
273: public void correctForSpecialCharactersAndElements(Document inDoc) {
274: //no corrections needed
275: }
276:
277: //
278: public boolean isFileSystemPresent() {
279: return true;
280: }
281:
282: public String getPreferencesHandle() {
283: return ConceptTagPreferencesHelper.CTP_PREF_HANDLE__WORKFLOW_INSTANCE;
284: }
285: }
|