Revision 4c891790
Added by U-BGBM\k.luther over 8 years ago
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/DescriptionServiceImpl.java | ||
---|---|---|
783 | 783 |
|
784 | 784 |
} |
785 | 785 |
|
786 |
@Override |
|
787 |
@Transactional(readOnly = false) |
|
788 |
public UpdateResult moveTaxonDescription(UUID descriptionUuid, UUID targetTaxonUuid){ |
|
789 |
UpdateResult result = new UpdateResult(); |
|
790 |
TaxonDescription description = HibernateProxyHelper.deproxy(dao.load(descriptionUuid), TaxonDescription.class); |
|
791 |
|
|
792 |
Taxon sourceTaxon = description.getTaxon(); |
|
793 |
String moveMessage = String.format("Description moved from %s", sourceTaxon); |
|
794 |
if(description.isProtectedTitleCache()){ |
|
795 |
String separator = ""; |
|
796 |
if(!StringUtils.isBlank(description.getTitleCache())){ |
|
797 |
separator = " - "; |
|
798 |
} |
|
799 |
description.setTitleCache(description.getTitleCache() + separator + moveMessage, true); |
|
800 |
} |
|
801 |
Annotation annotation = Annotation.NewInstance(moveMessage, Language.getDefaultLanguage()); |
|
802 |
annotation.setAnnotationType(AnnotationType.TECHNICAL()); |
|
803 |
description.addAnnotation(annotation); |
|
804 |
Taxon targetTaxon = HibernateProxyHelper.deproxy(taxonDao.load(targetTaxonUuid), Taxon.class); |
|
805 |
targetTaxon.addDescription(description); |
|
806 |
result.addUpdatedObject(targetTaxon); |
|
807 |
result.addUpdatedObject(sourceTaxon); |
|
808 |
dao.merge(description); |
|
809 |
return result; |
|
810 |
|
|
811 |
} |
|
786 | 812 |
|
787 | 813 |
|
788 | 814 |
} |
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/IDescriptionService.java | ||
---|---|---|
601 | 601 |
public UpdateResult moveDescriptionElementsToDescription(Set<UUID> descriptionElementUUIDs, UUID targetTaxonUuid, |
602 | 602 |
String moveMessage, boolean isCopy); |
603 | 603 |
|
604 |
|
|
604 |
/** |
|
605 |
* @param descriptionUUID |
|
606 |
* @param targetTaxonUuid |
|
607 |
* @return |
|
608 |
*/ |
|
609 |
public UpdateResult moveTaxonDescription(UUID descriptionUuid, UUID targetTaxonUuid); |
|
605 | 610 |
} |
Also available in: Unified diff
move description fix