Project

General

Profile

« Previous | Next » 

Revision 580b83e6

Added by Patrick Plitzner almost 8 years ago

#5890 Add service method to get the root node for a given classification

View differences:

cdmlib-persistence/src/main/java/eu/etaxonomy/cdm/persistence/dao/taxon/IClassificationDao.java
1
/**
2
* Copyright (C) 2007 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

  
10
package eu.etaxonomy.cdm.persistence.dao.taxon;
11

  
12
import java.util.List;
13

  
14
import eu.etaxonomy.cdm.model.name.Rank;
15
import eu.etaxonomy.cdm.model.taxon.Classification;
16
import eu.etaxonomy.cdm.model.taxon.Taxon;
17
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
18
import eu.etaxonomy.cdm.persistence.dao.common.IIdentifiableDao;
19

  
20
/**
21
 * @author a.mueller
22
 *
23
 */
24
public interface IClassificationDao extends IIdentifiableDao<Classification> {
25

  
26
    /**
27
     * <p>
28
     * Lists all TaxonNodes of the specified tree for a given Rank. If a branch
29
     * does not contain a TaxonNode with a TaxonName at the given Rank the node
30
     * associated with the next lower Rank is taken as root node. If the
31
     * <code>rank</code> is null the absolute root nodes will be returned.
32
     * <p>
33
     * See <a href="http://dev.e-taxonomy.eu/trac/wiki/CdmClassificationRankSpecificRootnodes">http://dev.e-taxonomy.eu/trac/wiki/CdmClassificationRankSpecificRootnodes</a>
34
     * <p>
35
     * Since this method is using two queries which need to be run sequentially
36
     * the handling of limit and start is more complex and requires the total
37
     * count of the items matched by the first query is known. Therefore the
38
     * handling of limit and start must be managed in the service method that is
39
     * using this dao method.
40
     *
41
     * @param classification
42
     * @param rank
43
     *            may be null
44
     * @param limit
45
     *            The maximum number of objects returned (can be null for all
46
     *            matching objects)
47
     * @param start
48
     *            The offset from the start of the result set (0 - based, can be
49
     *            null - equivalent of starting at the beginning of the
50
     *            recordset)
51
     * @param propertyPaths
52
     * @param queryIndex
53
     *            0: execute first query, 1: excute second query, the second
54
     *            query is only available when parameter
55
     *            <code>rank != null</code>.
56
     * @return
57
     */
58
    public List<TaxonNode> listRankSpecificRootNodes(Classification classification, Rank rank, Integer limit, Integer start,
59
            List<String> propertyPaths, int queryIndex);
60

  
61
    public long[] countRankSpecificRootNodes(Classification classification, Rank rank);
62

  
63
    public List<TaxonNode> listChildrenOf(Taxon taxon, Classification classification, Integer pageSize, Integer pageIndex, List<String> propertyPaths);
64

  
65

  
66
    public abstract Long countChildrenOf(Taxon taxon, Classification classification);
67

  
68
    /**
69
     * @param taxon
70
     * @param classification
71
     * @param pageSize
72
     * @param pageIndex
73
     * @param propertyPaths
74
     * @return
75
     */
76
    List<TaxonNode> listSiblingsOf(Taxon taxon, Classification classification, Integer pageSize, Integer pageIndex,
77
            List<String> propertyPaths);
78

  
79
    /**
80
     * @param taxon
81
     * @param classification
82
     * @return
83
     */
84
    Long countSiblingsOf(Taxon taxon, Classification classification);
85

  
86

  
87
}
1
/**
2
* Copyright (C) 2007 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

  
10
package eu.etaxonomy.cdm.persistence.dao.taxon;
11

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

  
15
import eu.etaxonomy.cdm.model.name.Rank;
16
import eu.etaxonomy.cdm.model.taxon.Classification;
17
import eu.etaxonomy.cdm.model.taxon.Taxon;
18
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
19
import eu.etaxonomy.cdm.persistence.dao.common.IIdentifiableDao;
20

  
21
/**
22
 * @author a.mueller
23
 *
24
 */
25
public interface IClassificationDao extends IIdentifiableDao<Classification> {
26

  
27
    /**
28
     * <p>
29
     * Lists all TaxonNodes of the specified tree for a given Rank. If a branch
30
     * does not contain a TaxonNode with a TaxonName at the given Rank the node
31
     * associated with the next lower Rank is taken as root node. If the
32
     * <code>rank</code> is null the absolute root nodes will be returned.
33
     * <p>
34
     * See <a href="http://dev.e-taxonomy.eu/trac/wiki/CdmClassificationRankSpecificRootnodes">http://dev.e-taxonomy.eu/trac/wiki/CdmClassificationRankSpecificRootnodes</a>
35
     * <p>
36
     * Since this method is using two queries which need to be run sequentially
37
     * the handling of limit and start is more complex and requires the total
38
     * count of the items matched by the first query is known. Therefore the
39
     * handling of limit and start must be managed in the service method that is
40
     * using this dao method.
41
     *
42
     * @param classification
43
     * @param rank
44
     *            may be null
45
     * @param limit
46
     *            The maximum number of objects returned (can be null for all
47
     *            matching objects)
48
     * @param start
49
     *            The offset from the start of the result set (0 - based, can be
50
     *            null - equivalent of starting at the beginning of the
51
     *            recordset)
52
     * @param propertyPaths
53
     * @param queryIndex
54
     *            0: execute first query, 1: excute second query, the second
55
     *            query is only available when parameter
56
     *            <code>rank != null</code>.
57
     * @return
58
     */
59
    public List<TaxonNode> listRankSpecificRootNodes(Classification classification, Rank rank, Integer limit, Integer start,
60
            List<String> propertyPaths, int queryIndex);
61

  
62
    public long[] countRankSpecificRootNodes(Classification classification, Rank rank);
63

  
64
    public List<TaxonNode> listChildrenOf(Taxon taxon, Classification classification, Integer pageSize, Integer pageIndex, List<String> propertyPaths);
65

  
66
    public TaxonNode getRootNode(UUID classificationUuid);
67

  
68
    public abstract Long countChildrenOf(Taxon taxon, Classification classification);
69

  
70
    /**
71
     * @param taxon
72
     * @param classification
73
     * @param pageSize
74
     * @param pageIndex
75
     * @param propertyPaths
76
     * @return
77
     */
78
    List<TaxonNode> listSiblingsOf(Taxon taxon, Classification classification, Integer pageSize, Integer pageIndex,
79
            List<String> propertyPaths);
80

  
81
    /**
82
     * @param taxon
83
     * @param classification
84
     * @return
85
     */
86
    Long countSiblingsOf(Taxon taxon, Classification classification);
87

  
88

  
89
}

Also available in: Unified diff