KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > riotfamily > riot > dao > support > RiotDaoAdapter


1 /* ***** BEGIN LICENSE BLOCK *****
2  * Version: MPL 1.1
3  * The contents of this file are subject to the Mozilla Public License Version
4  * 1.1 (the "License"); you may not use this file except in compliance with
5  * the License. You may obtain a copy of the License at
6  * http://www.mozilla.org/MPL/
7  *
8  * Software distributed under the License is distributed on an "AS IS" basis,
9  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
10  * for the specific language governing rights and limitations under the
11  * License.
12  *
13  * The Original Code is Riot.
14  *
15  * The Initial Developer of the Original Code is
16  * Neteye GmbH.
17  * Portions created by the Initial Developer are Copyright (C) 2007
18  * the Initial Developer. All Rights Reserved.
19  *
20  * Contributor(s):
21  * flx
22  *
23  * ***** END LICENSE BLOCK ***** */

24 package org.riotfamily.riot.dao.support;
25
26 import java.util.Collection JavaDoc;
27 import java.util.Collections JavaDoc;
28
29 import org.riotfamily.riot.dao.ListParams;
30 import org.riotfamily.riot.dao.RiotDao;
31 import org.springframework.dao.DataAccessException;
32 import org.springframework.dao.InvalidDataAccessApiUsageException;
33
34 /**
35  * @author flx
36  * @since 6.4
37  */

38 public class RiotDaoAdapter implements RiotDao {
39
40     public Class JavaDoc getEntityClass() {
41         return null;
42     }
43
44     /**
45      * Always returns <code>-1</code>.
46      */

47     public int getListSize(Object JavaDoc parent, ListParams params)
48             throws DataAccessException {
49         
50         return -1;
51     }
52
53     /**
54      * Always returns <code>null</code>.
55      */

56     public String JavaDoc getObjectId(Object JavaDoc entity) {
57         return null;
58     }
59
60     /**
61      * Always returns <code>Collections.EMPTY_LIST</code>.
62      */

63     public Collection JavaDoc list(Object JavaDoc parent, ListParams params)
64             throws DataAccessException {
65         
66         return Collections.EMPTY_LIST;
67     }
68
69     /**
70      * Always throws an InvalidDataAccessApiUsageException.
71      */

72     public Object JavaDoc load(String JavaDoc id) throws DataAccessException {
73         throw new InvalidDataAccessApiUsageException(
74                 "Load operations are not supported by this DAO.");
75     }
76
77     /**
78      * Always throws an InvalidDataAccessApiUsageException.
79      */

80     public void save(Object JavaDoc entity, Object JavaDoc parent) throws DataAccessException {
81         throw new InvalidDataAccessApiUsageException(
82             "Save operations are not supported by this DAO.");
83     }
84
85     /**
86      * Always throws an InvalidDataAccessApiUsageException.
87      */

88     public void update(Object JavaDoc entity) throws DataAccessException {
89         throw new InvalidDataAccessApiUsageException(
90                 "Update operations are not supported by this DAO.");
91     }
92     
93     /**
94      * Always throws an InvalidDataAccessApiUsageException.
95      */

96     public void delete(Object JavaDoc entity, Object JavaDoc parent)
97             throws DataAccessException {
98         
99         throw new InvalidDataAccessApiUsageException(
100                 "Delete operations are not supported by this DAO.");
101     }
102     
103 }
104
Popular Tags