2 * Copyright (C) 2009 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
9 package eu
.etaxonomy
.cdm
.io
.dwca
.out
;
12 import java
.util
.ArrayList
;
13 import java
.util
.List
;
15 import org
.apache
.log4j
.Logger
;
21 public class DwcaMetaDataRecord
{
22 @SuppressWarnings("unused")
23 private static final Logger logger
= Logger
.getLogger(DwcaMetaDataRecord
.class);
25 private String fileLocation
;
26 private String rowType
;
28 private boolean isCore
;
29 private int currentIndex
= 0;
30 private boolean isMetaData
= false; //is this record about meta data (should be true for MetaData and EML)
32 private int count
= 0;
34 private List
<FieldEntry
> fieldEntryList
= new ArrayList
<>();
35 protected List
<String
> fieldList
= new ArrayList
<>();
37 public DwcaMetaDataRecord(boolean isCore
, String fileLocation
, String rowType
){
38 FieldEntry idEntry
= new FieldEntry();
39 idEntry
.index
= currentIndex
++;
40 idEntry
.elementName
= isCore ?
"id" : "coreid";
41 fieldEntryList
.add(idEntry
);
43 this.fileLocation
= fileLocation
;
44 this.setRowType(rowType
);
47 protected class FieldEntry
{
50 String defaultValue
= null;
51 String elementName
= "field";
54 public void addFieldEntry(URI term
, String defaultValue
){
55 FieldEntry fieldEntry
= new FieldEntry();
56 fieldEntry
.index
= currentIndex
++;
57 fieldEntry
.term
= term
;
58 fieldEntry
.defaultValue
= defaultValue
;
59 this.fieldEntryList
.add(fieldEntry
);
63 // public abstract List<String> getHeaderList();
65 // public List<URI> getTermList(){
66 // List<URI> result = new ArrayList<URI>();
67 // for (String key : fieldList){
68 // URI uri = knownFields.get(key);
72 // String message = "Unknown 'known field key' " + key;
73 // logger.warn(message);
79 public boolean hasEntries(){
80 return fieldEntryList
.size() > 1;
83 public List
<FieldEntry
> getEntries(){
84 return fieldEntryList
;
88 public String
getFileLocation() {
92 public void setFileLocation(String fileLocation
) {
93 this.fileLocation
= fileLocation
;
96 public boolean isCore() {
100 public void setCore(boolean isCore
) {
101 this.isCore
= isCore
;
104 public void setRowType(String rowType
) {
105 this.rowType
= rowType
;
108 public String
getRowType() {
116 public void setMetaData(boolean isMetaData
) {
117 this.isMetaData
= isMetaData
;
120 public boolean isMetaData() {
126 public String
toString() {
127 return this.fileLocation
;