Project

General

Profile

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

    
11
package eu.etaxonomy.cdm.io.markup;
12

    
13
import java.util.HashMap;
14
import java.util.HashSet;
15
import java.util.Map;
16
import java.util.Set;
17
import java.util.UUID;
18

    
19
import org.apache.log4j.Logger;
20

    
21
import eu.etaxonomy.cdm.io.common.XmlImportState;
22
import eu.etaxonomy.cdm.io.common.mapping.IInputTransformer;
23
import eu.etaxonomy.cdm.model.common.AnnotatableEntity;
24
import eu.etaxonomy.cdm.model.common.Language;
25
import eu.etaxonomy.cdm.model.description.FeatureNode;
26
import eu.etaxonomy.cdm.model.description.PolytomousKey;
27
import eu.etaxonomy.cdm.model.description.PolytomousKeyNode;
28
import eu.etaxonomy.cdm.model.media.Media;
29
import eu.etaxonomy.cdm.model.taxon.Taxon;
30

    
31
/**
32
 * @author a.mueller
33
 * @created 11.05.2009
34
 * @version 1.0
35
 */
36
public class MarkupImportState extends XmlImportState<MarkupImportConfigurator, MarkupImportBase>{
37
	@SuppressWarnings("unused")
38
	private static final Logger logger = Logger.getLogger(MarkupImportState.class);
39
	
40

    
41
	private UnmatchedLeads unmatchedLeads;
42

    
43
	private Set<FeatureNode> featureNodesToSave = new HashSet<FeatureNode>();
44
	
45
	private Set<PolytomousKeyNode> polytomousKeyNodesToSave = new HashSet<PolytomousKeyNode>();
46
	
47
	private PolytomousKey currentKey;
48
	
49
	private Language defaultLanguage;
50
	
51
	private Taxon currentTaxon;
52
	private String currentTaxonNum;
53
	
54
	private boolean isCitation = false;
55
	private boolean isNameType = false;
56
	private boolean isProParte = false;
57
	
58
	private String baseMediaUrl = null;
59
	
60
	private Map<String, FootnoteDataHolder> footnoteRegister = new HashMap<String, FootnoteDataHolder>();
61
	
62
	private Map<String, Media> figureRegister = new HashMap<String, Media>();
63
	
64
	private Map<String, Set<AnnotatableEntity>> footnoteRefRegister = new HashMap<String, Set<AnnotatableEntity>>();
65
	private Map<String, Set<AnnotatableEntity>> figureRefRegister = new HashMap<String, Set<AnnotatableEntity>>();
66
	
67
	private Map<String, UUID> areaMap = new HashMap<String, UUID>();
68
	
69
		
70
//**************************** CONSTRUCTOR ******************************************/
71
	
72
	public MarkupImportState(MarkupImportConfigurator config) {
73
		super(config);
74
		if (getTransformer() == null){
75
			IInputTransformer newTransformer = config.getTransformer();
76
			if (newTransformer == null){
77
				newTransformer = new MarkupTransformer();
78
			}
79
			setTransformer(newTransformer);
80
		}
81
	}
82

    
83
// ********************************** GETTER / SETTER *************************************/	
84
	
85
	public UnmatchedLeads getUnmatchedLeads() {
86
		return unmatchedLeads;
87
	}
88

    
89
	public void setUnmatchedLeads(UnmatchedLeads unmatchedKeys) {
90
		this.unmatchedLeads = unmatchedKeys;
91
	}
92

    
93
	public void setFeatureNodesToSave(Set<FeatureNode> featureNodesToSave) {
94
		this.featureNodesToSave = featureNodesToSave;
95
	}
96

    
97
	public Set<FeatureNode> getFeatureNodesToSave() {
98
		return featureNodesToSave;
99
	}
100

    
101
	public Set<PolytomousKeyNode> getPolytomousKeyNodesToSave() {
102
		return polytomousKeyNodesToSave;
103
	}
104
	
105
	public void setPolytomousKeyNodesToSave(Set<PolytomousKeyNode> polytomousKeyNodesToSave) {
106
		this.polytomousKeyNodesToSave = polytomousKeyNodesToSave;
107
	}
108
	
109
	public Language getDefaultLanguage() {
110
		return this.defaultLanguage;
111
	}
112

    
113
	public void setDefaultLanguage(Language defaultLanguage){
114
		this.defaultLanguage = defaultLanguage;
115
	}
116

    
117
	
118
	public void setCurrentTaxon(Taxon currentTaxon) {
119
		this.currentTaxon = currentTaxon;
120
	}
121

    
122
	public Taxon getCurrentTaxon() {
123
		return currentTaxon;
124
	}
125
	
126
	public void setCurrentTaxonNum(String currentTaxonNum) {
127
		this.currentTaxonNum = currentTaxonNum;
128
	}
129

    
130
	public String getCurrentTaxonNum() {
131
		return currentTaxonNum;
132
	}
133

    
134

    
135

    
136
	/**
137
	 * Is the import currently handling a citation?
138
	 * @return
139
	 */
140
	public boolean isCitation() {
141
		return isCitation;
142
	}
143
	
144
	public void setCitation(boolean isCitation) {
145
		this.isCitation = isCitation;
146
	}
147

    
148

    
149
	public boolean isNameType() {
150
		return isNameType;
151
	}
152
	
153
	public void setNameType(boolean isNameType) {
154
		this.isNameType = isNameType;
155
	}
156

    
157
	public void setProParte(boolean isProParte) {
158
		this.isProParte = isProParte;
159
	}
160

    
161
	public boolean isProParte() {
162
		return isProParte;
163
	}
164

    
165
	public void setBaseMediaUrl(String baseMediaUrl) {
166
		this.baseMediaUrl = baseMediaUrl;
167
	}
168

    
169
	public String getBaseMediaUrl() {
170
		return baseMediaUrl;
171
	}
172

    
173
	
174
	
175
	public void registerFootnote(FootnoteDataHolder footnote) {
176
		footnoteRegister.put(footnote.id, footnote);
177
	}
178

    
179
	public FootnoteDataHolder getFootnote(String key) {
180
		return footnoteRegister.get(key);
181
	}
182
	
183
	
184
	public void registerFigure(String key, Media figure) {
185
		figureRegister.put(key, figure);
186
	}
187

    
188
	public Media getFigure(String key) {
189
		return figureRegister.get(key);
190
	}
191

    
192
	public Set<AnnotatableEntity> getFootnoteDemands(String footnoteId){
193
		return footnoteRefRegister.get(footnoteId);
194
	}
195
	
196
	public void putFootnoteDemands(String footnoteId, Set<AnnotatableEntity> demands){
197
		footnoteRefRegister.put(footnoteId, demands);
198
	}
199
	
200

    
201
	public Set<AnnotatableEntity> getFigureDemands(String figureId){
202
		return figureRefRegister.get(figureId);
203
	}
204
	
205
	public void putFigureDemands(String figureId, Set<AnnotatableEntity> demands){
206
		figureRefRegister.put(figureId, demands);
207
	}
208

    
209
	/**
210
	 * @param key
211
	 */
212
	public void setCurrentKey(PolytomousKey key) {
213
		this.currentKey = key;
214
	}
215
	
216
	/**
217
	 * @return the currentKey
218
	 */
219
	public PolytomousKey getCurrentKey() {
220
		return currentKey;
221
	}
222

    
223
	/**
224
	 * @param key
225
	 * @return
226
	 * @see java.util.Map#get(java.lang.Object)
227
	 */
228
	public UUID getAreaUuid(Object key) {
229
		return areaMap.get(key);
230
	}
231

    
232
	/**
233
	 * @param key
234
	 * @param value
235
	 * @return
236
	 * @see java.util.Map#put(java.lang.Object, java.lang.Object)
237
	 */
238
	public UUID putAreaUuid(String key, UUID value) {
239
		return areaMap.put(key, value);
240
	}
241
	
242
	
243

    
244
}
(7-7/11)