Project

General

Profile

Download (6.28 KB) Statistics
| Branch: | Tag: | Revision:
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.common;
11

    
12
import java.util.List;
13

    
14
import eu.etaxonomy.cdm.model.common.AnnotatableEntity;
15
import eu.etaxonomy.cdm.model.common.Annotation;
16
import eu.etaxonomy.cdm.model.common.Marker;
17
import eu.etaxonomy.cdm.model.common.MarkerType;
18
import eu.etaxonomy.cdm.persistence.dao.initializer.IBeanInitializer;
19
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
20
import eu.etaxonomy.cdm.persistence.query.OrderHint;
21

    
22
/**
23
 * @author n.hoffmann
24
 * @created 24.09.2008
25
 * @version 1.0
26
 */
27
public interface IAnnotatableDao<T extends AnnotatableEntity> extends IVersionableDao<T>{
28

    
29
	/**
30
	 * Returns a List of Annotations belonging to the supplied AnnotatableEntity
31
	 *
32
	 * @param annotatableEntity the entity which is annotated
33
	 * @param status The status of the annotations (null to return annotations regardless of status)
34
	 * @param pageSize The maximum number of annotations returned (can be null for all annotations)
35
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
36
	 * @param orderHints may be null
37
	 * @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
38
	 * @return a List of Annotation instances
39
	 */
40
    public List<Annotation> getAnnotations(T annotatableEntity, MarkerType status, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
41

    
42
    /**
43
	 * Returns a count of Annotations belonging to the supplied AnnotatableEntity
44
	 *
45
	 * @param annotatableEntity the entity which is annotated
46
	 * @param status The status of the annotations (null to count all annotations regardless of status)
47
	 * @return a count of Annotation instances
48
	 */
49
	public int countAnnotations(T annotatableEntity, MarkerType status);
50

    
51
	/**
52
	 * Returns a count of Markers belonging to the supplied AnnotatableEntity
53
	 *
54
	 * @param annotatableEntity the entity which is marked
55
	 * @param technical The type of MarkerTypes to consider (null to count all markers, regardless of whether the makerType is technical or not)
56
	 * @return a count of Marker instances
57
	 */
58
	public int countMarkers(T annotatableEntity, Boolean technical);
59

    
60
	/**
61
	 *
62
	 * @param annotatableEntity the entity which is marked
63
	 * @param technical The type of MarkerTypes to consider (null to count all markers, regardless of whether the makerType is technical or not)
64
	 * @param pageSize The maximum number of markers returned (can be null for all markers)
65
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
66
	 * @param orderHints may be null
67
	 * @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
68
	 * @return a List of Marker instances
69
	 */
70
	public List<Marker> getMarkers(T annotatableEntity, Boolean technical, Integer pageSize, Integer pageNumber, List<OrderHint> orderHints, List<String> propertyPaths);
71
	/**
72
	 * Returns a list of arrays representing counts of entities of type clazz, grouped by their markerTypes. The arrays have two elements.
73
	 * The first element is the MarkerType, initialized using the propertyPaths parameter. The second element is the count of all markers of Objects
74
	 * of type clazz with that MarkerType. The boolean technical can be used to choose only technical or only non-technical marker types. The list is sorted by
75
	 * titleCache of the markerType, in ascending order.
76
	 *
77
	 * @param clazz optionally restrict the markers to those belonging to this class
78
	 * @param technical The type of MarkerTypes to consider (null to count all markers, regardless of whether the makerType is technical or not)
79
	 * @param pageSize The maximum number of arrays returned (can be null for all arrays)
80
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
81
	 * @param propertyPaths properties to initialize - see {@link IBeanInitializer#initialize(Object, List)}
82
	 * @return
83
	 */
84
	public List<Object[]> groupMarkers(Class<? extends T> clazz, Boolean technical, Integer pageSize, Integer pageNumber, List<String> propertyPaths);
85

    
86
	/**
87
	 * returns a count of all markers belonging to that clazz, optionally filtered to include only technical or only non-technical markers.
88
	 *
89
	 * @param clazz optionally restrict the markers to those belonging to this class
90
	 * @param technical The type of MarkerTypes to consider (null to count all markers, regardless of whether the makerType is technical or not)
91
	 * @return a count of markers
92
	 */
93
	public int countMarkers(Class<? extends T> clazz, Boolean technical);
94

    
95
    /**
96
     * Return a list of all uuids mapped to titleCache in the convenient <code>UuidAndTitleCache</code> object.
97
     * Retrieving this list is considered to be significantly faster than initializing the fully fledged buiseness
98
     * objects. To be used in cases where you want to present large amount of data and provide details after
99
     * a selection has been made.
100
     *
101
     * @return a list of <code>UuidAndTitleCache</code> instances
102
     * @see #getUuidAndTitleCache(Class, Integer, String)
103
     */
104
    public List<UuidAndTitleCache<T>> getUuidAndTitleCache(Integer limit, String pattern);
105

    
106
    /**
107
     * Like {@link #getUuidAndTitleCache(Integer, String)} but searching only on a subclass
108
     * of the type handled by the DAO.
109
     *
110
     * @param clazz the (sub)class
111
     * @param limit max number of results
112
     * @param pattern search pattern
113

    
114
     * @see #getUuidAndTitleCache(Integer, String)
115
     */
116
    public <S extends T> List<UuidAndTitleCache<S>> getUuidAndTitleCache(Class<S> clazz, Integer limit, String pattern);
117

    
118

    
119
    /**
120
     * Return a list of all uuids mapped to titleCache in the convenient <code>UuidAndTitleCache</code> object.
121
     * Retrieving this list is considered to be significantly faster than initializing the fully fledged buiseness
122
     * objects. To be used in cases where you want to present large amount of data and provide details after
123
     * a selection has been made.
124
     *
125
     * @return a list of <code>UuidAndTitleCache</code> instances
126
     */
127
    public List<UuidAndTitleCache<T>> getUuidAndTitleCache();
128
}
(2-2/27)