Revision c7378b10
Added by Andreas Kohlbecker over 2 years ago
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dao/initializer/TaxonAutoInitializer.java | ||
---|---|---|
1 |
/** |
|
2 |
* Copyright (C) 2009 EDIT |
|
3 |
* European Distributed Institute of Taxonomy |
|
4 |
* http://www.e-taxonomy.eu |
|
5 |
* |
|
6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
8 |
*/ |
|
9 |
package eu.etaxonomy.cdm.persistence.dao.initializer; |
|
10 |
|
|
11 |
import java.util.Optional; |
|
12 |
|
|
13 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
|
14 |
|
|
15 |
/** |
|
16 |
* Initializes the {@link Taxon#getTaxonNodes() taxonNodes}, which is required for |
|
17 |
* @{link {@link Taxon#isMisapplicationOnly()}, |
|
18 |
* see https://dev.e-taxonomy.eu/redmine/issues/9797 |
|
19 |
* <p> |
|
20 |
* <b>NOTE:</b> <code>Taxon.name</code> and <code>Taxon.sec</code> are initialized by the {@link TaxonNodeAutoInitializer} |
|
21 |
* <p> |
|
22 |
* |
|
23 |
* |
|
24 |
* @author a.kohlbecker |
|
25 |
* @since 30.07.2010 |
|
26 |
*/ |
|
27 |
public class TaxonAutoInitializer extends AutoPropertyInitializer<Taxon> { |
|
28 |
|
|
29 |
@Override |
|
30 |
public void initialize(Taxon bean) { |
|
31 |
beanInitializer.initializeInstance(bean.getTaxonNodes()); |
|
32 |
} |
|
33 |
|
|
34 |
@Override |
|
35 |
public Optional<String> hibernateFetchJoin(Class<?> clazz, String beanAlias){ |
|
36 |
|
|
37 |
String result = ""; |
|
38 |
result += String.format(" LEFT JOIN FETCH %s.taxonNodes tn ", beanAlias); |
|
39 |
return Optional.of(result); |
|
40 |
} |
|
41 |
|
|
42 |
} |
cdmlib-persistence/src/main/resources/eu/etaxonomy/cdm/persistence.xml | ||
---|---|---|
47 | 47 |
<bean id="mediaAutoInitializer" class="eu.etaxonomy.cdm.persistence.dao.initializer.MediaAutoInitializer"></bean> |
48 | 48 |
<bean id="typeDesignationAutoInitializer" class="eu.etaxonomy.cdm.persistence.dao.initializer.TypeDesignationAutoInitializer"></bean> |
49 | 49 |
<bean id="teamAutoInitializer" class="eu.etaxonomy.cdm.persistence.dao.initializer.TeamAutoInitializer"></bean> |
50 |
<bean id="taxonAutoInitializer" class="eu.etaxonomy.cdm.persistence.dao.initializer.TaxonAutoInitializer"></bean> |
|
50 | 51 |
|
51 | 52 |
<bean id="defaultBeanInitializer" class="eu.etaxonomy.cdm.persistence.dao.initializer.AdvancedBeanInitializer"> |
52 | 53 |
<!-- |
cdmlib-remote/src/main/java/eu/etaxonomy/cdm/remote/controller/TaxonPortalController.java | ||
---|---|---|
114 | 114 |
"$", |
115 | 115 |
"sources", |
116 | 116 |
"statusNote", |
117 |
// taxon relations, see TaxonRelationshipBeanProcessor |
|
118 |
"relationsFromThisTaxon.toTaxon.taxonNodes", |
|
119 |
"relationsToThisTaxon.fromTaxon.taxonNodes", |
|
117 |
"relationsFromThisTaxon.toTaxon.secSource.citation.authorship", |
|
118 |
"relationsFromThisTaxon.toTaxon.secSource.citation.inReference.authorship", |
|
119 |
"relationsToThisTaxon.fromTaxon.secSource.citation.authorship", |
|
120 |
"relationsToThisTaxon.fromTaxon.secSource.citation.inReference.authorship", |
|
120 | 121 |
// the name |
121 | 122 |
"name.$", |
122 | 123 |
"name.nomenclaturalSource.citation.authorship", |
Also available in: Unified diff
ref #9797 introducing TaxonAutoInitializer to init taxonNodes and adapting init strategies