Project

General

Profile

« Previous | Next » 

Revision 26b622f7

Added by Andreas Müller about 13 years ago

bugfix for descriptionBase.clone #2234

View differences:

cdmlib-model/src/main/java/eu/etaxonomy/cdm/model/description/DescriptionBase.java
18 18
import javax.persistence.InheritanceType;
19 19
import javax.persistence.JoinTable;
20 20
import javax.persistence.ManyToMany;
21
import javax.persistence.ManyToOne;
22 21
import javax.persistence.OneToMany;
23 22
import javax.persistence.Transient;
24
import javax.validation.constraints.NotNull;
25 23
import javax.xml.bind.annotation.XmlAccessType;
26 24
import javax.xml.bind.annotation.XmlAccessorType;
27 25
import javax.xml.bind.annotation.XmlElement;
......
35 33
import org.hibernate.annotations.Cascade;
36 34
import org.hibernate.annotations.CascadeType;
37 35
import org.hibernate.envers.Audited;
38
import org.hibernate.search.annotations.IndexedEmbedded;
39 36

  
40 37
import eu.etaxonomy.cdm.model.common.IdentifiableEntity;
41 38
import eu.etaxonomy.cdm.model.name.NameRelationship;
......
45 42
import eu.etaxonomy.cdm.model.reference.Reference;
46 43
import eu.etaxonomy.cdm.model.taxon.Taxon;
47 44
import eu.etaxonomy.cdm.strategy.cache.common.IIdentifiableEntityCacheStrategy;
48
import eu.etaxonomy.cdm.validation.Level2;
49 45

  
50 46
/**
51 47
 * The upmost (abstract) class for a description as a whole (with possibly
......
397 393
				result.descriptiveSystem.add(feature);
398 394
			}
399 395
			
396
			//working set
397
			result.workingSets = new HashSet<WorkingSet>();
398
			for (WorkingSet workingSet : getWorkingSets()){
399
				workingSet.addDescription(result);
400
			}
401
			
400 402
			//descriptions
401 403
			result.descriptionSources = new HashSet<Reference>();
402 404
			for (Reference reference : getDescriptionSources()){
cdmlib-persistence/src/test/java/eu/etaxonomy/cdm/persistence/dao/hibernate/description/DescriptionDaoHibernateImplTest.java
328 328
		assertEquals("getDescriptionElementForTaxon should return 1 elements",1,elements3.size());
329 329
	}
330 330
	
331
	@Test
332
	public void testSaveClonedDescription() {
333
		Taxon taxon = Taxon.NewInstance(null, null);
334
		TaxonDescription description = TaxonDescription.NewInstance(taxon);
335
		this.descriptionDao.save(description);
336
		TaxonDescription clonedDescription = (TaxonDescription)description.clone();
337
		this.descriptionDao.save(clonedDescription);
338
	}
339
	
331 340
}
cdmlib-persistence/src/test/resources/eu/etaxonomy/cdm/persistence/dao/hibernate/description/DescriptionDaoHibernateImplTest.xml
193 193
  <TAXONNAMEBASE DTYPE="ZoologicalName" ID="36" CREATED="2008-12-10 09:56:07.0" UUID="7969821b-a2cf-4d01-95ec-6a5ed0ca3f69" UPDATED="2008-12-10 09:56:07.238" TITLECACHE="Acherontia lachesis (Fabricius, 1798)" PROTECTEDTITLECACHE="true" PARSINGPROBLEM="0" FULLTITLECACHE="" PROBLEMENDS="-1" PROBLEMSTARTS="-1" PROTECTEDFULLTITLECACHE="true" AUTHORSHIPCACHE="(Fabricius, 1798)" NAMECACHE="Acherontia lachesis" PROTECTEDAUTHORSHIPCACHE="true" PROTECTEDNAMECACHE="true" ANAMORPHIC="false"  BINOMHYBRID="false" HYBRIDFORMULA="false" MONOMHYBRID="false" TRINOMHYBRID="false" HOMOTYPICALGROUP_ID="35" RANK_ID="765" GENUSORUNINOMIAL="Acherontia" SPECIFICEPITHET="lachesis" NOMENCLATURALREFERENCE_ID="1"/>
194 194
  <TAXONNAMEBASE DTYPE="ZoologicalName" ID="37" CREATED="2008-12-10 09:56:07.0" UUID="61b1dcae-8aa6-478a-bcd6-080cf0eb6ad7" UPDATED="2008-12-10 09:56:07.238" TITLECACHE="Acherontia styx Westwood, 1847" PROTECTEDTITLECACHE="true" PARSINGPROBLEM="0" FULLTITLECACHE="" PROBLEMENDS="-1" PROBLEMSTARTS="-1" PROTECTEDFULLTITLECACHE="true" AUTHORSHIPCACHE="Westwood, 1847" NAMECACHE="Acherontia styx" PROTECTEDAUTHORSHIPCACHE="true" PROTECTEDNAMECACHE="true" ANAMORPHIC="false"  BINOMHYBRID="false" HYBRIDFORMULA="false" MONOMHYBRID="false" TRINOMHYBRID="false" HOMOTYPICALGROUP_ID="36" RANK_ID="765" GENUSORUNINOMIAL="Acherontia" SPECIFICEPITHET="styx" NOMENCLATURALREFERENCE_ID="1"/>
195 195
  <TAXONNAMEBASE DTYPE="BotanicalName" ID="38" CREATED="2008-12-10 09:56:07.0" UUID="c9e7124b-2e60-4df2-996c-b7d024c85d33" UPDATED="2008-12-10 09:56:07.238" TITLECACHE="Cryptocoryne x purpurea nothovar borneoensis N.Jacobsen, Bastm. &amp; Yuji Sasaki" PROTECTEDTITLECACHE="true" PARSINGPROBLEM="0" FULLTITLECACHE="" PROBLEMENDS="-1" PROBLEMSTARTS="-1" PROTECTEDFULLTITLECACHE="true" AUTHORSHIPCACHE="N.Jacobsen, Bastm. &amp; Yuji Sasaki" NAMECACHE="Cryptocoryne x purpurea nothovar borneoensis" PROTECTEDAUTHORSHIPCACHE="true" PROTECTEDNAMECACHE="true" ANAMORPHIC="false" BINOMHYBRID="true" HYBRIDFORMULA="false" MONOMHYBRID="false" TRINOMHYBRID="false" HOMOTYPICALGROUP_ID="37" RANK_ID="761" GENUSORUNINOMIAL="Cryptocoryne" SPECIFICEPITHET="purpurea" INFRASPECIFICEPITHET="borneoensis" NOMENCLATURALREFERENCE_ID="1"/>
196
  <HIBERNATE_SEQUENCES SEQUENCE_NAME="TaxonBase" NEXT_VAL="100"/>  
197
  <HIBERNATE_SEQUENCES SEQUENCE_NAME="DescriptionBase" NEXT_VAL="100"/>  
198
  
196 199
</dataset>

Also available in: Unified diff