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
|
}
|