Project

General

Profile

Download (4.93 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2009 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.cdm.io.dwca.jaxb;
10

    
11
import java.util.ArrayList;
12
import java.util.List;
13

    
14
import javax.xml.bind.annotation.XmlAccessType;
15
import javax.xml.bind.annotation.XmlAccessorType;
16
import javax.xml.bind.annotation.XmlAttribute;
17
import javax.xml.bind.annotation.XmlElement;
18
import javax.xml.bind.annotation.XmlRootElement;
19
import javax.xml.bind.annotation.XmlType;
20

    
21
/**
22
 * @author a.mueller
23
 * @date 17.10.2011
24
 *
25
 */
26
@XmlAccessorType(XmlAccessType.FIELD)
27
@XmlType(name = "ArchiveEntryBase", propOrder = {
28
    "files",
29
    "field"
30
})
31
@XmlRootElement(name = "archiveEntryBase")
32
public abstract class ArchiveEntryBase {
33

    
34

    
35
    @XmlElement(required = true)
36
    protected Files files;
37
     @XmlElement(required = true)
38
    protected List<Field> field;
39
    @XmlAttribute(required = true)
40
    protected String rowType;
41
    @XmlAttribute(required = true)
42
    protected String linesTerminatedBy;
43
    @XmlAttribute(required = true)
44
    protected boolean ignoreHeaderLines;
45
    @XmlAttribute(required = true)
46
    protected String fieldsTerminatedBy;
47
    @XmlAttribute(required = true)
48
    protected String fieldsEnclosedBy;
49
    @XmlAttribute(required = true)
50
    protected String encoding;
51

    
52
    public Files getFiles() {
53
        return files;
54
    }
55
    public void setFiles(Files value) {
56
        this.files = value;
57
    }
58

    
59

    
60
    /**
61
     * Gets the value of the field property.
62
     *
63
     * <p>
64
     * This accessor method returns a reference to the live list,
65
     * not a snapshot. Therefore any modification you make to the
66
     * returned list will be present inside the JAXB object.
67
     * This is why there is not a <CODE>set</CODE> method for the field property.
68
     *
69
     * <p>
70
     * For example, to add a new item, do as follows:
71
     * <pre>
72
     *    getField().add(newItem);
73
     * </pre>
74
     *
75
     *
76
     * <p>
77
     * Objects of the following type(s) are allowed in the list
78
     * {@link Field }
79
     *
80
     *
81
     */
82
    public List<Field> getField() {
83
        if (field == null) {
84
            field = new ArrayList<>();
85
        }
86
        return this.field;
87
    }
88

    
89
    public String getRowType() {
90
        return rowType;
91
    }
92
    public void setRowType(String value) {
93
        this.rowType = value;
94
    }
95

    
96
    public String getLinesTerminatedBy() {
97
        return normalizeSpecialChars(linesTerminatedBy);
98
    }
99
    public void setLinesTerminatedBy(String value) {
100
        this.linesTerminatedBy = normalizeSpecialChars(value);
101
    }
102

    
103
    private String normalizeSpecialChars(String string) {
104
		if (string != null){
105
	    	if (string.startsWith("\\")){
106
				if (string.equals("\\t")){
107
					string = "\t";
108
				}
109
			}
110
	    	//TODO some more
111
		}
112
		return string;
113
	}
114

    
115
	/**
116
     * Gets the value of the ignoreHeaderLines property.
117
     *
118
     */
119
    public boolean getIgnoreHeaderLines() {
120
        return ignoreHeaderLines;
121
    }
122

    
123
    /**
124
     * Sets the value of the ignoreHeaderLines property.
125
     *
126
     */
127
    public void setIgnoreHeaderLines(boolean value) {
128
        this.ignoreHeaderLines = value;
129
    }
130

    
131
    /**
132
     * Gets the value of the fieldsTerminatedBy property.
133
     *
134
     * @return
135
     *     possible object is
136
     *     {@link String }
137
     *
138
     */
139
    public String getFieldsTerminatedBy() {
140
        return normalizeSpecialChars(fieldsTerminatedBy);
141
    }
142

    
143
    /**
144
     * Sets the value of the fieldsTerminatedBy property.
145
     *
146
     * @param value
147
     *     allowed object is
148
     *     {@link String }
149
     *
150
     */
151
    public void setFieldsTerminatedBy(String value) {
152
        this.fieldsTerminatedBy = normalizeSpecialChars(value);
153
    }
154

    
155
    /**
156
     * Gets the value of the fieldsEnclosedBy property.
157
     *
158
     * @return
159
     *     possible object is
160
     *     {@link String }
161
     *
162
     */
163
    public String getFieldsEnclosedBy() {
164
        return normalizeSpecialChars(fieldsEnclosedBy);
165
    }
166

    
167
    /**
168
     * Sets the value of the fieldsEnclosedBy property.
169
     *
170
     * @param value
171
     *     allowed object is
172
     *     {@link String }
173
     *
174
     */
175
    public void setFieldsEnclosedBy(String value) {
176
        this.fieldsEnclosedBy = normalizeSpecialChars(value);
177
    }
178

    
179
    /**
180
     * Gets the value of the encoding property.
181
     *
182
     * @return
183
     *     possible object is
184
     *     {@link String }
185
     *
186
     */
187
    public String getEncoding() {
188
        return encoding;
189
    }
190

    
191
    /**
192
     * Sets the value of the encoding property.
193
     *
194
     * @param value
195
     *     allowed object is
196
     *     {@link String }
197
     *
198
     */
199
    public void setEncoding(String value) {
200
        this.encoding = value;
201
    }
202
}
(2-2/10)