1
2
3
4
5 package org.flowfuse.base.dao;
6
7 import java.io.Serializable;
8 import java.util.List;
9
10 /***
11 * Data Access Object (Dao) interface. This is an interface
12 * used to tag our Dao classes and to provide common methods to all DAOs.
13 *
14 * @author <a href="stefan@flowfuse.org">Stefan Kleineikenscheidt</a>,
15 * Flowfuse.org
16 * @version $Id: Dao.java,v 1.1 2005/11/20 15:01:58 skleinei Exp $
17 */
18 public interface Dao {
19
20
21 public final static String rcsid = "$Id: Dao.java,v 1.1 2005/11/20 15:01:58 skleinei Exp $";
22
23 /***
24 * Generic method used to get all objects of a particular type. This
25 * is the same as lookup up all rows in a table.
26 * @param clazz the type of objects (a.k.a. while table) to get data from
27 * @return List of populated objects
28 */
29 public List getObjects(Class clazz);
30
31 /***
32 * Generic method to get an object based on class and identifier. An
33 * ObjectRetrievalFailureException Runtime Exception is thrown if
34 * nothing is found.
35 *
36 * @param clazz model class to lookup
37 * @param id the identifier (primary key) of the class
38 * @return a populated object
39 * @see org.springframework.orm.ObjectRetrievalFailureException
40 */
41 public Object getObject(Class clazz, Serializable id);
42
43 /***
44 * Generic method to save an object - handles both update and insert.
45 * @param o the object to save
46 */
47 public void saveObject(Object o);
48
49 /***
50 * Generic method to delete an object based on class and id
51 * @param clazz model class to lookup
52 * @param id the identifier (primary key) of the class
53 */
54 public void removeObject(Class clazz, Serializable id);
55
56
57
58 }
59
60