Project

General

Profile

« Previous | Next » 

Revision c58ebc46

Added by Andreas Kohlbecker almost 8 years ago

refactoring taxonNode controllers - return dtos from the service layer, support for #5887

View differences:

cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dao/initializer/TaxonNodeAutoInitializer.java
1
// $Id$
2
/**
3
* Copyright (C) 2009 EDIT
4
* European Distributed Institute of Taxonomy
5
* http://www.e-taxonomy.eu
6
*
7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8
* See LICENSE.TXT at the top of this package for the full license terms.
9
*/
10
package eu.etaxonomy.cdm.persistence.dao.initializer;
11

  
12
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
13

  
14
/**
15
 * @author a.kohlbecker
16
 * @date 30.07.2010
17
 *
18
 */
19
public class TaxonNodeAutoInitializer extends AutoPropertyInitializer<TaxonNode> {
20

  
21
    @Override
22
    public void initialize(TaxonNode bean) {
23
       beanInitializer.initializeInstance(bean.getTaxon().getName());
24
       beanInitializer.initializeInstance(bean.getTaxon().getSec());
25
    }
26

  
27
    @Override
28
    public String hibernateFetchJoin(Class<?> clazz, String beanAlias) throws Exception{
29

  
30
        String result = "";
31
        result += String.format(" LEFT JOIN FETCH %s.taxon taxon LEFT JOIN FETCH taxon.name LEFT JOIN FETCH taxon.sec", beanAlias);
32
        return result;
33
    }
34

  
35
}
cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dto/TaxonNodeDto.java
1
// $Id$
2
/**
3
* Copyright (C) 2016 EDIT
4
* European Distributed Institute of Taxonomy
5
* http://www.e-taxonomy.eu
6
*
7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8
* See LICENSE.TXT at the top of this package for the full license terms.
9
*/
10
package eu.etaxonomy.cdm.persistence.dto;
11

  
12
import java.util.List;
13
import java.util.UUID;
14

  
15
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
16
import eu.etaxonomy.cdm.strategy.cache.TaggedText;
17

  
18
/**
19
 * @author a.kohlbecker
20
 * @date Jun 13, 2016
21
 *
22
 */
23
public class TaxonNodeDto {
24

  
25

  
26
    /**
27
     * The TaxonNode uuid
28
     */
29
    private final UUID uuid;
30

  
31
    /**
32
     * count of the direct taxonomic children
33
     */
34
    private final int taxonomicChildrenCount;
35

  
36

  
37
    /**
38
     * The UUID of the associated secundum reference
39
     */
40
    private final UUID secUuid;
41

  
42
    /**
43
     * The uuid of the associated Taxon entity
44
     */
45
    private final UUID taxonUuid;
46

  
47
    /**
48
     * the titleCache of the associated TaxonName entity
49
     */
50
    private final String titleCache;
51

  
52
    /**
53
     * the taggedTitle of the associated TaxonName entity
54
     */
55
    private final List<TaggedText> taggedTitle;
56

  
57
    /**
58
     * The unplaced flag of the Taxon entity
59
     */
60
    private final boolean unplaced;
61

  
62
    /**
63
     * The excluded flag of the Taxon entity
64
     */
65
    private final boolean excluded;
66

  
67
    /**
68
     * The Rank.label value of the rank to which the associated TaxonName entity is assigned to.
69
     */
70
    private final String rankLabel;
71

  
72
    /**
73
     * @param taxonNode
74
     */
75
    public TaxonNodeDto(TaxonNode taxonNode) {
76
        uuid = taxonNode.getUuid();
77
        taxonomicChildrenCount = taxonNode.getCountChildren();
78
        secUuid = taxonNode.getTaxon().getSec().getUuid();
79
        taxonUuid = taxonNode.getTaxon().getUuid();
80
        titleCache = taxonNode.getTaxon().getName().getTitleCache();
81
        taggedTitle = taxonNode.getTaxon().getName().getTaggedName();
82
        unplaced = taxonNode.getTaxon().isUnplaced();
83
        excluded = taxonNode.getTaxon().isExcluded();
84
        rankLabel = taxonNode.getTaxon().getName().getRank().getLabel();
85
    }
86

  
87
    /**
88
     * @return the uuid
89
     */
90
    public UUID getUuid() {
91
        return uuid;
92
    }
93

  
94
    /**
95
     * @return the taxonomicChildrenCount
96
     */
97
    public int getTaxonomicChildrenCount() {
98
        return taxonomicChildrenCount;
99
    }
100

  
101
    /**
102
     * @return the secUuid
103
     */
104
    public UUID getSecUuid() {
105
        return secUuid;
106
    }
107

  
108
    /**
109
     * @return the taxonUuid
110
     */
111
    public UUID getTaxonUuid() {
112
        return taxonUuid;
113
    }
114

  
115
    /**
116
     * @return the titleCache
117
     */
118
    public String getTitleCache() {
119
        return titleCache;
120
    }
121

  
122
    /**
123
     * @return the taggedTitle
124
     */
125
    public List<TaggedText> getTaggedTitle() {
126
        return taggedTitle;
127
    }
128

  
129
    /**
130
     * @return the unplaced
131
     */
132
    public boolean isUnplaced() {
133
        return unplaced;
134
    }
135

  
136
    /**
137
     * @return the excluded
138
     */
139
    public boolean isExcluded() {
140
        return excluded;
141
    }
142

  
143
    /**
144
     * @return the rankLabel
145
     */
146
    public String getRankLabel() {
147
        return rankLabel;
148
    }
149

  
150

  
151
}

Also available in: Unified diff