01: /*
02: * JFolder, Copyright 2001-2006 Gary Steinmetz
03: *
04: * Distributable under LGPL license.
05: * See terms of license at gnu.org.
06: */
07:
08: package org.jfolder.common.function.v1;
09:
10: //base classes
11: import java.util.HashMap;
12:
13: //project specific classes
14: import org.jfolder.common.SelfArgumentlessConstructor;
15: import org.jfolder.common.StandardDataTypes;
16: import org.jfolder.common.UnexpectedSystemException;
17: import org.jfolder.common.function.BaseCommonFunctionCompatibilityTag;
18: import org.jfolder.common.function.WebPageTagInstanceViewContext;
19: import org.jfolder.common.tagging.AppraiseConceptTagContext;
20: import org.jfolder.common.tagging.ConceptTagCharacteristic;
21: import org.jfolder.common.tagging.ConceptTagConstraint;
22: import org.jfolder.common.tagging.ConceptTagConstraintHolder;
23: import org.jfolder.common.tagging.ConceptTagConstraintOrTemplate;
24: import org.jfolder.common.tagging.ConceptTagFlagsHelper;
25: import org.jfolder.common.tagging.DetermineClassConceptTagContext;
26: import org.jfolder.common.tagging.DetermineValueAndClassConceptTagContext;
27: import org.jfolder.common.tagging.DynamicConceptTagConstraintContext;
28: import org.jfolder.common.tagging.DynamicConceptTagValidator;
29: import org.jfolder.common.tagging.InitializeConceptTagContext;
30: import org.jfolder.common.tagging.PostValidatorForConceptTagConstraint;
31: import org.jfolder.common.tagging.PreValidatorForConceptTagConstraint;
32: import org.jfolder.common.tagging.SelectionCriteriaForReturnableConceptTag;
33: import org.jfolder.common.tagging.StaticConceptTagConstraintContext;
34: import org.jfolder.common.tagging.StudioConceptTagInstanceInfoContext;
35: import org.jfolder.common.tagging.StudioConceptTagTypeInfoContext;
36: import org.jfolder.common.tagging.ValueAndClassForConceptTag;
37: import org.jfolder.common.utils.misc.CommonExpressions;
38: import org.jfolder.platforms.stores.base.ApplicationDataSourceResolver;
39: import org.jfolder.services.config.ApplicationStoreSet;
40: import org.jfolder.services.config.ConfigService;
41: import org.jfolder.services.config.ConfigServiceCallerFactory;
42:
43: //other classes
44:
45: public class PreConstraintValidatorForVarValueOnly implements
46: PreValidatorForConceptTagConstraint {
47: //
48: private ConceptTagConstraint nameCtcon = null;
49: private ConceptTagConstraint valueCtcon = null;
50:
51: //
52: private PreConstraintValidatorForVarValueOnly(
53: ConceptTagConstraint inNameCtcon,
54: ConceptTagConstraint inValueCtcon) {
55: //
56: this .nameCtcon = inNameCtcon;
57: this .valueCtcon = inValueCtcon;
58: }
59:
60: //
61: public final static PreConstraintValidatorForVarValueOnly newInstance(
62: ConceptTagConstraint inNameCtcon,
63: ConceptTagConstraint inValueCtcon) {
64: //
65: PreConstraintValidatorForVarValueOnly outValue = new PreConstraintValidatorForVarValueOnly(
66: inNameCtcon, inValueCtcon);
67:
68: return outValue;
69: }
70:
71: //
72: public void preValidate(InitializeConceptTagContext inIctc,
73: ConceptTagConstraint inCtcon) {
74: //
75: ConceptTagCharacteristic nameCtchar = this .nameCtcon
76: .getCharacteristic();
77: //
78: if (nameCtchar.getValueLength() > 0
79: && nameCtchar.isStatic(0, inIctc)) {
80: //
81: String varName = nameCtchar.getValueAsString(0, inIctc);
82: if (ConceptTagFlagsHelper.isLocalVariablePresent(inIctc,
83: varName)) {
84: ValueAndClassForConceptTag vacfct = ConceptTagFlagsHelper
85: .accessLocalVariable(inIctc, varName);
86: //
87: Class varClass = vacfct.getValueClass();
88: //
89: PostConstraintValidatorForVarNameAndType
90: .initializeValueCtcon(varClass, null, null,
91: this.valueCtcon);
92: }
93: }
94: }
95:
96: }
|