Berlin Model import ->in and import state class
[cdmlib.git] / cdmlib-io / src / main / java / eu / etaxonomy / cdm / io / taxonx / SimpleSpecimen.java
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
10 package eu.etaxonomy.cdm.io.taxonx;
11
12 import org.apache.log4j.Logger;
13
14 import eu.etaxonomy.cdm.model.agent.AgentBase;
15 import eu.etaxonomy.cdm.model.common.Language;
16 import eu.etaxonomy.cdm.model.common.LanguageString;
17 import eu.etaxonomy.cdm.model.name.TaxonNameBase;
18 import eu.etaxonomy.cdm.model.occurrence.Collection;
19 import eu.etaxonomy.cdm.model.occurrence.DerivationEvent;
20 import eu.etaxonomy.cdm.model.occurrence.FieldObservation;
21 import eu.etaxonomy.cdm.model.occurrence.GatheringEvent;
22 import eu.etaxonomy.cdm.model.occurrence.Specimen;
23
24 /**
25 * @author a.mueller
26 * @created 23.10.2008
27 * @version 1.0
28 */
29 public class SimpleSpecimen {
30 private static final Logger logger = Logger.getLogger(SimpleSpecimen.class);
31
32 private GatheringEvent gatheringEvent;
33 private FieldObservation fieldObservation;
34 private DerivationEvent derivationEvent;
35 private Specimen specimen;
36 private Collection collection;
37 private TaxonNameBase<?, ?> storedUnderName;
38 private String titleCache;
39
40
41 public static SimpleSpecimen NewInstance(){
42 return new SimpleSpecimen();
43 }
44
45 private SimpleSpecimen(){
46 gatheringEvent = GatheringEvent.NewInstance();
47
48 //observation
49 fieldObservation = FieldObservation.NewInstance();
50 fieldObservation.setGatheringEvent(gatheringEvent);
51
52 //derivationEvent
53 derivationEvent = DerivationEvent.NewInstance();
54 derivationEvent.addOriginal(fieldObservation);
55
56 //derivedUnit
57 specimen = Specimen.NewInstance();
58 derivationEvent.addDerivative(specimen);
59 }
60
61 public LanguageString getLocality(){
62 return gatheringEvent.getLocality();
63 }
64
65
66 /**
67 * Sets the locality string in the default language
68 * @param locality
69 */
70 public void setLocality(String locality){
71 Language lang = Language.DEFAULT();
72 LanguageString langString = LanguageString.NewInstance(locality, lang);
73 setLocality(langString);
74 }
75
76 public void setLocality(LanguageString locality){
77 gatheringEvent.setLocality(locality);
78 }
79
80 /**
81 * @return the collection
82 */
83 public Collection getCollection() {
84 return collection;
85 }
86
87 /**
88 * @param collection the collection to set
89 */
90 public void setCollection(Collection collection) {
91 this.collection = collection;
92 }
93
94 /**
95 * @return the storedUnderName
96 */
97 public TaxonNameBase<?, ?> getStoredUnderName() {
98 return storedUnderName;
99 }
100
101 /**
102 * @param storedUnderName the storedUnderName to set
103 */
104 public void setStoredUnderName(TaxonNameBase<?, ?> storedUnderName) {
105 this.storedUnderName = storedUnderName;
106 }
107
108 /**
109 * @return the collection
110 */
111 public AgentBase getCollector() {
112 return gatheringEvent.getCollector();
113 }
114
115 public void setCollector(AgentBase collector){
116 gatheringEvent.setCollector(collector);
117 }
118
119 /**
120 * @return the collectorsNumber
121 */
122 public String getCollectorsNumber() {
123 return specimen.getCollectorsNumber();
124 }
125
126 /**
127 * @param collectorsNumber the collectorsNumber to set
128 */
129 public void setCollectorsNumber(String collectorsNumber) {
130 this.specimen.setCollectorsNumber(collectorsNumber);
131 }
132
133
134 /**
135 * @return the specimen
136 */
137 public Specimen getSpecimen() {
138 return specimen;
139 }
140
141 /**
142 * @param specimen the specimen to set
143 */
144 public void setSpecimen(Specimen specimen) {
145 this.specimen = specimen;
146 }
147
148 /**
149 * @return the titleCache
150 */
151 public String getTitleCache() {
152 return this.specimen.getTitleCache();
153 }
154
155 /**
156 * @param titleCache the titleCache to set
157 */
158 public void setTitleCache(String titleCache) {
159 this.specimen.setTitleCache(titleCache);
160 }
161
162
163
164 }