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.Collection;
|
13
|
import java.util.List;
|
14
|
import java.util.Map;
|
15
|
import java.util.UUID;
|
16
|
|
17
|
import org.hibernate.Criteria;
|
18
|
import org.hibernate.criterion.Restrictions;
|
19
|
import org.springframework.dao.DataAccessException;
|
20
|
import eu.etaxonomy.cdm.model.common.CdmBase;
|
21
|
|
22
|
/**
|
23
|
* an data access interface that all data access classes implement
|
24
|
* @author m.doering
|
25
|
* @version 1.0
|
26
|
* @created 02-Nov-2007 19:36:10
|
27
|
*/
|
28
|
public interface ICdmEntityDao<T extends CdmBase> {
|
29
|
|
30
|
/**
|
31
|
* @param transientObject
|
32
|
* @return
|
33
|
* @throws DataAccessException
|
34
|
*/
|
35
|
public UUID saveOrUpdate(T transientObject) throws DataAccessException;
|
36
|
|
37
|
//public UUID saveOrUpdateAll(Collection<T> transientObjects) throws DataAccessException;
|
38
|
|
39
|
/**
|
40
|
* @param newOrManagedObject
|
41
|
* @return
|
42
|
* @throws DataAccessException
|
43
|
*/
|
44
|
public UUID save(T newOrManagedObject) throws DataAccessException;
|
45
|
|
46
|
public Map<UUID, T> saveAll(Collection<T> cdmObjCollection) throws DataAccessException;
|
47
|
|
48
|
/**
|
49
|
* @param transientObject
|
50
|
* @return
|
51
|
* @throws DataAccessException
|
52
|
*/
|
53
|
public UUID update(T transientObject) throws DataAccessException;
|
54
|
|
55
|
/**
|
56
|
* @param persistentObject
|
57
|
* @return
|
58
|
* @throws DataAccessException
|
59
|
*/
|
60
|
public UUID delete(T persistentObject) throws DataAccessException;
|
61
|
|
62
|
/**
|
63
|
* Returns a sublist of CdmBase instances stored in the database.
|
64
|
* A maximum of 'limit' objects are returned, starting at object with index 'start'.
|
65
|
* @param limit
|
66
|
* @param start
|
67
|
* @return
|
68
|
* @throws DataAccessException
|
69
|
*/
|
70
|
public List<T> list(int limit, int start) throws DataAccessException;
|
71
|
|
72
|
/**
|
73
|
* @param id
|
74
|
* @return
|
75
|
* @throws DataAccessException
|
76
|
*/
|
77
|
public T findById(int id) throws DataAccessException;
|
78
|
|
79
|
/**
|
80
|
* @param Uuid
|
81
|
* @return
|
82
|
* @throws DataAccessException
|
83
|
*/
|
84
|
public T findByUuid(UUID Uuid) throws DataAccessException;
|
85
|
|
86
|
/**
|
87
|
* @param uuid
|
88
|
* @return
|
89
|
* @throws DataAccessException
|
90
|
*/
|
91
|
public Boolean exists(UUID uuid) throws DataAccessException;
|
92
|
|
93
|
public int count();
|
94
|
|
95
|
public int count(Class clazz);
|
96
|
|
97
|
/**
|
98
|
*
|
99
|
*/
|
100
|
public void flush();
|
101
|
|
102
|
|
103
|
|
104
|
}
|