KickJava   Java API By Example, From Geeks To Geeks.

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


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

17 public class EventDBData
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     // Constructors
30

31     /**
32      * Creates a data container for events.
33      *
34      * @param id the ID of the event.
35      * @param name the name of the event.
36      */

37     public EventDBData (Integer JavaDoc id,
38                           String JavaDoc name)
39     {
40         super(id);
41
42         this.name = name;
43
44         super.setIgnore(true);
45     }
46
47     /**
48      * Creates a data container for events.
49      *
50      * @param event the event.
51      */

52     public EventDBData (Event event)
53     {
54         super(event);
55
56         this.name = event.getName();
57     }
58
59
60     // Method implementations
61

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

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

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

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

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