01: /*
02: * $Id: ModelDataFile.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.*;
28:
29: /**
30: * ModelDataFile
31: *
32: * @author <a href="mailto:jonesde@ofbiz.org">David E. Jones</a>
33: * @version $Revision: 1.1 $
34: * @since 2.0
35: */
36:
37: public class ModelDataFile {
38:
39: public static final String SEP_FIXED_LENGTH = "fixed-length";
40: public static final String SEP_FIXED_RECORD = "fixed-record";
41: public static final String SEP_DELIMITED = "delimited";
42:
43: /** The name of the File */
44: public String name = "";
45:
46: /** The type code of the File, ususally contained somewhere in the file and can be used to identify it */
47: public String typeCode = "";
48:
49: /** The party that generally sends the file */
50: public String sender = "";
51:
52: /** The party that generally receives the file */
53: public String receiver = "";
54:
55: /** The length in bytes of a single record, ONLY if it uses fixed length records */
56: public int recordLength = -1;
57:
58: /** The delimiter used in the file, if delimiter separated fields are used */
59: public char delimiter = '|';
60:
61: /** The field serparator style, either fixed-length, or delimited */
62: public String separatorStyle = "";
63:
64: /** A free form description of the file */
65: public String description = "";
66:
67: /** List of record definitions for the file */
68: public List records = new ArrayList();
69:
70: ModelRecord getModelRecord(String recordName) {
71: for (int i = 0; i < records.size(); i++) {
72: ModelRecord curRecord = (ModelRecord) records.get(i);
73:
74: if (curRecord.name.equals(recordName)) {
75: return curRecord;
76: }
77: }
78: return null;
79: }
80: }
|