KickJava   Java API By Example, From Geeks To Geeks.

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


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 com.teamkonzept.lib.TKVector;
7 import de.webman.acl.Role;
8
9 /**
10  * $Header: /cvsroot/webman-cms/source/webman/de/webman/acl/db/RoleDBData.java,v 1.1 2001/08/20 08:25:08 mischa Exp $
11  *
12  * Data container for roles.
13  *
14  * @version 0.10
15  * @since 0.10
16  * @author © 2000 Team-Konzept
17  */

18 public class RoleDBData
19     extends ObjectDBData
20 {
21
22     // Attributes
23

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

27     private String JavaDoc name = null;
28
29
30     // Constructors
31

32     /**
33      * Creates a data container for roles.
34      *
35      * @param id the ID of the role.
36      * @param name the name of the role.
37      */

38     public RoleDBData (Integer JavaDoc id,
39                          String JavaDoc name)
40     {
41         super(id);
42
43         this.name = name;
44     }
45
46     /**
47      * Creates a data container for roles.
48      *
49      * @param role the role.
50      */

51     public RoleDBData (Role role)
52     {
53         super(role);
54
55         this.name = role.getName();
56     }
57
58
59     // Method implementations
60

61     /**
62      * Returns the database interface.
63      *
64      * @return the database interface.
65      */

66     public final ObjectDBInterface getDBInterface ()
67     {
68         return RoleDBInterface.getInstance();
69     }
70
71     /**
72      * Inserts initial data into the given query.
73      * <P>
74      * This method is used for <CODE>INSERT</CODE> statements.
75      *
76      * @param query the query to be executed.
77      * @exception java.sql.SQLException if an database error occured.
78      */

79     public void insertInitialIntoQuery (TKQuery query)
80         throws SQLException JavaDoc
81     {
82         super.insertInitialIntoQuery(query);
83
84         query.setQueryParams("NAME", this.name);
85     }
86
87     /**
88      * Reads all data from the given result set.
89      * <P>
90      * This method is used for <CODE>SELECT</CODE> and
91      * <CODE>INSERT</CODE> statements.
92      *
93      * @param result the result set to be read.
94      * @exception java.sql.SQLException if an database error occured.
95      */

96     public void fill (ResultSet JavaDoc result)
97         throws SQLException JavaDoc
98     {
99         this.name = result.getString("NAME");
100
101         super.fill(result);
102     }
103
104     /**
105      * Returns the name field of the data container.
106      *
107      * @return the name field of the data container.
108      */

109     public final String JavaDoc getName ()
110     {
111         return this.name;
112     }
113
114 }
115
Popular Tags