Revision 3be6ef3e
Added by Niels Hoffmann over 13 years ago
taxeditor-store/src/main/java/eu/etaxonomy/taxeditor/model/DescriptionHelper.java | ||
---|---|---|
47 | 47 |
import eu.etaxonomy.taxeditor.store.StoreUtil; |
48 | 48 |
|
49 | 49 |
/** |
50 |
* <p>DescriptionHelper class.</p> |
|
51 |
* |
|
50 | 52 |
* @author p.ciardelli |
51 | 53 |
* @author n.hoffmann |
52 | 54 |
* @created 02.04.2009 |
... | ... | |
57 | 59 |
/** |
58 | 60 |
* Returns whatever the element's title cache equivalent is, |
59 | 61 |
* depending on its class. |
60 |
*
|
|
61 |
* @param element |
|
62 |
* @param language |
|
63 |
* @return |
|
62 |
* |
|
63 |
* @param element a {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase} object.
|
|
64 |
* @param language a {@link eu.etaxonomy.cdm.model.common.Language} object.
|
|
65 |
* @return a {@link java.lang.String} object.
|
|
64 | 66 |
*/ |
65 | 67 |
public static String getCache(DescriptionElementBase element, |
66 | 68 |
Language language) { |
... | ... | |
101 | 103 |
/** |
102 | 104 |
* Returns whatever the element's title cache equivalent is, |
103 | 105 |
* depending on its class, using the default language. |
104 |
*
|
|
105 |
* @param element |
|
106 |
* @return |
|
106 |
* |
|
107 |
* @param element a {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase} object.
|
|
108 |
* @return a {@link java.lang.String} object.
|
|
107 | 109 |
*/ |
108 | 110 |
public static String getCache(DescriptionElementBase element) { |
109 | 111 |
return getCache(element, CdmStore.getDefaultLanguage()); |
... | ... | |
112 | 114 |
/** |
113 | 115 |
* Set whatever the element's title cache equivalent is, |
114 | 116 |
* depending on its class. |
115 |
*
|
|
116 |
* @param element |
|
117 |
* @param value |
|
118 |
* @param language |
|
117 |
* |
|
118 |
* @param element a {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase} object.
|
|
119 |
* @param value a {@link java.lang.String} object.
|
|
120 |
* @param language a {@link eu.etaxonomy.cdm.model.common.Language} object.
|
|
119 | 121 |
*/ |
120 | 122 |
public static void setCache(DescriptionElementBase element, |
121 | 123 |
String value, Language language) { |
... | ... | |
140 | 142 |
/** |
141 | 143 |
* Set whatever the element's title cache equivalent is, |
142 | 144 |
* depending on its class, using the default language. |
143 |
*
|
|
144 |
* @param element |
|
145 |
* @param value |
|
146 |
*/
|
|
145 |
* |
|
146 |
* @param element a {@link eu.etaxonomy.cdm.model.description.DescriptionElementBase} object.
|
|
147 |
* @param value a {@link java.lang.String} object.
|
|
148 |
*/ |
|
147 | 149 |
public static void setCache(DescriptionElementBase element, |
148 | 150 |
String value) { |
149 | 151 |
setCache(element, value, CdmStore.getDefaultLanguage()); |
... | ... | |
152 | 154 |
/* (non-Javadoc) |
153 | 155 |
* @see eu.etaxonomy.taxeditor.bulkeditor.referencingobjects.IReferencingObjectsService#getObjectDescription(java.lang.Object) |
154 | 156 |
*/ |
157 |
/** |
|
158 |
* <p>getObjectDescription</p> |
|
159 |
* |
|
160 |
* @param element a {@link java.lang.Object} object. |
|
161 |
* @return a {@link java.lang.String} object. |
|
162 |
*/ |
|
155 | 163 |
public static String getObjectDescription(Object element) { |
156 | 164 |
if (element instanceof IdentifiableEntity) { |
157 | 165 |
try{ |
... | ... | |
196 | 204 |
return element.toString(); |
197 | 205 |
} |
198 | 206 |
|
207 |
/** |
|
208 |
* <p>getObjectClassname</p> |
|
209 |
* |
|
210 |
* @param element a {@link java.lang.Object} object. |
|
211 |
* @return a {@link java.lang.String} object. |
|
212 |
*/ |
|
199 | 213 |
public static String getObjectClassname(Object element) { |
200 | 214 |
return element.getClass().getSimpleName(); |
201 | 215 |
} |
202 | 216 |
|
217 |
/** |
|
218 |
* <p>getFeatureNodeContainerText</p> |
|
219 |
* |
|
220 |
* @param element a {@link eu.etaxonomy.taxeditor.model.FeatureNodeContainer} object. |
|
221 |
* @return a {@link java.lang.String} object. |
|
222 |
*/ |
|
203 | 223 |
public static String getFeatureNodeContainerText(FeatureNodeContainer element) { |
204 | 224 |
return element.getFeatureNode().getFeature().getLabel(CdmStore.getDefaultLanguage()); |
205 | 225 |
} |
206 | 226 |
|
227 |
/** |
|
228 |
* <p>getQuantitativeDataText</p> |
|
229 |
* |
|
230 |
* @param element a {@link eu.etaxonomy.cdm.model.description.QuantitativeData} object. |
|
231 |
* @return a {@link java.lang.String} object. |
|
232 |
*/ |
|
207 | 233 |
public static String getQuantitativeDataText(QuantitativeData element) { |
208 | 234 |
TextData textData = quantitativeDescriptionBuilder.build(element, getLanguageList()); |
209 | 235 |
|
210 | 236 |
return textData.getText(CdmStore.getDefaultLanguage()); |
211 | 237 |
} |
212 | 238 |
|
239 |
/** |
|
240 |
* <p>getCategoricalDataText</p> |
|
241 |
* |
|
242 |
* @param element a {@link eu.etaxonomy.cdm.model.description.CategoricalData} object. |
|
243 |
* @return a {@link java.lang.String} object. |
|
244 |
*/ |
|
213 | 245 |
public static String getCategoricalDataText(CategoricalData element) { |
214 | 246 |
TextData textData = categoricalDescriptionBuilder.build(element, getLanguageList()); |
215 | 247 |
|
... | ... | |
225 | 257 |
|
226 | 258 |
|
227 | 259 |
/** |
228 |
* @param element |
|
229 |
* @return |
|
260 |
* <p>getDistributionText</p> |
|
261 |
* |
|
262 |
* @param element a {@link eu.etaxonomy.cdm.model.description.Distribution} object. |
|
263 |
* @return a {@link java.lang.String} object. |
|
230 | 264 |
*/ |
231 | 265 |
public static String getDistributionText(Distribution element) { |
232 | 266 |
|
... | ... | |
259 | 293 |
} |
260 | 294 |
|
261 | 295 |
/** |
262 |
* @param entity |
|
263 |
* @return |
|
296 |
* <p>getImageText</p> |
|
297 |
* |
|
298 |
* @param media a {@link eu.etaxonomy.cdm.model.media.Media} object. |
|
299 |
* @return a {@link java.lang.String} object. |
|
264 | 300 |
*/ |
265 | 301 |
public static String getImageText(Media media) { |
266 | 302 |
LanguageString title = media.getTitle(CdmStore.getDefaultLanguage()); |
... | ... | |
273 | 309 |
|
274 | 310 |
|
275 | 311 |
/** |
276 |
* @param element |
|
277 |
* @return |
|
312 |
* <p>getElementText</p> |
|
313 |
* |
|
314 |
* @param element a {@link eu.etaxonomy.cdm.model.description.TextData} object. |
|
315 |
* @return a {@link java.lang.String} object. |
|
278 | 316 |
*/ |
279 | 317 |
public static String getElementText(TextData element) { |
280 | 318 |
String text = null; |
... | ... | |
295 | 333 |
} |
296 | 334 |
|
297 | 335 |
/** |
298 |
* @param element |
|
299 |
* @return |
|
336 |
* <p>getTaxonInteractionText</p> |
|
337 |
* |
|
338 |
* @param element a {@link eu.etaxonomy.cdm.model.description.TaxonInteraction} object. |
|
339 |
* @return a {@link java.lang.String} object. |
|
300 | 340 |
*/ |
301 | 341 |
public static String getTaxonInteractionText(TaxonInteraction element) { |
302 | 342 |
String text = ""; |
... | ... | |
311 | 351 |
} |
312 | 352 |
|
313 | 353 |
/** |
314 |
* @param entity |
|
315 |
* @return |
|
354 |
* <p>getCommonNameText</p> |
|
355 |
* |
|
356 |
* @param commonName a {@link eu.etaxonomy.cdm.model.description.CommonTaxonName} object. |
|
357 |
* @return a {@link java.lang.String} object. |
|
316 | 358 |
*/ |
317 | 359 |
public static String getCommonNameText(CommonTaxonName commonName) { |
318 | 360 |
String name = commonName.getName(); |
... | ... | |
329 | 371 |
} |
330 | 372 |
|
331 | 373 |
/** |
332 |
* @param entity |
|
333 |
* @return |
|
374 |
* <p>getDescriptionText</p> |
|
375 |
* |
|
376 |
* @param element a {@link eu.etaxonomy.cdm.model.description.DescriptionBase} object. |
|
377 |
* @return a {@link java.lang.String} object. |
|
334 | 378 |
*/ |
335 | 379 |
public static String getDescriptionText(DescriptionBase element) { |
336 | 380 |
String text = element.getTitleCache(); |
... | ... | |
341 | 385 |
} |
342 | 386 |
|
343 | 387 |
/** |
344 |
* |
|
345 |
* @param element |
|
346 |
* @return |
|
388 |
* <p>getIndividualsAssociationText</p> |
|
389 |
* |
|
390 |
* @param element a {@link eu.etaxonomy.cdm.model.description.IndividualsAssociation} object. |
|
391 |
* @return a {@link java.lang.String} object. |
|
347 | 392 |
*/ |
348 | 393 |
public static String getIndividualsAssociationText(IndividualsAssociation element) { |
349 | 394 |
SpecimenOrObservationBase derivedUnit = element.getAssociatedSpecimenOrObservation(); |
... | ... | |
353 | 398 |
return "No text provided"; |
354 | 399 |
} |
355 | 400 |
|
401 |
/** |
|
402 |
* <p>getLabel</p> |
|
403 |
* |
|
404 |
* @param element a {@link java.lang.Object} object. |
|
405 |
* @return a {@link java.lang.String} object. |
|
406 |
*/ |
|
356 | 407 |
public static String getLabel(Object element){ |
357 | 408 |
if (element instanceof FeatureNodeContainer){ |
358 | 409 |
return getFeatureNodeContainerText((FeatureNodeContainer) element); |
Also available in: Unified diff
performed javacscript:fix and worked on documentation