Revision 6d6a18ad
Added by Andreas Kohlbecker over 5 years ago
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/dto/RegistrationDTO.java | ||
---|---|---|
32 | 32 |
import eu.etaxonomy.cdm.model.name.TypeDesignationBase; |
33 | 33 |
import eu.etaxonomy.cdm.model.reference.INomenclaturalReference; |
34 | 34 |
import eu.etaxonomy.cdm.model.reference.Reference; |
35 |
import eu.etaxonomy.cdm.model.reference.ReferenceType; |
|
35 | 36 |
import eu.etaxonomy.cdm.ref.EntityReference; |
36 | 37 |
import eu.etaxonomy.cdm.ref.TypedEntityReference; |
37 | 38 |
import eu.etaxonomy.cdm.strategy.cache.TagEnum; |
... | ... | |
63 | 64 |
|
64 | 65 |
private List<TaggedText> summaryTaggedText; |
65 | 66 |
|
67 |
private String nomenclaturalCitationString; |
|
68 |
|
|
69 |
private String bibliographicCitationString; |
|
70 |
|
|
71 |
private String bibliographicInRefCitationString; |
|
72 |
|
|
66 | 73 |
|
67 | 74 |
/** |
68 | 75 |
* @param reg |
... | ... | |
116 | 123 |
break; |
117 | 124 |
} |
118 | 125 |
|
119 |
// trigger initialization of the reference
|
|
120 |
getNomenclaturalCitationString();
|
|
126 |
makeBibliographicCitationStrings();
|
|
127 |
makeNomenclaturalCitationString();
|
|
121 | 128 |
|
122 | 129 |
} |
123 | 130 |
|
... | ... | |
134 | 141 |
citation = publication; |
135 | 142 |
// create a TypeDesignationSetManager with only a reference to the typifiedName for validation |
136 | 143 |
typeDesignationManager = new TypeDesignationSetManager(typifiedName); |
144 |
makeBibliographicCitationStrings(); |
|
145 |
makeNomenclaturalCitationString(); |
|
137 | 146 |
} |
138 | 147 |
|
139 | 148 |
/** |
... | ... | |
251 | 260 |
} else { |
252 | 261 |
throw new Exception("Can not set the citation on a non emtpy RegistrationDTO"); |
253 | 262 |
} |
263 |
makeBibliographicCitationStrings(); |
|
264 |
makeNomenclaturalCitationString(); |
|
254 | 265 |
} |
255 | 266 |
|
256 | 267 |
|
... | ... | |
279 | 290 |
*/ |
280 | 291 |
public TypeDesignationWorkingSet getTypeDesignationWorkingSet(TypedEntityReference baseEntityReference) { |
281 | 292 |
return typeDesignationManager != null ? typeDesignationManager.getOrderdTypeDesignationWorkingSets().get(baseEntityReference) : null; |
282 |
|
|
283 | 293 |
} |
284 | 294 |
|
285 | 295 |
/** |
... | ... | |
321 | 331 |
return typeDesignationManager != null ? typeDesignationManager.getTypeDesignations() : null; |
322 | 332 |
} |
323 | 333 |
|
324 |
/** |
|
325 |
* @return the citationString |
|
326 |
*/ |
|
327 |
public String getNomenclaturalCitationString() { |
|
334 |
private void makeNomenclaturalCitationString() { |
|
328 | 335 |
if(citation == null){ |
329 |
return null; |
|
330 |
} |
|
331 |
if(INomenclaturalReference.class.isAssignableFrom(citation.getClass())){ |
|
332 |
return ((INomenclaturalReference)citation).getNomenclaturalCitation(citationDetail); |
|
336 |
nomenclaturalCitationString = null; |
|
333 | 337 |
} else { |
334 |
logger.error("The citation is not a NomenclaturalReference"); |
|
335 |
return citation.generateTitle(); |
|
338 |
if(INomenclaturalReference.class.isAssignableFrom(citation.getClass())){ |
|
339 |
nomenclaturalCitationString = ((INomenclaturalReference)citation).getNomenclaturalCitation(citationDetail); |
|
340 |
} else { |
|
341 |
logger.error("The citation is not a NomenclaturalReference"); |
|
342 |
nomenclaturalCitationString = citation.generateTitle(); |
|
343 |
} |
|
336 | 344 |
} |
337 | 345 |
} |
338 | 346 |
|
339 |
/** |
|
340 |
* @return the citationString |
|
341 |
*/ |
|
342 |
public String getBibliographicCitationString() { |
|
347 |
private void makeBibliographicCitationStrings() { |
|
343 | 348 |
if(citation == null){ |
344 |
return null;
|
|
349 |
bibliographicCitationString = null;
|
|
345 | 350 |
} else { |
351 |
Reference bibliographicCitation; |
|
352 |
String bibliographicCitationDetail = citationDetail; |
|
353 |
if((citation.getType() == ReferenceType.Section || citation.getType() == ReferenceType.BookSection) && citation.getInReference() != null){ |
|
354 |
bibliographicCitation = citation.getInReference(); |
|
355 |
bibliographicCitationDetail = null; // can possibly be known once https://dev.e-taxonomy.eu/redmine/issues/6623 is solved |
|
356 |
} else { |
|
357 |
bibliographicCitation = citation; |
|
358 |
} |
|
359 |
if(StringUtils.isNotEmpty(bibliographicCitationDetail)){ |
|
360 |
// TODO see https://dev.e-taxonomy.eu/redmine/issues/6623 |
|
361 |
bibliographicInRefCitationString = bibliographicCitation.generateTitle().replaceAll("\\.$", "") + (StringUtils.isNotEmpty(bibliographicCitationDetail) ? ": " + bibliographicCitationDetail : ""); |
|
362 |
} else { |
|
363 |
bibliographicInRefCitationString = bibliographicCitation.generateTitle(); |
|
364 |
} |
|
346 | 365 |
if(StringUtils.isNotEmpty(citationDetail)){ |
347 | 366 |
// TODO see https://dev.e-taxonomy.eu/redmine/issues/6623 |
348 |
return citation.generateTitle().replaceAll("\\.$", "") + (StringUtils.isNotEmpty(citationDetail) ? ": " + citationDetail : "");
|
|
367 |
bibliographicCitationString = citation.generateTitle().replaceAll("\\.$", "") + (StringUtils.isNotEmpty(citationDetail) ? ": " + citationDetail : "");
|
|
349 | 368 |
} else { |
350 |
return citation.generateTitle(); |
|
351 |
|
|
369 |
bibliographicCitationString = citation.generateTitle(); |
|
352 | 370 |
} |
353 |
|
|
371 |
|
|
354 | 372 |
} |
355 | 373 |
} |
356 | 374 |
|
375 |
/** |
|
376 |
* The nomenclatural citation is always the nomenclaturalCitation of the reference which is directly |
|
377 |
* associated with the registration. |
|
378 |
* <p> |
|
379 |
* <b>Note:</b>Compare with {@link #getBibliographicCitationString()} |
|
380 |
* |
|
381 |
* @return the nomenclaturalCitationString |
|
382 |
*/ |
|
383 |
public String getNomenclaturalCitationString() { |
|
384 |
return nomenclaturalCitationString; |
|
385 |
} |
|
386 |
|
|
387 |
/** |
|
388 |
* The bibliographic in-reference citation is either taken from the reference which is directly |
|
389 |
* associated with the registration. In case this reference is a {@link eu.etaxonomy.cdm.model.reference.ReferenceType#Section} or |
|
390 |
* {@link eu.etaxonomy.cdm.model.reference.ReferenceType#BookSection} the inReference will be taken instead. |
|
391 |
* <p> |
|
392 |
* <b>Note:</b>Compare with {@link #getBibliographicCitationString()} |
|
393 |
* |
|
394 |
* @return the bibliographicInRefCitationString |
|
395 |
*/ |
|
396 |
public String getBibliographicInRefCitationString() { |
|
397 |
return bibliographicInRefCitationString; |
|
398 |
} |
|
399 |
|
|
400 |
/** |
|
401 |
* The bibliographic citation is either reference which is directly |
|
402 |
* associated with the registration. |
|
403 |
* <p> |
|
404 |
* <b>Note:</b>Compare with {@link #getBibliographicInRefCitationString()} |
|
405 |
* |
|
406 |
* @return the bibliographicCitationString |
|
407 |
*/ |
|
408 |
public String getBibliographicCitationString() { |
|
409 |
return bibliographicCitationString; |
|
410 |
} |
|
411 |
|
|
357 | 412 |
public boolean isBlocked() { |
358 | 413 |
return reg.getBlockedBy() != null && !reg.getBlockedBy().isEmpty(); |
359 | 414 |
} |
Also available in: Unified diff
ref #7977 adding bibliographic in-reference citation to the RegistrationDTO