KickJava   Java API By Example, From Geeks To Geeks.

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


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

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

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

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

31     private String JavaDoc name = null;
32
33     /**
34      * The value field of the data container.
35      */

36     private String JavaDoc value = null;
37
38
39     // Constructors
40

41     /**
42      * Creates a data container for properties.
43      *
44      * @param id the ID of the property.
45      * @param name the name of the property.
46      */

47     public PropertyDBData (Integer JavaDoc id,
48                              Integer JavaDoc login,
49                              String JavaDoc name,
50                              String JavaDoc value)
51     {
52         super(id);
53
54         this.login = login;
55         this.name = name;
56         this.value = value;
57
58         super.setIgnore(true);
59     }
60
61     /**
62      * Creates a data container for properties.
63      *
64      * @param property the property.
65      */

66     public PropertyDBData (Property property)
67     {
68         super(property);
69
70         this.login = property.getLoginID();
71         this.name = property.getName();
72         this.value = property.getValue();
73     }
74
75
76     // Method implementations
77

78     /**
79      * Returns the database interface.
80      *
81      * @return the database interface.
82      */

83     public final ObjectDBInterface getDBInterface ()
84     {
85         return PropertyDBInterface.getInstance();
86     }
87
88     /**
89      * Inserts initial data into the given query.
90      * <P>
91      * This method is used for <CODE>INSERT</CODE> statements.
92      *
93      * @param query the query to be executed.
94      * @exception java.sql.SQLException if an database error occured.
95      */

96     public void insertInitialIntoQuery (TKQuery query)
97         throws SQLException JavaDoc
98     {
99         super.insertInitialIntoQuery(query);
100
101         query.setQueryParams("WM_USER_ID", this.login);
102         query.setQueryParams("NAME", this.name);
103         query.setQueryParams("VALUE", this.value);
104     }
105
106     /**
107      * Reads all data from the given result set.
108      * <P>
109      * This method is used for <CODE>SELECT</CODE> and
110      * <CODE>INSERT</CODE> statements.
111      *
112      * @param result the result set to be read.
113      * @exception java.sql.SQLException if an database error occured.
114      */

115     public void fill (ResultSet JavaDoc result)
116         throws SQLException JavaDoc
117     {
118         this.login = new Integer JavaDoc(result.getInt(LoginDBInterface.getInstance().getPrimaryKeyName()));
119         this.name = result.getString("NAME");
120         this.value = result.getString("VALUE");
121
122         super.fill(result);
123     }
124
125     /**
126      * Returns the login field of the data container.
127      *
128      * @return the login field of the data container.
129      */

130     public final Integer JavaDoc getLogin ()
131     {
132         return this.login;
133     }
134
135     /**
136      * Returns the name field of the data container.
137      *
138      * @return the name field of the data container.
139      */

140     public final String JavaDoc getName ()
141     {
142         return this.name;
143     }
144
145     /**
146      * Returns the value field of the data container.
147      *
148      * @return the value field of the data container.
149      */

150     public final String JavaDoc getValue ()
151     {
152         return this.value;
153     }
154
155 }
156
Popular Tags