View Javadoc

1   /*
2   Copyright 2010 James Pether Sörling Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. 
3   	$Id
4   */
5   /*
6    @author Pether Sorling
7    */
8   
9   package org.directdemocracyportal.democracy.service.dao;
10  
11  import java.io.Serializable;
12  import java.util.List;
13  
14  import org.directdemocracyportal.democracy.model.core.BaseEntity;
15  import org.springframework.dao.DataAccessException;
16  
17  // TODO: Auto-generated Javadoc
18  /***
19   * The Interface GenericDAO.
20   *
21   * @param <T> the generic type
22   * @param <ID> the generic type
23   */
24  public abstract interface GenericDAO<T extends BaseEntity, ID extends Serializable>
25  {
26  
27      /***
28       * Load.
29       *
30       * @param id the id
31       * @return the t
32       * @throws DataAccessException the data access exception
33       */
34      public T load(ID id) throws DataAccessException;
35  
36      /***
37       * Save.
38       *
39       * @param entity the entity
40       * @return the t
41       * @throws DataAccessException the data access exception
42       */
43      public T save(T entity) throws DataAccessException;
44  
45      /***
46       * Delete.
47       *
48       * @param entity the entity
49       * @throws DataAccessException the data access exception
50       */
51      public void delete(T entity) throws DataAccessException;
52  
53      /***
54       * Gets the all.
55       *
56       * @return the all
57       * @throws DataAccessException the data access exception
58       */
59      public List<T> getAll() throws DataAccessException;
60  }