Project

General

Profile

Download (1.36 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 org.hibernate.criterion.Criterion;
15

    
16

    
17
import eu.etaxonomy.cdm.model.common.CdmBase;
18

    
19
public interface ITitledDao<T extends CdmBase> {
20
	
21
	public static enum MATCH_MODE{
22
		EXACT,
23
		BEGINNING,
24
		ANYWHERE;
25
		
26
		public String queryStringFrom(String queryString){
27
			queryString = queryString.replace('*', '%');
28
			switch(this){	
29
				case BEGINNING:
30
					return queryString+"%";			
31
				case ANYWHERE:
32
					return "%"+queryString+"%";
33
				default:
34
					return queryString;
35
			}
36
		}
37
	}
38

    
39
	/**
40
	 * @param queryString
41
	 * @return
42
	 */
43
	public List<T> findByTitle(String queryString);
44

    
45
	/**
46
	 * @param queryString
47
	 * @param sessionObject
48
	 * @return
49
	 */
50
	public List<T> findByTitle(String queryString, CdmBase sessionObject);
51
	
52
	public List<T> findByTitleAndClass(String queryString, Class<T> clazz);
53
	
54
	/**
55
	 * @param queryString
56
	 * @param matchAnywhere
57
	 * @param page
58
	 * @param pagesize
59
	 * @param criteria TODO
60
	 * @return
61
	 */
62
	public List<T> findByTitle(String queryString, MATCH_MODE matchMode, int page, int pagesize, List<Criterion> criteria);
63
	
64
}
(19-19/22)