KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ofbiz > datafile > ModelRecord


1 /*
2  * $Id: ModelRecord.java 5462 2005-08-05 18:35:48Z jonesde $
3  *
4  * Copyright (c) 2001-2003 The Open For Business Project - www.ofbiz.org
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a
7  * copy of this software and associated documentation files (the "Software"),
8  * to deal in the Software without restriction, including without limitation
9  * 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
28 import java.util.ArrayList JavaDoc;
29 import java.util.List JavaDoc;
30
31
32 /**
33  * ModelRecord
34  *
35  * @author <a HREF="mailto:jonesde@ofbiz.org">David E. Jones</a>
36  * @version $Rev: 5462 $
37  * @since 2.0
38  */

39
40 public class ModelRecord {
41
42     public static final String JavaDoc LIMIT_ONE = "one";
43     public static final String JavaDoc LIMIT_MANY = "many";
44
45     /** The name of the Record */
46     public String JavaDoc name = "";
47
48     /** The type-code of the Record */
49     public String JavaDoc typeCode = "";
50
51     /** The minimum type-code of the Record, an alternative to the single type code */
52     public String JavaDoc tcMin = "";
53     public long tcMinNum = -1;
54
55     /** The maximum type-code of the Record, an alternative to the single type code */
56     public String JavaDoc tcMax = "";
57     public long tcMaxNum = -1;
58
59     /** specifies whether or not the type min and max are numbers, if so does a number compare, otherwise a String compare */
60     public boolean tcIsNum = true;
61
62     /** The position of the type-code of the Record */
63     public int tcPosition = -1;
64
65     /** The length of the type-code of the Record - optional */
66     public int tcLength = -1;
67
68     /** A free form description of the Record */
69     public String JavaDoc description = "";
70
71     /** The name of the parent record for this record, if any */
72     public String JavaDoc parentName = "";
73
74     /** The number limit of records to go under the parent, may be one or many */
75     public String JavaDoc limit = "";
76
77     public ModelRecord parentRecord = null;
78     public List JavaDoc childRecords = new ArrayList JavaDoc();
79
80     /** List of the fields that compose this record */
81     public List JavaDoc fields = new ArrayList JavaDoc();
82
83     ModelField getModelField(String JavaDoc fieldName) {
84         for (int i = 0; i < fields.size(); i++) {
85             ModelField curField = (ModelField) fields.get(i);
86
87             if (curField.name.equals(fieldName)) {
88                 return curField;
89             }
90         }
91         return null;
92     }
93 }
94
95
Popular Tags