Project

General

Profile

Download (3.44 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
* Copyright (C) 2007 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.specimen.abcd206.in;
10

    
11
import java.io.ByteArrayOutputStream;
12
import java.io.PrintStream;
13
import java.util.ArrayList;
14
import java.util.HashSet;
15
import java.util.List;
16
import java.util.Set;
17
import java.util.UUID;
18

    
19
import org.apache.log4j.Logger;
20

    
21
import eu.etaxonomy.cdm.common.URI;
22
import eu.etaxonomy.cdm.io.specimen.SpecimenImportStateBase;
23
import eu.etaxonomy.cdm.model.occurrence.FieldUnit;
24

    
25
/**
26
 * @author a.mueller
27
 * @since 11.05.2009
28
 */
29
public class Abcd206ImportState
30
        extends SpecimenImportStateBase<Abcd206ImportConfigurator, Abcd206ImportState>{
31

    
32
    @SuppressWarnings("unused")
33
	private static final Logger logger = Logger.getLogger(Abcd206ImportState.class);
34

    
35
	private String prefix;
36

    
37
	private List<String[]> associatedUnitIds = new ArrayList<>();
38

    
39
	private Set<URI> sequenceDataStableIdentifier = new HashSet<>();
40

    
41
	private List<UUID> fieldUnitUUIDsToDelete = new ArrayList<>();
42

    
43
	private FieldUnit lastFieldUnit = null;
44

    
45

    
46
//****************** CONSTRUCTOR ***************************************************/
47

    
48
    public Abcd206ImportState(Abcd206ImportConfigurator config) {
49
		super(config);
50
        setReport(new SpecimenImportReport());
51
        setTransformer(new AbcdTransformer());
52
	}
53

    
54
//************************ GETTER / SETTER *****************************************/
55

    
56
    @Override
57
    public Abcd206DataHolder getDataHolder() {
58
        return (Abcd206DataHolder)dataHolder;
59
    }
60

    
61
    public void setDataHolder(Abcd206DataHolder dataHolder) {
62
        this.dataHolder = dataHolder;
63
    }
64

    
65
    public List<UUID> getFieldUnitsToDelete() {
66
        return fieldUnitUUIDsToDelete;
67
    }
68
    public void setFieldUnitsToDelete(List<UUID> fieldUnitsToDelete) {
69
        this.fieldUnitUUIDsToDelete = fieldUnitsToDelete;
70
    }
71

    
72
    public void addFieldUnitsToDelete(FieldUnit fieldUnitToDelete) {
73
        if (fieldUnitToDelete != null){
74
            this.fieldUnitUUIDsToDelete.add(fieldUnitToDelete.getUuid());
75
        }
76
    }
77
    public void setPrefix(String prefix) {
78
        this.prefix = prefix;
79
    }
80

    
81
    public String getPrefix() {
82
        return prefix;
83
    }
84

    
85

    
86
    @Override
87
    public byte[] getReportAsByteArray() {
88
        ByteArrayOutputStream importStream = new ByteArrayOutputStream();
89
        getReport().printReport(new PrintStream(importStream));
90
        return importStream.toByteArray();
91
    }
92

    
93
    public void setAssociatedUnitIds(List<String[]> associatedUnitIds){
94
        this.associatedUnitIds = associatedUnitIds;
95
    }
96

    
97
    public List<String[]> getAssociatedUnitIds(){
98
        return this.associatedUnitIds;
99
    }
100

    
101
    public Set<URI> getSequenceDataStableIdentifier() {
102
        return sequenceDataStableIdentifier;
103
    }
104

    
105
    public void putSequenceDataStableIdentifier(URI sequenceDataStableIdentifier) {
106
        this.sequenceDataStableIdentifier.add(sequenceDataStableIdentifier);
107
    }
108

    
109
    public FieldUnit getLastFieldUnit() {
110
        return lastFieldUnit;
111
    }
112

    
113
    public void setLastFieldUnit(FieldUnit lastFieldUnit) {
114
        this.lastFieldUnit = lastFieldUnit;
115
        if (lastFieldUnit != null){
116
            this.setFieldUnit(lastFieldUnit);
117
        }
118
    }
119

    
120
//
121
//    public void reset() {
122
//        getDataHolder().reset();
123
//        setDerivedUnitBase(null);
124
//    }
125
}
(5-5/15)