001: /*
002: * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com> and
003: * JR Boyens <gnu-jrb[remove] at gmx dot net>
004: * Distributed under the terms of either:
005: * - the common development and distribution license (CDDL), v1.0; or
006: * - the GNU Lesser General Public License, v2.1 or later
007: * $Id: GenericQueryManagerDelegate.java 3634 2007-01-08 21:42:24Z gbevin $
008: */
009: package com.uwyn.rife.database.querymanagers.generic;
010:
011: import com.uwyn.rife.database.Datasource;
012: import com.uwyn.rife.database.DbRowProcessor;
013: import com.uwyn.rife.database.exceptions.DatabaseException;
014: import com.uwyn.rife.database.queries.CreateTable;
015: import com.uwyn.rife.site.Validated;
016: import java.util.List;
017:
018: public class GenericQueryManagerDelegate<T> implements
019: GenericQueryManager<T> {
020: private Datasource mDatasource = null;
021: private GenericQueryManager<T> mDelegate = null;
022:
023: public GenericQueryManagerDelegate(Datasource datasource,
024: Class<T> klass, String table) {
025: mDatasource = datasource;
026: mDelegate = GenericQueryManagerFactory.getInstance(datasource,
027: klass, table);
028: }
029:
030: public GenericQueryManagerDelegate(Datasource datasource,
031: Class<T> klass) {
032: mDatasource = datasource;
033: mDelegate = GenericQueryManagerFactory.getInstance(datasource,
034: klass);
035: }
036:
037: public Datasource getDatasource() {
038: return mDatasource;
039: }
040:
041: public GenericQueryManager<T> getDelegate() {
042: return mDelegate;
043: }
044:
045: public Class getBaseClass() {
046: return mDelegate.getBaseClass();
047: }
048:
049: public String getIdentifierName() throws DatabaseException {
050: return mDelegate.getIdentifierName();
051: }
052:
053: public int getIdentifierValue(T bean) throws DatabaseException {
054: return mDelegate.getIdentifierValue(bean);
055: }
056:
057: public void validate(Validated validated) {
058: mDelegate.validate(validated);
059: }
060:
061: public String getTable() {
062: return mDelegate.getTable();
063: }
064:
065: public void install() throws DatabaseException {
066: mDelegate.install();
067: }
068:
069: public void install(CreateTable query) throws DatabaseException {
070: mDelegate.install(query);
071: }
072:
073: public void remove() throws DatabaseException {
074: mDelegate.remove();
075: }
076:
077: public int save(T bean) throws DatabaseException {
078: return mDelegate.save(bean);
079: }
080:
081: public int insert(T bean) throws DatabaseException {
082: return mDelegate.insert(bean);
083: }
084:
085: public int update(T bean) throws DatabaseException {
086: return mDelegate.update(bean);
087: }
088:
089: public List<T> restore() throws DatabaseException {
090: return mDelegate.restore();
091: }
092:
093: public T restore(int objectId) throws DatabaseException {
094: return mDelegate.restore(objectId);
095: }
096:
097: public List<T> restore(RestoreQuery query) throws DatabaseException {
098: return mDelegate.restore(query);
099: }
100:
101: public boolean restore(DbRowProcessor rowProcessor)
102: throws DatabaseException {
103: return mDelegate.restore(rowProcessor);
104: }
105:
106: public T restoreFirst(RestoreQuery query) throws DatabaseException {
107: return mDelegate.restoreFirst(query);
108: }
109:
110: public boolean restore(RestoreQuery query,
111: DbRowProcessor rowProcessor) throws DatabaseException {
112: return mDelegate.restore(query, rowProcessor);
113: }
114:
115: public CreateTable getInstallTableQuery() throws DatabaseException {
116: return mDelegate.getInstallTableQuery();
117: }
118:
119: public RestoreQuery getRestoreQuery() {
120: return mDelegate.getRestoreQuery();
121: }
122:
123: public RestoreQuery getRestoreQuery(int objectId) {
124: return mDelegate.getRestoreQuery(objectId);
125: }
126:
127: public int count() throws DatabaseException {
128: return mDelegate.count();
129: }
130:
131: public int count(CountQuery query) throws DatabaseException {
132: return mDelegate.count(query);
133: }
134:
135: public CountQuery getCountQuery() {
136: return mDelegate.getCountQuery();
137: }
138:
139: public boolean delete(int objectId) throws DatabaseException {
140: return mDelegate.delete(objectId);
141: }
142:
143: public boolean delete(DeleteQuery query) throws DatabaseException {
144: return mDelegate.delete(query);
145: }
146:
147: public DeleteQuery getDeleteQuery() {
148: return mDelegate.getDeleteQuery();
149: }
150:
151: public DeleteQuery getDeleteQuery(int objectId) {
152: return mDelegate.getDeleteQuery(objectId);
153: }
154:
155: public void addListener(GenericQueryManagerListener listener) {
156: mDelegate.addListener(listener);
157: }
158:
159: public void removeListeners() {
160: mDelegate.removeListeners();
161: }
162:
163: public <OtherBeanType> GenericQueryManager<OtherBeanType> createNewManager(
164: Class<OtherBeanType> type) {
165: return mDelegate.createNewManager(type);
166: }
167: }
|