Revision 892efc69
Added by Andreas Kohlbecker almost 14 years ago
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/occurrence/SpecimenOrObservationBase.java | ||
---|---|---|
9 | 9 |
|
10 | 10 |
package eu.etaxonomy.cdm.model.occurrence; |
11 | 11 |
|
12 |
import java.lang.reflect.Method; |
|
13 | 12 |
import java.util.HashMap; |
14 | 13 |
import java.util.HashSet; |
15 | 14 |
import java.util.Map; |
... | ... | |
43 | 42 |
import org.hibernate.envers.Audited; |
44 | 43 |
import org.hibernate.search.annotations.Field; |
45 | 44 |
import org.hibernate.search.annotations.IndexedEmbedded; |
46 |
import org.springframework.util.ReflectionUtils; |
|
47 | 45 |
|
48 | 46 |
import eu.etaxonomy.cdm.jaxb.MultilanguageTextAdapter; |
49 | 47 |
import eu.etaxonomy.cdm.model.common.Language; |
... | ... | |
52 | 50 |
import eu.etaxonomy.cdm.model.description.Sex; |
53 | 51 |
import eu.etaxonomy.cdm.model.description.SpecimenDescription; |
54 | 52 |
import eu.etaxonomy.cdm.model.description.Stage; |
53 |
import eu.etaxonomy.cdm.model.description.TaxonDescription; |
|
54 |
import eu.etaxonomy.cdm.model.description.TaxonNameDescription; |
|
55 | 55 |
import eu.etaxonomy.cdm.model.media.IdentifiableMediaEntity; |
56 | 56 |
import eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy; |
57 | 57 |
|
... | ... | |
139 | 139 |
super(); |
140 | 140 |
} |
141 | 141 |
|
142 |
/** |
|
143 |
* The descriptions this specimen or observation is part of.<BR> |
|
144 |
* A specimen can not only have it's own {@link SpecimenDescription specimen description } |
|
145 |
* but can also be part of a {@link TaxonDescription taxon description} or a |
|
146 |
* {@link TaxonNameDescription taxon name description}.<BR> |
|
147 |
* @see #getSpecimenDescriptions() |
|
148 |
* @return |
|
149 |
*/ |
|
142 | 150 |
public Set<DescriptionBase> getDescriptions() { |
143 | 151 |
if(descriptions == null) { |
144 | 152 |
this.descriptions = new HashSet<DescriptionBase>(); |
145 | 153 |
} |
146 | 154 |
return this.descriptions; |
147 | 155 |
} |
156 |
|
|
157 |
/** |
|
158 |
* Returns the {@link SpecimenDescription specimen descriptions} this specimen is part of. |
|
159 |
* @see #getDescriptions() |
|
160 |
* @return |
|
161 |
*/ |
|
162 |
public Set<SpecimenDescription> getSpecimenDescriptions() { |
|
163 |
return getSpecimenDescriptions(true); |
|
164 |
} |
|
165 |
|
|
166 |
/** |
|
167 |
* Returns the {@link SpecimenDescription specimen descriptions} this specimen is part of. |
|
168 |
* @see #getDescriptions() |
|
169 |
* @return |
|
170 |
*/ |
|
171 |
public Set<SpecimenDescription> getSpecimenDescriptions(boolean includeImageGallery) { |
|
172 |
Set<SpecimenDescription> specimenDescriptions = new HashSet<SpecimenDescription>(); |
|
173 |
for (DescriptionBase descriptionBase : getDescriptions()){ |
|
174 |
if (descriptionBase.isInstanceOf(SpecimenDescription.class)){ |
|
175 |
if (includeImageGallery || descriptionBase.isImageGallery() == false){ |
|
176 |
specimenDescriptions.add(descriptionBase.deproxy(descriptionBase, SpecimenDescription.class)); |
|
177 |
} |
|
178 |
|
|
179 |
} |
|
180 |
} |
|
181 |
return specimenDescriptions; |
|
182 |
} |
|
148 | 183 |
|
149 | 184 |
/** |
150 | 185 |
* Adds a new description to this specimen or observation |
... | ... | |
227 | 262 |
|
228 | 263 |
@Override |
229 | 264 |
public String generateTitle(){ |
230 |
logger.warn("Generate title for specimen not yet implemented"); |
|
231 |
return ""; |
|
265 |
return getCacheStrategy().getTitleCache(this); |
|
232 | 266 |
} |
233 | 267 |
|
234 | 268 |
public Integer getIndividualCount() { |
... | ... | |
261 | 295 |
*/ |
262 | 296 |
@Transient |
263 | 297 |
public SpecimenOrObservationBase getOriginalUnit(){ |
298 |
logger.warn("GetOriginalUnit not yet implemented"); |
|
264 | 299 |
return null; |
265 | 300 |
} |
266 | 301 |
|
Also available in: Unified diff
merging /branches/cdmlib/SPRINT-Chichorieae1/ to trunk