KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jorm > mapper > rdb > lib > RdbPPolymorphicClass


1 /**
2  * Copyright (C) 2003-2004
3  * - France Telecom R&D
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library 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 GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  *
19  * Release: 1.0
20  *
21  * Authors: Olivier Lobry (olivier.lobry@francetelecom.com)
22  * Date: 13 sept. 2004
23  * Time: 14:43:03
24  */

25
26 package org.objectweb.jorm.mapper.rdb.lib;
27
28 import org.objectweb.jorm.api.PException;
29
30 /**
31  * This interface is supposed to be implemented by (generated) polymorphic classes.
32  * It permits to append the filter expession at runtime when creating the queries representing
33  * full-extents of polymorphic classes. Filters are defined on a statement basis: a query
34  * can be defined as an union of select/from/where statements, each may having filters to be added.
35  * Thus statements are named so that we can add the correct filtering expression to the right statement.
36  */

37 public interface RdbPPolymorphicClass {
38     /**
39      * This method is called when creating queries.
40      * It append the filtering expression corresponding to a statement of the query
41      * representing the full-extent of the (polymorphic) (generated) class
42      * The name of the statement to which the filtering expression is to be added
43      * is specified by the given name, so that the right filtering expression is added.
44      * The string buffer given in parameter should already contain an SQL
45      * expression of the form:
46      * 'select ... from ... where' or
47      * 'select ... from ... where ... and'
48      * @param stmtName the name of the statement in the query definition
49      * @param sb the string buffer to which adding the filtering expression.
50      */

51     void appendExtentFilters(String JavaDoc stmtName, StringBuffer JavaDoc sb);
52     
53     /**
54      * Returns the primary key of the class as a String of type "x1, x2"
55      * where x1 and x2 compose the primary key.
56      * @return
57      */

58     String JavaDoc getPNameFields();
59     
60     /**
61      * Returns the query computed in the pcm.
62      * If withPrefetch is true, returns the prefetchExtentQuery
63      * else, returns extentQuery.
64      */

65     String JavaDoc getExtentQuery(boolean withPrefetch) throws PException;
66 }
67
Popular Tags