KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > webman > acl > db > ContextDBData


1 package de.webman.acl.db;
2
3 import java.sql.ResultSet JavaDoc;
4 import java.sql.SQLException JavaDoc;
5 import com.teamkonzept.db.TKQuery;
6 import de.webman.acl.Context;
7
8 /**
9  * $Header: /cvsroot/webman-cms/source/webman/de/webman/acl/db/ContextDBData.java,v 1.1 2001/08/20 08:25:08 mischa Exp $
10  *
11  * Data container for contexts.
12  *
13  * @version 0.10
14  * @since 0.10
15  * @author © 2000 Team-Konzept
16  */

17 public class ContextDBData
18     extends ObjectDBData
19 {
20
21     // Attributes
22

23     /**
24      * The name field of the data container.
25      */

26     private String JavaDoc name = null;
27
28     /**
29      * The shortcut field of the data container.
30      */

31     private String JavaDoc shortcut = null;
32
33
34     // Constructors
35

36     /**
37      * Creates a data container for contexts.
38      *
39      * @param id the ID of the context.
40      * @param name the name of the context.
41      * @param shortcut the shortcut of the context.
42      */

43     public ContextDBData (Integer JavaDoc id,
44                             String JavaDoc name,
45                             String JavaDoc shortcut)
46     {
47         super(id);
48
49         this.name = name;
50         this.shortcut = shortcut;
51
52         super.setIgnore(true);
53     }
54
55     /**
56      * Creates a data container for contexts.
57      *
58      * @param context the context.
59      */

60     public ContextDBData (Context context)
61     {
62         super(context);
63
64         this.name = context.getName();
65         this.shortcut = context.getShortcut();
66     }
67
68
69     // Method implementations
70

71     /**
72      * Returns the database interface.
73      *
74      * @return the database interface.
75      */

76     public final ObjectDBInterface getDBInterface ()
77     {
78         return ContextDBInterface.getInstance();
79     }
80
81     /**
82      * Inserts initial data into the given query.
83      * <P>
84      * This method is used for <CODE>INSERT</CODE> statements.
85      *
86      * @param query the query to be executed.
87      * @exception java.sql.SQLException if an database error occured.
88      */

89     public void insertInitialIntoQuery (TKQuery query)
90         throws SQLException JavaDoc
91     {
92         super.insertInitialIntoQuery(query);
93
94         query.setQueryParams("NAME", this.name);
95         query.setQueryParams("SHORTCUT", this.shortcut);
96     }
97
98     /**
99      * Reads all data from the given result set.
100      * <P>
101      * This method is used for <CODE>SELECT</CODE> and
102      * <CODE>INSERT</CODE> statements.
103      *
104      * @param result the result set to be read.
105      * @exception java.sql.SQLException if an database error occured.
106      */

107     public void fill (ResultSet JavaDoc result)
108         throws SQLException JavaDoc
109     {
110         this.name = result.getString("NAME");
111         this.shortcut = result.getString("SHORTCUT");
112
113         super.fill(result);
114     }
115
116     /**
117      * Returns the name field of the data container.
118      *
119      * @return the name field of the data container.
120      */

121     public final String JavaDoc getName ()
122     {
123         return this.name;
124     }
125
126     /**
127      * Returns the shortcut field of the data container.
128      *
129      * @return the shortcut field of the data container.
130      */

131     public final String JavaDoc getShortcut ()
132     {
133         return this.shortcut;
134     }
135
136 }
137
Popular Tags