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.common.web.template;
009:
010: //base classes
011:
012: //project specific classes
013: import org.jfolder.common.UnexpectedSystemException;
014:
015: //other classes
016:
017: public abstract class BaseParameterContext implements
018: ConsoleParameterContext {
019:
020: //
021: protected final static String CONSOLE_PARAMETER_PREFIX = "CONSOLE_PARAMETER_";
022: //
023: //protected final static String FIRST_PARAMETER =
024: // "CONSOLE_FIRST_PARAMETER";
025: //protected final static String SECOND_PARAMETER =
026: // "CONSOLE_SECOND_PARAMETER";
027: //protected final static String THIRD_PARAMETER =
028: // "CONSOLE_THIRD_PARAMETER";
029: //protected final static String FOURTH_PARAMETER =
030: // "CONSOLE_FOURTH_PARAMETER";
031: //protected final static String FIFTH_PARAMETER =
032: // "CONSOLE_FIFTH_PARAMETER";
033: //protected final static String SIXTH_PARAMETER =
034: // "CONSOLE_SIXTH_PARAMETER";
035: //protected final static String SEVENTH_PARAMETER =
036: // "CONSOLE_SEVENTH_PARAMETER";
037: //protected final static String EIGHTH_PARAMETER =
038: // "CONSOLE_EIGHTH_PARAMETER";
039: //protected final static String NINTH_PARAMETER =
040: // "CONSOLE_NINTH_PARAMETER";
041: //protected final static String TENTH_PARAMETER =
042: // "CONSOLE_TENTH_PARAMETER";
043: //
044: //private String consoleFirstParameter = null;
045: //private String consoleSecondParameter = null;
046: //private String consoleThirdParameter = null;
047: //private String consoleFourthParameter = null;
048: //private String consoleFifthParameter = null;
049: //private String consoleSixthParameter = null;
050: //private String consoleSeventhParameter = null;
051: //private String consoleEighthParameter = null;
052: //private String consoleNinthParameter = null;
053: //private String consoleTenthParameter = null;
054: //
055: private ConsoleParameterHolder parameterCph = null;
056:
057: //
058: protected BaseParameterContext() {
059: this .parameterCph = ConsoleParameterHolder.newInstance();
060: }
061:
062: public int hashCode() {
063:
064: int outValue = 0;
065:
066: outValue += this .parameterCph.hashCode();
067:
068: return outValue;
069: }
070:
071: public boolean equals(Object inObj) {
072:
073: boolean outValue = true;
074:
075: if (inObj instanceof BaseParameterContext) {
076: BaseParameterContext nextBpc = ((BaseParameterContext) inObj);
077: outValue &= (this .parameterCph.equals(nextBpc.parameterCph));
078: } else {
079: outValue &= false;
080: }
081:
082: return outValue;
083: }
084:
085: public boolean isValid() {
086: return (
087: //
088: getParameterCount() == ConsoleParameterContext.MAX_CREATION_PARAMS);
089: //this.consoleFirstParameter != null
090: //&& this.consoleSecondParameter != null
091: //&& this.consoleThirdParameter != null
092: //&& this.consoleFourthParameter != null
093: //&& this.consoleFifthParameter != null
094: //&& this.consoleSixthParameter != null
095: //&& this.consoleSeventhParameter != null
096: //&& this.consoleEighthParameter != null
097: //&& this.consoleNinthParameter != null
098: //&& this.consoleTenthParameter != null);
099: }
100:
101: protected final static String formatParameter(String inParameter) {
102:
103: String outValue = inParameter;
104:
105: if (inParameter == null) {
106: outValue = "''";
107: }
108:
109: return outValue;
110: }
111:
112: //
113: public int getParameterCount() {
114: return this .parameterCph.getIndexCount();
115: }
116:
117: public String getParameter(Integer inIndex) {
118:
119: String outValue = null;
120:
121: Object o = this .parameterCph.getInput(inIndex);
122: outValue = (String) o;
123:
124: return outValue;
125: }
126:
127: public final void addParameter(Integer inIndex, String inValue) {
128: this .parameterCph.addInput(inIndex, inValue);
129: }
130:
131: //public final String getFirstParameter() {
132: // return this.consoleFirstParameter;
133: //}
134: //
135: //public final String getSecondParameter() {
136: // return this.consoleSecondParameter;
137: //}
138: //
139: //public final String getThirdParameter() {
140: // return this.consoleThirdParameter;
141: //}
142: //
143: //public final String getFourthParameter() {
144: // return this.consoleFourthParameter;
145: //}
146: //
147: //public final String getFifthParameter() {
148: // return this.consoleFifthParameter;
149: //}
150: //
151: //public final String getSixthParameter() {
152: // return this.consoleSixthParameter;
153: //}
154: //
155: //public final String getSeventhParameter() {
156: // return this.consoleSeventhParameter;
157: //}
158: //
159: //public final String getEighthParameter() {
160: // return this.consoleEighthParameter;
161: //}
162: //
163: //public final String getNinthParameter() {
164: // return this.consoleNinthParameter;
165: //}
166: //
167: //public final String getTenthParameter() {
168: // return this.consoleTenthParameter;
169: //}
170:
171: //public final void setFirstParameter(String inConsoleFirstParameter) {
172: // this.consoleFirstParameter = inConsoleFirstParameter;
173: //}
174: //
175: //public final void setSecondParameter(String inConsoleSecondParameter) {
176: // this.consoleSecondParameter = inConsoleSecondParameter;
177: //}
178: //
179: //public final void setThirdParameter(String inConsoleThirdParameter) {
180: // this.consoleThirdParameter = inConsoleThirdParameter;
181: //}
182: //
183: //public final void setFourthParameter(String inConsoleFourthParameter) {
184: // this.consoleFourthParameter = inConsoleFourthParameter;
185: //}
186: //
187: //public final void setFifthParameter(String inConsoleFifthParameter) {
188: // this.consoleFifthParameter = inConsoleFifthParameter;
189: //}
190: //
191: //public final void setSixthParameter(String inConsoleSixthParameter) {
192: // this.consoleSixthParameter = inConsoleSixthParameter;
193: //}
194: //
195: //public final void setSeventhParameter(String inConsoleSeventhParameter) {
196: // this.consoleSeventhParameter = inConsoleSeventhParameter;
197: //}
198: //
199: //public final void setEighthParameter(String inConsoleEighthParameter) {
200: // this.consoleEighthParameter = inConsoleEighthParameter;
201: //}
202: //
203: //public final void setNinthParameter(String inConsoleNinthParameter) {
204: // this.consoleNinthParameter = inConsoleNinthParameter;
205: //}
206: //
207: //public final void setTenthParameter(String inConsoleTenthParameter) {
208: // this.consoleTenthParameter = inConsoleTenthParameter;
209: //}
210: }
|