01: /*
02: * $Id: ModelRecord.java,v 1.1 2003/08/19 00:27:10 jonesde Exp $
03: *
04: * Copyright (c) 2001-2003 The Open For Business Project - www.ofbiz.org
05: *
06: * Permission is hereby granted, free of charge, to any person obtaining a
07: * copy of this software and associated documentation files (the "Software"),
08: * to deal in the Software without restriction, including without limitation
09: * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10: * and/or sell copies of the Software, and to permit persons to whom the
11: * Software is furnished to do so, subject to the following conditions:
12: *
13: * The above copyright notice and this permission notice shall be included
14: * in all copies or substantial portions of the Software.
15: *
16: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17: * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18: * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19: * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20: * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT
21: * OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR
22: * THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23: *
24: */
25: package org.ofbiz.datafile;
26:
27: import java.util.ArrayList;
28: import java.util.List;
29:
30: /**
31: * ModelRecord
32: *
33: * @author <a href="mailto:jonesde@ofbiz.org">David E. Jones</a>
34: * @version $Revision: 1.1 $
35: * @since 2.0
36: */
37:
38: public class ModelRecord {
39:
40: public static final String LIMIT_ONE = "one";
41: public static final String LIMIT_MANY = "many";
42:
43: /** The name of the Record */
44: public String name = "";
45:
46: /** The type-code of the Record */
47: public String typeCode = "";
48:
49: /** The minimum type-code of the Record, an alternative to the single type code */
50: public String tcMin = "";
51: public long tcMinNum = -1;
52:
53: /** The maximum type-code of the Record, an alternative to the single type code */
54: public String tcMax = "";
55: public long tcMaxNum = -1;
56:
57: /** specifies whether or not the type min and max are numbers, if so does a number compare, otherwise a String compare */
58: public boolean tcIsNum = true;
59:
60: /** The position of the type-code of the Record */
61: public int tcPosition = -1;
62:
63: /** The length of the type-code of the Record - optional */
64: public int tcLength = -1;
65:
66: /** A free form description of the Record */
67: public String description = "";
68:
69: /** The name of the parent record for this record, if any */
70: public String parentName = "";
71:
72: /** The number limit of records to go under the parent, may be one or many */
73: public String limit = "";
74:
75: public ModelRecord parentRecord = null;
76: public List childRecords = new ArrayList();
77:
78: /** List of the fields that compose this record */
79: public List fields = new ArrayList();
80:
81: ModelField getModelField(String fieldName) {
82: for (int i = 0; i < fields.size(); i++) {
83: ModelField curField = (ModelField) fields.get(i);
84:
85: if (curField.name.equals(fieldName)) {
86: return curField;
87: }
88: }
89: return null;
90: }
91: }
|