Revision 67518a48
Added by Andreas Müller almost 3 years ago
cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/taxon/Taxon.java | ||
---|---|---|
1709 | 1709 |
result = (Taxon)super.clone(); |
1710 | 1710 |
|
1711 | 1711 |
result.setRelationsFromThisTaxon(new HashSet<>()); |
1712 |
result.setRelationsToThisTaxon(new HashSet<>()); |
|
1712 | 1713 |
|
1713 | 1714 |
if (withTaxonRelations){ |
1714 | 1715 |
for (TaxonRelationship fromRelationship : this.getRelationsFromThisTaxon()){ |
... | ... | |
1717 | 1718 |
result.relationsFromThisTaxon.add(newRelationship); |
1718 | 1719 |
} |
1719 | 1720 |
|
1720 |
result.setRelationsToThisTaxon(new HashSet<>()); |
|
1721 | 1721 |
for (TaxonRelationship toRelationship : this.getRelationsToThisTaxon()){ |
1722 | 1722 |
TaxonRelationship newRelationship = toRelationship.clone(); |
1723 | 1723 |
newRelationship.setRelatedTo(result); |
cdmlib-services/src/test/java/eu/etaxonomy/cdm/api/service/ClassificationServiceImplTest.java | ||
---|---|---|
305 | 305 |
//test taxon sec |
306 | 306 |
assertTrue(originalTaxonSecUuids.contains(clonedTaxon.getSec().getUuid())); |
307 | 307 |
} |
308 |
commitAndStartNewTransaction(); |
|
308 | 309 |
|
309 | 310 |
//test reuse taxon |
310 | 311 |
config.setReuseTaxa(true); |
... | ... | |
325 | 326 |
//test taxon sec |
326 | 327 |
assertEquals(originalTaxon.getSec().getUuid(), clonedTaxon.getSec().getUuid()); |
327 | 328 |
} |
329 |
commitAndStartNewTransaction(); |
|
328 | 330 |
|
329 | 331 |
config.setReuseTaxa(false); //reset |
330 | 332 |
config.setRelationTypeToOldTaxon(TaxonRelationshipType.CONGRUENT_TO()); |
... | ... | |
348 | 350 |
//test taxon sec |
349 | 351 |
assertEquals(relatedOriginalTaxon.getSec().getUuid(), clonedTaxon.getSec().getUuid()); |
350 | 352 |
} |
353 |
commitAndStartNewTransaction(); |
|
354 |
|
|
351 | 355 |
} |
352 | 356 |
|
353 | 357 |
private UUID acacia_acicularis_uuid = UUID.fromString("90ad2d8f-19a9-4a10-bab3-7d1de5ce1968"); |
Also available in: Unified diff
ref #4866, ref #9228 implement subtree clone (cont., fix taxon cloning)