2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.cdm
.persistence
.dao
.common
;
12 import java
.util
.Collection
;
13 import java
.util
.List
;
15 import java
.util
.UUID
;
17 import org
.springframework
.dao
.DataAccessException
;
19 import eu
.etaxonomy
.cdm
.model
.common
.CdmBase
;
22 * an data access interface that all data access classes implement
25 * @created 02-Nov-2007 19:36:10
27 public interface ICdmEntityDao
<T
extends CdmBase
> {
30 * @param transientObject
32 * @throws DataAccessException
34 public UUID
saveOrUpdate(T transientObject
) throws DataAccessException
;
36 //public UUID saveOrUpdateAll(Collection<T> transientObjects) throws DataAccessException;
39 * @param newOrManagedObject
41 * @throws DataAccessException
43 public UUID
save(T newOrManagedObject
) throws DataAccessException
;
45 public Map
<UUID
, T
> saveAll(Collection
<T
> cdmObjCollection
) throws DataAccessException
;
48 * @param transientObject
50 * @throws DataAccessException
52 public UUID
update(T transientObject
) throws DataAccessException
;
55 * @param persistentObject
57 * @throws DataAccessException
59 public UUID
delete(T persistentObject
) throws DataAccessException
;
62 * Returns a sublist of CdmBase instances stored in the database.
63 * A maximum of 'limit' objects are returned, starting at object with index 'start'.
67 * @throws DataAccessException
69 public List
<T
> list(int limit
, int start
) throws DataAccessException
;
72 * Returns a sublist of CdmBase instances of type <TYPE> stored in the database.
73 * A maximum of 'limit' objects are returned, starting at object with index 'start'.
77 * @throws DataAccessException
79 public <TYPE
extends T
> List
<TYPE
> list(Class
<TYPE
> type
, int limit
, int start
) throws DataAccessException
;
81 public List
<T
> rows(String tableName
, int limit
, int start
) throws DataAccessException
;
86 * @throws DataAccessException
88 public T
findById(int id
) throws DataAccessException
;
93 * @throws DataAccessException
95 public T
findByUuid(UUID Uuid
) throws DataAccessException
;
100 * @throws DataAccessException
102 public Boolean
exists(UUID uuid
) throws DataAccessException
;
107 * Returns the number of objects of type <TYPE> - which must extend T
112 public <TYPE
extends T
> int count(Class
<TYPE
> clazz
);