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