Project

General

Profile

Download (2.85 KB) Statistics
| Branch: | Tag: | Revision:
1
package eu.etaxonomy.cdm.persistence.dao.description;
2

    
3
import java.util.List;
4

    
5
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
6
import eu.etaxonomy.cdm.model.description.TextData;
7
import eu.etaxonomy.cdm.model.media.Media;
8
import eu.etaxonomy.cdm.persistence.dao.common.IAnnotatableDao;
9
import eu.etaxonomy.cdm.persistence.dao.common.ISearchableDao;
10

    
11
public interface IDescriptionElementDao extends IAnnotatableDao<DescriptionElementBase>,ISearchableDao<DescriptionElementBase> {
12
	/**
13
	 * This query is designed to search the the descriptions. 
14
	 * This is complicated somewhat by the 1 ... n relation between
15
	 * Descriptions and their descriptionElements, and also by the language aspect
16
	 * (i.e. that every feature can be written in many languages). 
17
	 * 
18
	 * What we do here is return a list of TextData objects where 
19
	 * the partOfDescription property is hydrated
20
	 * 
21
	 * If the description is a TaxonDescription, then the Taxon and 
22
	 * is hydrated too. If the description is a TaxonNameDescription
23
	 * the TaxonName is hydrated. If the description is a SpecimenDescription, the
24
	 * specimens are hydrated
25
	 * 
26
	 * HOWEVER, until hibernate search changes the way it handles subclasses
27
	 * (i.e. indexing the properties of subclasses when the entity is only
28
	 * typed as a superclass), we'll not be able to sort by a property of the TaxonDescription without 
29
	 * a pretty nasty performance penalty (remember, we're potentially searching
30
	 * all of the textual content here, so sorting this one-to-n by description.taxon or description.
31
	 * name is a bit of a no go). 
32
	 * 
33
	 * @param queryString
34
	 * @param pageSize
35
	 * @param pageNumber
36
	 * @return
37
	 * @throws QueryParseException
38
	 */
39
	public List<TextData> searchTextData(String queryString, Integer pageSize, Integer pageNumber);
40
	
41
	/**
42
	 * Return a count of TextData elements who's content matches the query string
43
	 * 
44
	 * @param queryString a query string following Lucene Query Parser syntax
45
	 * @return a count of matching TextData elements
46
	 */
47
	public int countTextData(String queryString);
48
	
49
    /**
50
     * Returns a List of Media that are associated with a given description element
51
     * 
52
	 * @param descriptionElement the description element associated with these media
53
	 * @param pageSize The maximum number of media returned (can be null for all related media)
54
	 * @param pageNumber The offset (in pageSize chunks) from the start of the result set (0 - based)
55
     * @return a List of media instances
56
     */
57
    public List<Media> getMedia(DescriptionElementBase descriptionElement, Integer pageSize, Integer pageNumber);
58
	
59
    /**
60
     * Returns a count of Media that are associated with a given description element
61
     * 
62
	 * @param descriptionElement the description element associated with these media
63
     * @return a count of media instances
64
     */
65
	public int countMedia(DescriptionElementBase descriptionElement);
66
}
(2-2/6)