Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

com.RuntimeCollective.publication.bean
Class Subscription  view Subscription download Subscription.java

java.lang.Object
  extended bycom.RuntimeCollective.publication.bean.Subscription
All Implemented Interfaces:
com.RuntimeCollective.webapps.bean.EntityBean, java.io.Serializable

public class Subscription
extends java.lang.Object
implements com.RuntimeCollective.webapps.bean.EntityBean

A Subscription object, which is roughly a mapping between a User and a Publication, with Start and End dates.

Version:
$Id: Subscription.java,v 1.6 2003/09/30 15:12:52 joe Exp $

Field Summary
static java.lang.String DATABASE_TABLE
          The name of the database table for this bean type.
static java.lang.String DELETE_FROM
           
protected  java.util.Date EndDate
          The End Date.
protected  int id
          This Subscription's id
static java.lang.String ORDER_BY_ID
           
static java.lang.String SELECT_COUNT_ID
           
static java.lang.String SELECT_DATA
           
static java.lang.String SELECT_ID_FROM
           
protected  java.util.Date StartDate
          The Start Date.
protected  int SubscribedPublicationId
          The SubscribedPublication.
protected  int SubscribeeId
          The Subscribee.
static java.lang.String T_WHERE_ID
           
static java.lang.String WHERE_ID
           
static java.lang.String WHERE_IS_CURRENT
           
static java.lang.String WHERE_PUB_ID
           
static java.lang.String WHERE_SUBS_ID
           
 
Fields inherited from interface com.RuntimeCollective.webapps.bean.EntityBean
INTERFACE_BEAN, NULL_ID
 
Constructor Summary
Subscription()
          Construct a new blank Subscription, giving it a new unique ID.
Subscription(int id)
          Get a Subscription from the RuntimeDataSource, given an id.
 
Method Summary
 void delete()
          Delete this Subscription from the database.
 java.util.Date getEndDate()
          Get the End Date.
 int getId()
          Get the unique id of this Subscription.
static int getNumberOfCurrentSubscriptions()
          Gets the total number of current subscriptions in the system.
 java.util.Date getStartDate()
          Get the Start Date.
 Publication getSubscribedPublication()
          Get the SubscribedPublication.
 com.RuntimeCollective.webapps.bean.User getSubscribee()
          Get the Subscribee.
static java.util.List getSubscriptionList(Publication publication)
          Get the List of Subscriptions for a publication.
static java.util.List getSubscriptionList(com.RuntimeCollective.webapps.bean.User user)
          Get the List of Subscriptions for a user.
static java.util.List getSubscriptionListSortedByPublicationName(com.RuntimeCollective.webapps.bean.User user)
          Get the List of Subscriptions for a user, sorted by Publication.PublicName.
private  void initDates()
          Initialises dates based on the current date.
 boolean isValidNow()
          Get whether the Subscription is valid now.
 void save()
          Save this Subscription to the database.
 void setEndDate(java.util.Date endDate)
          Set the End Date.
 void setId(int id)
          Set the unique id of this Subscription.
 void setStartDate(java.util.Date startDate)
          Set the Start Date.
 void setSubscribedPublication(Publication subscribedPublication)
          Set the SubscribedPublication.
 void setSubscribee(com.RuntimeCollective.webapps.bean.User subscribee)
          Set the Subscribee.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DATABASE_TABLE

public static final java.lang.String DATABASE_TABLE
The name of the database table for this bean type.

See Also:
Constant Field Values

DELETE_FROM

public static java.lang.String DELETE_FROM

WHERE_ID

public static java.lang.String WHERE_ID

SELECT_DATA

public static java.lang.String SELECT_DATA

T_WHERE_ID

public static java.lang.String T_WHERE_ID

SELECT_COUNT_ID

public static java.lang.String SELECT_COUNT_ID

WHERE_IS_CURRENT

public static java.lang.String WHERE_IS_CURRENT

SELECT_ID_FROM

public static java.lang.String SELECT_ID_FROM

WHERE_SUBS_ID

public static java.lang.String WHERE_SUBS_ID

WHERE_PUB_ID

public static java.lang.String WHERE_PUB_ID

ORDER_BY_ID

public static java.lang.String ORDER_BY_ID

id

protected int id
This Subscription's id


SubscribeeId

protected int SubscribeeId
The Subscribee.


SubscribedPublicationId

protected int SubscribedPublicationId
The SubscribedPublication.


StartDate

protected java.util.Date StartDate
The Start Date.


EndDate

protected java.util.Date EndDate
The End Date.

Constructor Detail

Subscription

public Subscription()
Construct a new blank Subscription, giving it a new unique ID.


Subscription

public Subscription(int id)
Get a Subscription from the RuntimeDataSource, given an id.

Method Detail

setId

public void setId(int id)
Set the unique id of this Subscription.

Specified by:
setId in interface com.RuntimeCollective.webapps.bean.EntityBean

getId

public int getId()
Get the unique id of this Subscription.

Specified by:
getId in interface com.RuntimeCollective.webapps.bean.EntityBean

save

public void save()
          throws java.sql.SQLException
Save this Subscription to the database.

Specified by:
save in interface com.RuntimeCollective.webapps.bean.EntityBean

delete

public void delete()
            throws java.sql.SQLException
Delete this Subscription from the database.

Specified by:
delete in interface com.RuntimeCollective.webapps.bean.EntityBean

setSubscribee

public void setSubscribee(com.RuntimeCollective.webapps.bean.User subscribee)
Set the Subscribee.


getSubscribee

public com.RuntimeCollective.webapps.bean.User getSubscribee()
Get the Subscribee.


setSubscribedPublication

public void setSubscribedPublication(Publication subscribedPublication)
Set the SubscribedPublication.


getSubscribedPublication

public Publication getSubscribedPublication()
Get the SubscribedPublication.


getStartDate

public java.util.Date getStartDate()
Get the Start Date.


setStartDate

public void setStartDate(java.util.Date startDate)
Set the Start Date.


getEndDate

public java.util.Date getEndDate()
Get the End Date.


setEndDate

public void setEndDate(java.util.Date endDate)
Set the End Date.


isValidNow

public boolean isValidNow()
Get whether the Subscription is valid now.


initDates

private void initDates()
Initialises dates based on the current date.


getNumberOfCurrentSubscriptions

public static int getNumberOfCurrentSubscriptions()
Gets the total number of current subscriptions in the system.


getSubscriptionList

public static java.util.List getSubscriptionList(Publication publication)
Get the List of Subscriptions for a publication. This queries the db every time.


getSubscriptionList

public static java.util.List getSubscriptionList(com.RuntimeCollective.webapps.bean.User user)
Get the List of Subscriptions for a user. This queries the db every time.


getSubscriptionListSortedByPublicationName

public static java.util.List getSubscriptionListSortedByPublicationName(com.RuntimeCollective.webapps.bean.User user)
Get the List of Subscriptions for a user, sorted by Publication.PublicName.