Project

General

Profile

Revision 28f7587a

ID28f7587af433495abe3cb846bb9c7d3d8831ae34
Parent 36ba3c6e
Child 349fae93

Added by Andreas Müller almost 13 years ago

rootTaxon withMisapliedName persistence

View differences:

cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dao/hibernate/taxon/TaxonDaoHibernateImpl.java
61 61
	 * @see eu.etaxonomy.cdm.persistence.dao.taxon.ITaxonDao#getRootTaxa(eu.etaxonomy.cdm.model.reference.ReferenceBase)
62 62
	 */
63 63
	public List<Taxon> getRootTaxa(ReferenceBase sec) {
64
		return getRootTaxa(sec, CdmFetch.FETCH_CHILDTAXA(), true);
64
		return getRootTaxa(sec, CdmFetch.FETCH_CHILDTAXA(), true, false);
65 65
	}
66
	
66 67

  
67 68
	/* (non-Javadoc)
68 69
	 * @see eu.etaxonomy.cdm.persistence.dao.taxon.ITaxonDao#getRootTaxa(eu.etaxonomy.cdm.model.reference.ReferenceBase, boolean)
69 70
	 */
70
	public List<Taxon> getRootTaxa(ReferenceBase sec, CdmFetch cdmFetch, Boolean onlyWithChildren) {
71
	public List<Taxon> getRootTaxa(ReferenceBase sec, CdmFetch cdmFetch, Boolean onlyWithChildren, Boolean withMisaplications) {
71 72
		if (onlyWithChildren == null){
72 73
			onlyWithChildren = true;
73 74
		}
75
		if (withMisaplications == null){
76
			withMisaplications = true;
77
		}
74 78
		if (cdmFetch == null){
75 79
			cdmFetch = CdmFetch.NO_FETCH();
76 80
		}
......
95 99

  
96 100

  
97 101
		if (! cdmFetch.includes(CdmFetch.FETCH_CHILDTAXA())){
98
			logger.warn("no child taxa fetch qq");
102
			logger.warn("no child taxa fetch");
99 103
			//TODO overwrite LAZY (SELECT) does not work (bug in hibernate?)
100 104
			crit.setFetchMode("relationsToThisTaxon.fromTaxon", FetchMode.LAZY);
101 105
		}
102 106

  
103 107
		List<Taxon> results = new ArrayList<Taxon>();
104 108
		for(Taxon taxon : (List<Taxon>) crit.list()){
109
			//childTaxa
110
			//TODO create restriction instead
105 111
			if (onlyWithChildren == false || taxon.hasTaxonomicChildren()){
106
				results.add(taxon);
112
				if (withMisaplications == false || ! taxon.isMisappliedName()){
113
					results.add(taxon);
114
				}
107 115
			}
108 116
		}
109 117
		return results;
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dao/taxon/ITaxonDao.java
37 37
	public List<Taxon> getRootTaxa(ReferenceBase sec);
38 38

  
39 39
	
40
	
41 40
	/**
42 41
	 * Computes all Taxon instances that do not have a taxonomic parent.
43 42
	 * @param sec The concept reference that the taxon belongs to
44
	 * @param cdmFetch TODO
43
	 * @param cdmFetch not used yet !! TODO
45 44
	 * @param onlyWithChildren if true only taxa are returned that have taxonomic children. <Br>Default: true.
45
	 * @param withMisaplications if true only taxa are returned that have no isMisappliedNameFor relationship. 
46
	 * <Br>Default: true.
46 47
	 * @return The List<Taxon> of root taxa.
47 48
	 */
48
	public List<Taxon> getRootTaxa(ReferenceBase sec, CdmFetch cdmFetch,  Boolean onlyWithChildren);
49

  
49
	public List<Taxon> getRootTaxa(ReferenceBase sec, CdmFetch cdmFetch, Boolean onlyWithChildren, Boolean withMisaplications);
50
	
51
	
50 52
	/**
51 53
	 * TODO necessary? 
52 54
	 * @param pagesize max maximum number of returned taxa

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)