View Javadoc

1   /*
2    * EL4J, the Extension Library for the J2EE, adds incremental enhancements to
3    * the spring framework, http://el4j.sf.net
4    * Copyright (C) 2006 by ELCA Informatique SA, Av. de la Harpe 22-24,
5    * 1000 Lausanne, Switzerland, http://www.elca.ch
6    *
7    * EL4J is published under the GNU Lesser General Public License (LGPL)
8    * Version 2.1. See http://www.gnu.org/licenses/
9    *
10   * This program is distributed in the hope that it will be useful,
11   * but WITHOUT ANY WARRANTY; without even the implied warranty of
12   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13   * GNU Lesser General Public License for more details.
14   *
15   * For alternative licensing, please contact info@elca.ch
16   */
17  
18  package ch.elca.el4j.tests.services.persistence.generic.dao;
19  
20  import java.lang.reflect.ParameterizedType;
21  import java.util.Collection;
22  import java.util.List;
23  
24  import org.springframework.dao.DataAccessException;
25  import org.springframework.dao.DataIntegrityViolationException;
26  import org.springframework.dao.DataRetrievalFailureException;
27  import org.springframework.dao.OptimisticLockingFailureException;
28  
29  import ch.elca.el4j.services.persistence.generic.dao.GenericDao;
30  import ch.elca.el4j.services.search.QueryObject;
31  
32  /**
33   * Just has all empty methods of the generic dao interface
34   *  (for testing convenience)
35   *  
36   * @svnLink $Revision: 3874 $;$Date: 2009-08-04 14:25:40 +0200 (Di, 04. Aug 2009) $;$Author: swismer $;$URL: https://el4j.svn.sourceforge.net/svnroot/el4j/branches/el4j_3_1/el4j/framework/modules/core/src/test/java/ch/elca/el4j/tests/services/persistence/generic/dao/DummyDao.java $
37   *
38   * @author pos
39   */
40  public class DummyDao<T> implements GenericDao<T>{
41  
42  	private Class<T> m_persistentClass;
43  
44  	@SuppressWarnings("unchecked")
45  		public DummyDao() {
46  			this.m_persistentClass = (Class<T>) ((ParameterizedType) getClass()
47  				.getGenericSuperclass()).getActualTypeArguments()[0];
48  		}
49  	
50  	public void delete(Collection<T> entities)
51  			throws OptimisticLockingFailureException, DataAccessException {
52  	}
53  
54  	public List<T> findByQuery(QueryObject q) throws DataAccessException {
55  		return null;
56  	}
57  
58  	public int findCountByQuery(QueryObject query) throws DataAccessException {
59  		return 0;
60  	}
61  
62  	public List<T> getAll() throws DataAccessException {
63  		return null;
64  	}
65  
66  	public Class<T> getPersistentClass() {
67  		return m_persistentClass;
68  	}
69  	
70  	public void setPersistentClass(Class<T> c) {
71  		m_persistentClass = c;
72  	}
73  
74  	public T refresh(T entity) throws DataAccessException,
75  			DataRetrievalFailureException {
76  		return null;
77  	}
78  
79  	public T saveOrUpdate(T entity) throws DataAccessException,
80  			DataIntegrityViolationException, OptimisticLockingFailureException {
81  		return null;
82  	}
83  
84  	public T reload(T entity) throws DataAccessException, DataRetrievalFailureException {
85  		return null;
86  	}
87  
88  }