KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > nava > informa > impl > hibernate > ChannelSubscription


1 //
2
// Informa -- RSS Library for Java
3
// Copyright (c) 2002 by Niko Schmuck
4
//
5
// Niko Schmuck
6
// http://sourceforge.net/projects/informa
7
// mailto:niko_schmuck@users.sourceforge.net
8
//
9
// This library is free software.
10
//
11
// You may redistribute it and/or modify it under the terms of the GNU
12
// Lesser General Public License as published by the Free Software Foundation.
13
//
14
// Version 2.1 of the license should be included with this distribution in
15
// the file LICENSE. If the license is not included with this distribution,
16
// you may find a copy at the FSF web site at 'www.gnu.org' or 'www.fsf.org',
17
// or you may write to the Free Software Foundation, 675 Mass Ave, Cambridge,
18
// MA 02139 USA.
19
//
20
// This library is distributed in the hope that it will be useful,
21
// but WITHOUT ANY WARRANTY; without even the implied waranty of
22
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23
// Lesser General Public License for more details.
24
//
25

26
27 // $Id: ChannelSubscription.java,v 1.2 2003/09/24 13:04:20 niko_schmuck Exp $
28

29 package de.nava.informa.impl.hibernate;
30
31 import de.nava.informa.core.ChannelSubscriptionIF;
32 import de.nava.informa.core.ChannelIF;
33
34 /**
35  * Hibernate implementation of the ChannelSubscriptionIF interface.
36  *
37  * @author Niko Schmuck (niko@nava.de)
38  *
39  * @hibernate.class
40  * table="CHANNEL_SUBSCRIPTIONS"
41  */

42 public class ChannelSubscription implements ChannelSubscriptionIF,
43                                             java.io.Serializable JavaDoc {
44
45   private int id;
46   private ChannelIF channel;
47   private boolean active;
48   private int updateInterval;
49
50   public ChannelSubscription() {
51     this(null);
52   }
53
54   /**
55    * Default constructor sets to an inactive channel (with an update
56    * interval of 3 hours, used when activated).
57    */

58   public ChannelSubscription(ChannelIF channel) {
59     this(channel, false, 3 * 60 * 60);
60   }
61   
62   public ChannelSubscription(ChannelIF channel, boolean active, int interval) {
63     this.channel = channel;
64     this.active = active;
65     this.updateInterval = interval;
66   }
67
68   /**
69    * @hibernate.id
70    * column="CHANNEL_SUBSCRIPTION_ID"
71    * generator-class="native"
72    * type="integer"
73    */

74   public int getIntId() {
75     return id;
76   }
77
78   public void setIntId(int id) {
79     this.id = id;
80   }
81
82   public long getId() {
83     return id;
84   }
85
86   public void setId(long longid) {
87     this.id = (int) longid;
88   }
89
90   // --------------------------------------------------------------
91
// implementation of ChannelSubscriptionIF interface
92
// --------------------------------------------------------------
93

94   /**
95    * @hibernate.many-to-one
96    * column="CHANNEL_ID"
97    * class="de.nava.informa.impl.hibernate.Channel"
98    * not-null="true"
99    */

100   public ChannelIF getChannel() {
101     return channel;
102   }
103
104   public void setChannel(ChannelIF channel) {
105     this.channel = channel;
106   }
107
108   /**
109    * @hibernate.property
110    * column="ACTIVE"
111    */

112   public boolean isActive() {
113     return active;
114   }
115   
116   public void setActive(boolean active) {
117     this.active = active;
118   }
119
120   /**
121    * @hibernate.property
122    * column="UPDATE_INTERVAL"
123    */

124   public int getUpdateInterval() {
125     return updateInterval;
126   }
127
128   public void setUpdateInterval(int interval) {
129     this.updateInterval = interval;
130   }
131     
132 }
133
Popular Tags