001: package de.webman.acl.db;
002:
003: import java.sql.ResultSet;
004: import java.sql.SQLException;
005: import com.teamkonzept.db.TKQuery;
006: import de.webman.acl.Event;
007:
008: /**
009: * $Header: /cvsroot/webman-cms/source/webman/de/webman/acl/db/EventDBData.java,v 1.1 2001/08/20 08:25:08 mischa Exp $
010: *
011: * Data container for events.
012: *
013: * @version 0.10
014: * @since 0.10
015: * @author © 2000 Team-Konzept
016: */
017: public class EventDBData extends ObjectDBData {
018:
019: // Attributes
020:
021: /**
022: * The name field of the data container.
023: */
024: private String name = null;
025:
026: // Constructors
027:
028: /**
029: * Creates a data container for events.
030: *
031: * @param id the ID of the event.
032: * @param name the name of the event.
033: */
034: public EventDBData(Integer id, String name) {
035: super (id);
036:
037: this .name = name;
038:
039: super .setIgnore(true);
040: }
041:
042: /**
043: * Creates a data container for events.
044: *
045: * @param event the event.
046: */
047: public EventDBData(Event event) {
048: super (event);
049:
050: this .name = event.getName();
051: }
052:
053: // Method implementations
054:
055: /**
056: * Returns the database interface.
057: *
058: * @return the database interface.
059: */
060: public final ObjectDBInterface getDBInterface() {
061: return EventDBInterface.getInstance();
062: }
063:
064: /**
065: * Inserts initial data into the given query.
066: * <P>
067: * This method is used for <CODE>INSERT</CODE> statements.
068: *
069: * @param query the query to be executed.
070: * @exception java.sql.SQLException if an database error occured.
071: */
072: public void insertInitialIntoQuery(TKQuery query)
073: throws SQLException {
074: super .insertInitialIntoQuery(query);
075:
076: query.setQueryParams("NAME", this .name);
077: }
078:
079: /**
080: * Reads all data from the given result set.
081: * <P>
082: * This method is used for <CODE>SELECT</CODE> and
083: * <CODE>INSERT</CODE> statements.
084: *
085: * @param result the result set to be read.
086: * @exception java.sql.SQLException if an database error occured.
087: */
088: public void fill(ResultSet result) throws SQLException {
089: this .name = result.getString("NAME");
090:
091: super .fill(result);
092: }
093:
094: /**
095: * Returns the name field of the data container.
096: *
097: * @return the name field of the data container.
098: */
099: public final String getName() {
100: return this.name;
101: }
102:
103: }
|