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.stream;
|
10
|
|
11
|
import java.util.Map;
|
12
|
|
13
|
import org.apache.log4j.Logger;
|
14
|
|
15
|
import eu.etaxonomy.cdm.common.CdmUtils;
|
16
|
import eu.etaxonomy.cdm.io.dwca.TermUri;
|
17
|
import eu.etaxonomy.cdm.io.dwca.in.IConverterInput;
|
18
|
|
19
|
/**
|
20
|
* @author a.mueller
|
21
|
* @date 23.11.2011
|
22
|
*
|
23
|
*/
|
24
|
public class StreamItem implements IConverterInput<StreamItem> {
|
25
|
@SuppressWarnings("unused")
|
26
|
private static Logger logger = Logger.getLogger(StreamItem.class);
|
27
|
|
28
|
public TermUri term;
|
29
|
public Map<String, String> map;
|
30
|
public String location;
|
31
|
|
32
|
/**
|
33
|
* @param term
|
34
|
* @param map
|
35
|
* @param stream
|
36
|
*/
|
37
|
public StreamItem(TermUri term, Map<String, String> map, String location) {
|
38
|
super();
|
39
|
this.term = term;
|
40
|
this.map = map;
|
41
|
this.location = location;
|
42
|
|
43
|
}
|
44
|
|
45
|
public String get(String mapKey){
|
46
|
return this.map.get(mapKey);
|
47
|
}
|
48
|
|
49
|
public String get(TermUri termUri){
|
50
|
return this.map.get(termUri.getUriString());
|
51
|
}
|
52
|
|
53
|
public void remove(TermUri termUri){
|
54
|
this.map.remove(termUri.getUriString());
|
55
|
}
|
56
|
|
57
|
|
58
|
public void remove(String string) {
|
59
|
this.map.remove(string);
|
60
|
}
|
61
|
|
62
|
|
63
|
/**
|
64
|
* Returns the location in the stream origin. For event messaging and maybe in future also
|
65
|
* for state analysis.
|
66
|
* @return
|
67
|
*/
|
68
|
public String getLocation() {
|
69
|
return location;
|
70
|
}
|
71
|
|
72
|
@Override
|
73
|
public String toString(){
|
74
|
if (term == null && map == null){
|
75
|
return super.toString();
|
76
|
}else{
|
77
|
return "[" + CdmUtils.concat("|", term.getUriString(), map.toString()) + "]";
|
78
|
}
|
79
|
}
|
80
|
|
81
|
|
82
|
|
83
|
}
|