KickJava   Java API By Example, From Geeks To Geeks.

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


1 package de.webman.acl.db;
2
3 import java.sql.ResultSet JavaDoc;
4 import java.sql.SQLException JavaDoc;
5 import com.teamkonzept.db.TKDBTableData;
6 import com.teamkonzept.db.TKQuery;
7
8 /**
9  * $Header: /cvsroot/webman-cms/source/webman/de/webman/acl/db/ProfileCollectionDBData.java,v 1.1 2001/08/20 08:25:08 mischa Exp $
10  *
11  * Data container for profile collections.
12  * <P>
13  * Intended use is the update of the priority of a number of parent logins.
14  * The update must be qualified by the ID of a child login.
15  *
16  * @version 0.10
17  * @since 0.10
18  * @author &copy; 2000 Team-Konzept
19  */

20 public class ProfileCollectionDBData
21     extends ObjectCollectionDBData
22 {
23
24     // Attributes
25

26     /**
27      * The value of the priority column.
28      */

29     private int priority = 0;
30
31
32     // Constructors
33

34     /**
35      * Creates a data container for login collections.
36      *
37      * @param child the ID of the child login.
38      */

39     public ProfileCollectionDBData (Integer JavaDoc child)
40     {
41         super(LoginDBInterface.DEPENDENT_KEY_NAME,
42               child,
43               LoginDBInterface.PRIMARY_KEY_NAME,
44               null);
45     }
46
47     /**
48      * Creates a data container for login collections.
49      *
50      * @param child the ID of the child login.
51      * @param parent the ID of a parent login.
52      * @param priority the value of the priority column.
53      */

54     private ProfileCollectionDBData (Integer JavaDoc child,
55                                        Integer JavaDoc parent,
56                                        int priority)
57     {
58         super(LoginDBInterface.DEPENDENT_KEY_NAME,
59               child,
60               LoginDBInterface.PRIMARY_KEY_NAME,
61               parent);
62
63         this.priority = priority;
64     }
65
66
67     // Method implementations
68

69     /**
70      * Inserts the IDs of two kindred logins and their priority into the
71      * given query.
72      *
73      * @param query the query to be executed.
74      * @exception java.sql.SQLException if an database error occured.
75      */

76     public void insertIntoQuery (TKQuery query)
77         throws SQLException JavaDoc
78     {
79         super.insertIntoQuery(query);
80
81         query.setQueryParams(LoginDBInterface.PRIORITY_COLUMN, new Integer JavaDoc(this.priority));
82     }
83
84     /**
85      * Returns a data container with the given value.
86      *
87      * @param value the value.
88      * @return a data container with the given value.
89      */

90     public TKDBTableData newFromValue (Integer JavaDoc value)
91     {
92         return new ProfileCollectionDBData((Integer JavaDoc) super.restrictorValue,
93                                              value,
94                                              ++this.priority);
95     }
96
97 }
98
Popular Tags