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