001: /*
002: * ====================================================================
003: * JAFFA - Java Application Framework For All
004: *
005: * Copyright (C) 2002 JAFFA Development Group
006: *
007: * This library is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU Lesser General Public
009: * License as published by the Free Software Foundation; either
010: * version 2.1 of the License, or (at your option) any later version.
011: *
012: * This library is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this library; if not, write to the Free Software
019: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020: *
021: * Redistribution and use of this software and associated documentation ("Software"),
022: * with or without modification, are permitted provided that the following conditions are met:
023: * 1. Redistributions of source code must retain copyright statements and notices.
024: * Redistributions must also contain a copy of this document.
025: * 2. Redistributions in binary form must reproduce the above copyright notice,
026: * this list of conditions and the following disclaimer in the documentation
027: * and/or other materials provided with the distribution.
028: * 3. The name "JAFFA" must not be used to endorse or promote products derived from
029: * this Software without prior written permission. For written permission,
030: * please contact mail to: jaffagroup@yahoo.com.
031: * 4. Products derived from this Software may not be called "JAFFA" nor may "JAFFA"
032: * appear in their names without prior written permission.
033: * 5. Due credit should be given to the JAFFA Project (http://jaffa.sourceforge.net).
034: *
035: * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
036: * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
037: * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
038: * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
039: * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
040: * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
041: * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
042: * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
043: * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
044: * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
045: * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
046: * SUCH DAMAGE.
047: * ====================================================================
048: */
049:
050: package org.jaffa.tools.patternengine;
051:
052: import javax.xml.parsers.DocumentBuilderFactory;
053: import javax.xml.parsers.DocumentBuilder;
054: import org.w3c.dom.Document;
055: import org.w3c.dom.Element;
056: import org.w3c.dom.Node;
057: import org.w3c.dom.NodeList;
058: import java.util.*;
059: import org.jaffa.util.DefaultEntityResolver;
060: import org.jaffa.util.DefaultErrorHandler;
061: import org.jaffa.datatypes.DateTime;
062: import org.jaffa.util.StringHelper;
063: import org.jaffa.util.XmlHelper;
064: import org.jaffa.datatypes.Defaults;
065: import org.jaffa.datatypes.Parser;
066:
067: import javax.xml.parsers.ParserConfigurationException;
068: import org.xml.sax.SAXException;
069: import java.io.IOException;
070: import org.w3c.dom.NamedNodeMap;
071:
072: /** This parses an input XML file into a Map of Maps.
073: */
074: public class DomParser {
075:
076: /** Parses the XML without validating it. It returns a Map.
077: * @param uri The location of the content to be parsed.
078: * @throws ParserConfigurationException if a DocumentBuilder cannot be created which satisfies the configuration requested.
079: * @throws SAXException If any parse errors occur.
080: * @throws IOException If any IO errors occur.
081: * @return The Map.
082: */
083: public static Map parse(String uri)
084: throws ParserConfigurationException, SAXException,
085: IOException {
086: return parse(uri, false);
087: }
088:
089: /** Parses the XML. It returns a Map.
090: * @param uri The location of the content to be parsed.
091: * @param validate if the XML is to be validated while parsing.
092: * @throws ParserConfigurationException if a DocumentBuilder cannot be created which satisfies the configuration requested.
093: * @throws SAXException If any parse errors occur.
094: * @throws IOException If any IO errors occur.
095: * @return The Map.
096: */
097: public static Map parse(String uri, boolean validate)
098: throws ParserConfigurationException, SAXException,
099: IOException {
100: // Create a factory object for creating DOM parsers
101: DocumentBuilderFactory factory = DocumentBuilderFactory
102: .newInstance();
103:
104: // Specifies that the parser produced by this factory will validate documents as they are parsed.
105: factory.setValidating(validate);
106:
107: // Now use the factory to create a DOM parser
108: DocumentBuilder parser = factory.newDocumentBuilder();
109:
110: // Specifies the EntityResolver to resolve DTD used in XML documents
111: parser.setEntityResolver(new DefaultEntityResolver());
112:
113: // Specifies the ErrorHandler to handle warning/error/fatalError conditions
114: parser.setErrorHandler(new DefaultErrorHandler());
115:
116: Document document = parser.parse(uri);
117:
118: return parseXML(document);
119: }
120:
121: private static Map parseXML(Document document) {
122: // this is the Map to be returned
123: Map xmlMap = new LinkedHashMap();
124:
125: // get the root Element
126: Element root = document.getDocumentElement();
127: if (root != null) {
128: Map m = new LinkedHashMap();
129: xmlMap.put(root.getNodeName(), m);
130: if (root.hasAttributes()) {
131: NamedNodeMap attributes = root.getAttributes();
132: for (int i = 0; i < attributes.getLength(); i++) {
133: Node attribute = attributes.item(i);
134: m.put(attribute.getNodeName(), new ValueObject(
135: StringHelper.replace(attribute
136: .getNodeValue(), "\"", "\\\"")));
137: }
138: }
139: if (XmlHelper.hasChildElements(root))
140: loopJDOM(root, m);
141: }
142:
143: return xmlMap;
144: }
145:
146: private static void loopJDOM(Node node, Map map) {
147: NodeList children = node.getChildNodes();
148: for (int i = 0; i < children.getLength(); i++) {
149: Node child = children.item(i);
150: // only process Elements
151: if (child.getNodeType() == Node.ELEMENT_NODE) {
152: Map m = null;
153: if (child.hasAttributes()) {
154: // If attributes are present, then add them to a new Map
155: if (m == null) {
156: m = new LinkedHashMap();
157: map.put(uniqueString(map, child.getNodeName()),
158: m);
159: }
160: NamedNodeMap attributes = child.getAttributes();
161: for (int j = 0; j < attributes.getLength(); j++) {
162: Node attribute = attributes.item(j);
163: m
164: .put(
165: attribute.getNodeName(),
166: new ValueObject(
167: StringHelper
168: .replace(
169: attribute
170: .getNodeValue(),
171: "\"",
172: "\\\"")));
173: }
174: }
175: if (XmlHelper.hasChildElements(child)) {
176: // If child elements are present, then add them recursively to a new Map
177: if (m == null) {
178: m = new LinkedHashMap();
179: map.put(uniqueString(map, child.getNodeName()),
180: m);
181: }
182: loopJDOM(child, m);
183: } else if (m == null) {
184: // If neither attributes nor child elements are present, then add the element contents to the existing Map
185: map.put(uniqueString(map, child.getNodeName()),
186: new ValueObject(StringHelper.replace(
187: XmlHelper.getTextTrim(child), "\"",
188: "\\\"")));
189: }
190: }
191: }
192: }
193:
194: private static String uniqueString(Map map, String s) {
195: int i = 0;
196: String str = s;
197: while (map.containsKey(str))
198: str = s + ++i;
199: return str;
200: }
201:
202: /** A value in the input XML stream can be represented as a ValueObject.
203: * This class supports various helper routines to get different variations of the values.
204: */
205: public static class ValueObject {
206: private String m_value = null;
207: private String m_lower1 = null;
208: private String m_upper1 = null;
209: private String m_lower = null;
210: private String m_upper = null;
211: private String m_static = null;
212: private String m_space = null;
213:
214: private Boolean m_booleanValue = null;
215: private String m_javaDataType = null;
216: private String m_gridColumnDataType = null;
217: private String m_criteriaFieldType = null;
218: private Boolean m_criteriaFieldTypeThrowsException = null;
219: private String m_metaFieldType = null;
220: private String m_widgetType = null;
221: private String m_widgetTypeInCriteriaScreen = null;
222: private String m_widgetTypeBasedOnBreakup = null;
223: private String m_parserMethod = null;
224:
225: /** Creates an instance.
226: * @param value the value of this object.
227: */
228: public ValueObject(String value) {
229: m_value = value;
230: }
231:
232: /** Returns the value with the 1st character in lowercase.
233: * @return the value with the 1st character in lowercase.
234: */
235: public String getLower1() {
236: if (m_lower1 == null)
237: m_lower1 = StringHelper.getLower1(m_value);
238: return m_lower1;
239: }
240:
241: /** Returns the value with the 1st character in uppercase.
242: * @return the value with the 1st character in uppercase.
243: */
244: public String getUpper1() {
245: if (m_upper1 == null)
246: m_upper1 = StringHelper.getUpper1(m_value);
247: return m_upper1;
248: }
249:
250: /** Returns the value with the value in lowercase.
251: * @return the value with the value in lowercase.
252: */
253: public String getLower() {
254: if (m_lower == null)
255: m_lower = StringHelper.getLower(m_value);
256: return m_lower;
257: }
258:
259: /** Returns the value with the value in uppercase.
260: * @return the value with the value in uppercase.
261: */
262: public String getUpper() {
263: if (m_upper == null)
264: m_upper = StringHelper.getUpper(m_value);
265: return m_upper;
266: }
267:
268: /** Translates the value to all UpperCase with underscores separating the words.
269: * For eg: "abcDef" would be translated to "ABC_DEF".
270: * @return the value as a static.
271: */
272: public String getStatic() {
273: if (m_static == null)
274: m_static = StringHelper.getStatic(m_value);
275: return m_static;
276: }
277:
278: /** Translates the value to words separated by spaces.
279: * For eg: "abcDef" would be translated to "abc Def".
280: * @return the value separated into words.
281: */
282: public String getSpace() {
283: if (m_space == null)
284: m_space = StringHelper.getSpace(m_value);
285: return m_space;
286: }
287:
288: /** Translates the value to an int value.
289: * @throws NumberFormatException if the String cannot be converted to an int value.
290: * @return the value as an int value.
291: */
292: public int getIntValue() throws NumberFormatException {
293: return Integer.parseInt(m_value);
294: }
295:
296: /** Returns the value as is.
297: * @return the value as is.
298: */
299: public String toString() {
300: return m_value;
301: }
302:
303: /** Returns true if the value is any of true/yes/t/y/1.
304: * It utilises the Parser.parseBoolean() method to arrive at the result.
305: * @return true if the value is any of true/yes/t/y/1.
306: */
307: public boolean getBooleanValue() {
308: if (m_booleanValue == null)
309: m_booleanValue = Parser.parseBoolean(m_value);
310: return m_booleanValue != null ? m_booleanValue
311: .booleanValue() : false;
312: }
313:
314: /** Returns the Java classname for the datatype represented by this value.
315: * It invokes the Defaults.getClassString() method to obtain the Java classname.
316: * @return the Java Class Name for the datatype represented by this value.
317: */
318: public String getJavaDataType() {
319: if (m_javaDataType == null)
320: determineDataTypeRelatedValues();
321: return m_javaDataType;
322: }
323:
324: /** Returns the string to be specified as the GridColumnDataType for the datatype represented by this value.
325: * @return the string to be specified as the GridColumnDataType for the datatype represented by this value.
326: */
327: public String getGridColumnDataType() {
328: if (m_gridColumnDataType == null)
329: determineDataTypeRelatedValues();
330: return m_gridColumnDataType;
331: }
332:
333: /** Returns the CriteriaField implementation classname appropriate for the datatype represented by this value.
334: * @return the CriteriaField implementation classname appropriate for the datatype represented by this value.
335: */
336: public String getCriteriaFieldType() {
337: if (m_criteriaFieldType == null)
338: determineDataTypeRelatedValues();
339: return m_criteriaFieldType;
340: }
341:
342: /** Returns true if the CriteriaField implementation class appropriate for the datatype represented by this value throws an Exception during Instantiation.
343: * @return true if the CriteriaField implementation class appropriate for the datatype represented by this value throws an Exception during Instantiation.
344: */
345: public boolean getCriteriaFieldTypeThrowsException() {
346: if (m_criteriaFieldTypeThrowsException == null)
347: determineDataTypeRelatedValues();
348: return m_criteriaFieldTypeThrowsException != null ? m_criteriaFieldTypeThrowsException
349: .booleanValue()
350: : false;
351: }
352:
353: /** Returns the FieldMetaData implementation classname appropriate for the datatype represented by this value.
354: * @return the FieldMetaData implementation classname appropriate for the datatype represented by this value.
355: */
356: public String getMetaFieldType() {
357: if (m_metaFieldType == null)
358: determineDataTypeRelatedValues();
359: return m_metaFieldType;
360: }
361:
362: /** Returns the WidgetType appropriate for the datatype represented by this value.
363: * @return the WidgetType appropriate for the datatype represented by this value.
364: */
365: public String getWidgetType() {
366: if (m_widgetType == null)
367: determineDataTypeRelatedValues();
368: return m_widgetType;
369: }
370:
371: /** Returns the WidgetType appropriate for the datatype represented by this value for an Inquiry Criteria Screen.
372: * @return the WidgetType appropriate for the datatype represented by this value for an Inquiry Criteria Screen
373: */
374: public String getWidgetTypeInCriteriaScreen() {
375: if (m_widgetTypeInCriteriaScreen == null)
376: determineDataTypeRelatedValues();
377: return m_widgetTypeInCriteriaScreen;
378: }
379:
380: /** Returns the WidgetType appropriate for the Breakup type represented by this value.
381: * @return the WidgetType appropriate for the Breakup type represented by this value.
382: */
383: public String getWidgetTypeBasedOnBreakup() {
384: if (m_widgetTypeBasedOnBreakup == null && m_value != null) {
385: if (m_value.equalsIgnoreCase("dropdown"))
386: m_widgetTypeBasedOnBreakup = "DropDown";
387: else if (m_value.equalsIgnoreCase("checkbox"))
388: m_widgetTypeBasedOnBreakup = "Grid";
389: else if (m_value.equalsIgnoreCase("radiobutton"))
390: m_widgetTypeBasedOnBreakup = "RadioButton";
391: }
392: return m_widgetTypeBasedOnBreakup;
393: }
394:
395: /** Returns the ParserMethod appropriate for the datatype represented by this value.
396: * @return the ParserMethod appropriate for the datatype represented by this value.
397: */
398: public String getParserMethod() {
399: if (m_parserMethod == null)
400: determineDataTypeRelatedValues();
401: return m_parserMethod;
402: }
403:
404: /** Returns a true if the value represents the DateOnly datatype
405: * @return a true if the value represents the DateOnly datatype
406: */
407: public boolean getDataTypeDateOnly() {
408: return m_value != null ? m_value
409: .equalsIgnoreCase(Defaults.DATEONLY) : false;
410: }
411:
412: /** Returns a true if the value represents the DateTime datatype
413: * @return a true if the value represents the DateTime datatype
414: */
415: public boolean getDataTypeDateTime() {
416: return m_value != null ? m_value
417: .equalsIgnoreCase(Defaults.DATETIME) : false;
418: }
419:
420: /** Returns a true if the value represents the Boolean datatype or its variants.
421: * @return a true if the value represents the Boolean datatype or its variants.
422: */
423: public boolean getDataTypeBoolean() {
424: return m_value != null ? getUpper().startsWith(
425: Defaults.BOOLEAN) : false;
426: }
427:
428: /** Returns a true if the value represents the datatype for which the String class is used.
429: * @return a true if the value represents the datatype for which the String class is used.
430: */
431: public boolean getDataTypeString() {
432: return m_value != null ? Defaults.getClass(getUpper()) == String.class
433: : false;
434: }
435:
436: /** Returns a true if the value represents a numeric datatype. Eg. Decimal, Integer, Currency.
437: * @return a true if the value represents a numeric datatype.
438: */
439: public boolean getDataTypeNumeric() {
440: return m_value != null ? m_value
441: .equalsIgnoreCase(Defaults.INTEGER)
442: || m_value.equalsIgnoreCase(Defaults.DECIMAL)
443: || m_value.equalsIgnoreCase(Defaults.CURRENCY)
444: : false;
445: }
446:
447: /** This will check the input Map for a RelatedObject having the same Name as this field.
448: * This is extensively used by the object-maintenace_2_0 pattern.
449: * @param relatedObjectsMap The Map containing a collection of RelatedObjects.
450: * @return The matching RelatedObject.
451: */
452: public Map getRelatedObject(Object relatedObjectsMap) {
453: Map relatedObject = null;
454: if (m_value != null && relatedObjectsMap != null
455: && relatedObjectsMap instanceof Map) {
456: Collection relatedObjectsCollection = ((Map) relatedObjectsMap)
457: .values();
458: for (Iterator i = relatedObjectsCollection.iterator(); i
459: .hasNext();) {
460: relatedObject = (Map) i.next();
461: Object relatedObjectName = relatedObject
462: .get("Name");
463: if (relatedObjectName != null
464: && relatedObjectName.toString().equals(
465: m_value))
466: break;
467: else
468: relatedObject = null;
469: }
470: }
471: return relatedObject;
472: }
473:
474: /** This will check the input Map for a RelatedObject having the same Name as this field.
475: * It will then return the value of the property 'RelationshipToDomainObject' for the RelatedObject.
476: * This is extensively used by the object-maintenace_2_0 pattern.
477: * @param relatedObjectsMap The Map containing a collection of RelatedObjects.
478: * @return The RelationshipType for the matching RelatedObject.
479: */
480: public String getRelationshipType(Object relatedObjectsMap) {
481: Object relationshipType = null;
482: Map relatedObject = getRelatedObject(relatedObjectsMap);
483: if (relatedObject != null)
484: relationshipType = relatedObject
485: .get("RelationshipToDomainObject");
486: return relationshipType != null ? relationshipType
487: .toString() : null;
488: }
489:
490: /** Returns true if the RelationshipType for the matching RelatedObject equals any of the values:
491: One, OneAndMany, 1, 0..1, 1..1
492: * This is extensively used by the object-maintenace_2_0 pattern.
493: * @param relatedObjectsMap The Map containing a collection of RelatedObjects.
494: * @return true if the RelationshipType for the matching RelatedObject equals any of the values for the One relationship.
495: */
496: public boolean getRelationshipTypeOne(Object relatedObjectsMap) {
497: return getRelationshipTypeOne(getRelationshipType(relatedObjectsMap));
498: }
499:
500: /** Returns true if the RelationshipType for the matching RelatedObject equals any of the values:
501: Many, OneAndMany, *, m..*, m (where m > 1) or m..n (where n >= m && n > 1)
502: * This is extensively used by the object-maintenace_2_0 pattern.
503: * @param relatedObjectsMap The Map containing a collection of RelatedObjects.
504: * @return true if the RelationshipType for the matching RelatedObject equals any of the values for the Many relationship.
505: */
506: public boolean getRelationshipTypeMany(Object relatedObjectsMap) {
507: return getRelationshipTypeMany(getRelationshipType(relatedObjectsMap));
508: }
509:
510: /** Returns true if the value equals any of the values:
511: One, OneAndMany, 1, 0..1, 1..1.
512: * @return true if the value equals any of the values for the One relationship.
513: */
514: public boolean getRelationshipTypeOne() {
515: return getRelationshipTypeOne(m_value);
516: }
517:
518: /** Returns true if the value equals any of the values:
519: Many, OneAndMany, *, m..*, m (where m > 1) or m..n (where n >= m && n > 1)
520: * @return true if the value equals any of the values for the Many relationship.
521: */
522: public boolean getRelationshipTypeMany() {
523: return getRelationshipTypeMany(m_value);
524: }
525:
526: /** Returns true if the value equals any of the values:
527: 0..*, *, 0 or 0..n
528: * @return true if the value equals any of the values for the Optional relationship.
529: */
530: public boolean getRelationshipTypeOptional() {
531: return "*".equals(m_value) || "0..*".equals(m_value)
532: || "0".equals(m_value) || m_value.startsWith("0..");
533: }
534:
535: private boolean getRelationshipTypeOne(String relationshipType) {
536: return "One".equalsIgnoreCase(relationshipType)
537: || "OneAndMany".equalsIgnoreCase(relationshipType)
538: || "1".equals(relationshipType)
539: || "0..1".equals(relationshipType)
540: || "1..1".equals(relationshipType);
541: }
542:
543: private boolean getRelationshipTypeMany(String relationshipType) {
544: boolean result = "Many".equalsIgnoreCase(relationshipType)
545: || "OneAndMany".equalsIgnoreCase(relationshipType);
546: if (!result && relationshipType != null) {
547: // check the multiplicity
548: if (relationshipType.indexOf('*') >= 0) {
549: result = true;
550: } else {
551: // check the pattern 'm..n'
552: // return true if 'n >= m && n > 1'
553: int i = relationshipType.indexOf("..");
554: if (i > 0) {
555: try {
556: int low = Integer.parseInt(relationshipType
557: .substring(0, i));
558: int high = Integer
559: .parseInt(relationshipType
560: .substring(i
561: + "..".length()));
562: result = high >= low && high > 1;
563: } catch (NumberFormatException e) {
564: // do nothing
565: }
566: } else {
567: // check the pattern 'm', return true if m > 1
568: try {
569: int m = Integer.parseInt(relationshipType);
570: result = m > 1;
571: } catch (NumberFormatException e) {
572: // do nothing
573: }
574: }
575: }
576:
577: }
578: return result;
579: }
580:
581: private void determineDataTypeRelatedValues() {
582: if (m_value != null) {
583: String value = getUpper();
584: if (value.equals(Defaults.STRING)) {
585: m_javaDataType = Defaults.getClassString(value);
586: m_gridColumnDataType = "CaseInsensitiveString";
587: m_criteriaFieldType = "StringCriteriaField";
588: m_criteriaFieldTypeThrowsException = Boolean.FALSE;
589: m_metaFieldType = "StringFieldMetaData";
590: m_widgetType = "EditBox";
591: m_widgetTypeInCriteriaScreen = "EditBox";
592: m_parserMethod = "parseString";
593: } else if (value.equals(Defaults.BLOB)) {
594: m_javaDataType = Defaults.getClassString(value);
595: m_gridColumnDataType = "CaseInsensitiveString";
596: m_criteriaFieldType = "RawCriteriaField";
597: m_criteriaFieldTypeThrowsException = Boolean.FALSE;
598: m_metaFieldType = "RawFieldMetaData";
599: m_widgetType = "EditBox";
600: m_widgetTypeInCriteriaScreen = "EditBox";
601: m_parserMethod = "parseRaw";
602: } else if (value.startsWith(Defaults.BOOLEAN)) {
603: m_javaDataType = Defaults
604: .getClassString(Defaults.BOOLEAN);
605: m_gridColumnDataType = "CaseInsensitiveString";
606: m_criteriaFieldType = "BooleanCriteriaField";
607: m_criteriaFieldTypeThrowsException = Boolean.FALSE;
608: m_metaFieldType = "BooleanFieldMetaData";
609: m_widgetType = "CheckBox";
610: m_widgetTypeInCriteriaScreen = "DropDown";
611: m_parserMethod = "parseBoolean";
612: } else if (value.equals(Defaults.CLOB)) {
613: m_javaDataType = Defaults.getClassString(value);
614: m_gridColumnDataType = "CaseInsensitiveString";
615: m_criteriaFieldType = "StringCriteriaField";
616: m_criteriaFieldTypeThrowsException = Boolean.FALSE;
617: m_metaFieldType = "StringFieldMetaData";
618: m_widgetType = "EditBox";
619: m_widgetTypeInCriteriaScreen = "EditBox";
620: m_parserMethod = "parseString";
621: } else if (value.equals(Defaults.CURRENCY)) {
622: m_javaDataType = Defaults.getClassString(value);
623: m_gridColumnDataType = "Number";
624: m_criteriaFieldType = "CurrencyCriteriaField";
625: m_criteriaFieldTypeThrowsException = Boolean.TRUE;
626: m_metaFieldType = "CurrencyFieldMetaData";
627: m_widgetType = "EditBox";
628: m_widgetTypeInCriteriaScreen = "EditBox";
629: m_parserMethod = "parseCurrency";
630: } else if (value.equals(Defaults.DATEONLY)) {
631: m_javaDataType = Defaults.getClassString(value);
632: m_gridColumnDataType = "Date";
633: m_criteriaFieldType = "DateOnlyCriteriaField";
634: m_criteriaFieldTypeThrowsException = Boolean.TRUE;
635: m_metaFieldType = "DateOnlyFieldMetaData";
636: m_widgetType = "DateTime";
637: m_widgetTypeInCriteriaScreen = "EditBox";
638: m_parserMethod = "parseDateOnly";
639: } else if (value.equals(Defaults.DATETIME)) {
640: m_javaDataType = Defaults.getClassString(value);
641: m_gridColumnDataType = "Date";
642: m_criteriaFieldType = "DateTimeCriteriaField";
643: m_criteriaFieldTypeThrowsException = Boolean.TRUE;
644: m_metaFieldType = "DateTimeFieldMetaData";
645: m_widgetType = "DateTime";
646: m_widgetTypeInCriteriaScreen = "EditBox";
647: m_parserMethod = "parseDateTime";
648: } else if (value.equals(Defaults.DECIMAL)) {
649: m_javaDataType = Defaults.getClassString(value);
650: m_gridColumnDataType = "Number";
651: m_criteriaFieldType = "DecimalCriteriaField";
652: m_criteriaFieldTypeThrowsException = Boolean.TRUE;
653: m_metaFieldType = "DecimalFieldMetaData";
654: m_widgetType = "EditBox";
655: m_widgetTypeInCriteriaScreen = "EditBox";
656: m_parserMethod = "parseDecimal";
657: } else if (value.equals(Defaults.INTEGER)) {
658: m_javaDataType = Defaults.getClassString(value);
659: m_gridColumnDataType = "Number";
660: m_criteriaFieldType = "IntegerCriteriaField";
661: m_criteriaFieldTypeThrowsException = Boolean.TRUE;
662: m_metaFieldType = "IntegerFieldMetaData";
663: m_widgetType = "EditBox";
664: m_widgetTypeInCriteriaScreen = "EditBox";
665: m_parserMethod = "parseInteger";
666: } else if (value.equals(Defaults.LONG_RAW)) {
667: m_javaDataType = Defaults.getClassString(value);
668: m_gridColumnDataType = "CaseInsensitiveString";
669: m_criteriaFieldType = "RawCriteriaField";
670: m_criteriaFieldTypeThrowsException = Boolean.FALSE;
671: m_metaFieldType = "RawFieldMetaData";
672: m_widgetType = "EditBox";
673: m_widgetTypeInCriteriaScreen = "EditBox";
674: m_parserMethod = "parseRaw";
675: } else if (value.equals(Defaults.LONG_STRING)) {
676: m_javaDataType = Defaults.getClassString(value);
677: m_gridColumnDataType = "CaseInsensitiveString";
678: m_criteriaFieldType = "StringCriteriaField";
679: m_criteriaFieldTypeThrowsException = Boolean.FALSE;
680: m_metaFieldType = "StringFieldMetaData";
681: m_widgetType = "EditBox";
682: m_widgetTypeInCriteriaScreen = "EditBox";
683: m_parserMethod = "parseString";
684: } else if (value.equals(Defaults.RAW)) {
685: m_javaDataType = Defaults.getClassString(value);
686: m_gridColumnDataType = "CaseInsensitiveString";
687: m_criteriaFieldType = "RawCriteriaField";
688: m_criteriaFieldTypeThrowsException = Boolean.FALSE;
689: m_metaFieldType = "RawFieldMetaData";
690: m_widgetType = "EditBox";
691: m_widgetTypeInCriteriaScreen = "EditBox";
692: m_parserMethod = "parseRaw";
693: }
694: }
695: }
696: }
697:
698: }
|