org.dspace.eperson
Class Subscribe

java.lang.Object
  extended by org.dspace.eperson.Subscribe

public class Subscribe
extends Object

Class defining methods for sending new item e-mail alerts to users

Version:
$Revision: 3762 $
Author:
Robert Tansley

Constructor Summary
Subscribe()
           
 
Method Summary
static Collection[] getSubscriptions(Context context, EPerson eperson)
          Find out which collections an e-person is subscribed to
static boolean isSubscribed(Context context, EPerson eperson, Collection collection)
          Is that e-person subscribed to that collection?
static void main(String[] argv)
          Method for invoking subscriptions via the command line
static void processDaily(Context context, boolean test)
          Process subscriptions.
static void sendEmail(Context context, EPerson eperson, List collections, boolean test)
          Sends an email to the given e-person with details of new items in the given collections, items that appeared yesterday.
static void subscribe(Context context, EPerson eperson, Collection collection)
          Subscribe an e-person to a collection.
static void unsubscribe(Context context, EPerson eperson, Collection collection)
          Unsubscribe an e-person to a collection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Subscribe

public Subscribe()
Method Detail

subscribe

public static void subscribe(Context context,
                             EPerson eperson,
                             Collection collection)
                      throws SQLException,
                             AuthorizeException
Subscribe an e-person to a collection. An e-mail will be sent every day a new item appears in the collection.

Parameters:
context - DSpace context
eperson - EPerson to subscribe
collection - Collection to subscribe to
Throws:
SQLException
AuthorizeException

unsubscribe

public static void unsubscribe(Context context,
                               EPerson eperson,
                               Collection collection)
                        throws SQLException,
                               AuthorizeException
Unsubscribe an e-person to a collection. Passing in null for the collection unsubscribes the e-person from all collections they are subscribed to.

Parameters:
context - DSpace context
eperson - EPerson to unsubscribe
collection - Collection to unsubscribe from
Throws:
SQLException
AuthorizeException

getSubscriptions

public static Collection[] getSubscriptions(Context context,
                                            EPerson eperson)
                                     throws SQLException
Find out which collections an e-person is subscribed to

Parameters:
context - DSpace context
eperson - EPerson
Returns:
array of collections e-person is subscribed to
Throws:
SQLException

isSubscribed

public static boolean isSubscribed(Context context,
                                   EPerson eperson,
                                   Collection collection)
                            throws SQLException
Is that e-person subscribed to that collection?

Parameters:
context - DSpace context
eperson - find out if this e-person is subscribed
collection - find out if subscribed to this collection
Returns:
true if they are subscribed
Throws:
SQLException

processDaily

public static void processDaily(Context context,
                                boolean test)
                         throws SQLException,
                                IOException
Process subscriptions. This must be invoked only once a day. Messages are only sent out when a collection has actually received new items, so that people's mailboxes are not clogged with many "no new items" mails.

Yesterday's newly available items are included. If this is run at for example midday, any items that have been made available during the current day will not be included, but will be included in the next day's run.

For example, if today's date is 2002-10-10 (in UTC) items made available during 2002-10-09 (UTC) will be included.

Parameters:
context - DSpace context object
test -
Throws:
SQLException
IOException

sendEmail

public static void sendEmail(Context context,
                             EPerson eperson,
                             List collections,
                             boolean test)
                      throws IOException,
                             javax.mail.MessagingException,
                             SQLException
Sends an email to the given e-person with details of new items in the given collections, items that appeared yesterday. No e-mail is sent if there aren't any new items in any of the collections.

Parameters:
context - DSpace context object
eperson - eperson to send to
collections - List of collection IDs (Integers)
test -
Throws:
IOException
javax.mail.MessagingException
SQLException

main

public static void main(String[] argv)
Method for invoking subscriptions via the command line

Parameters:
argv - command-line arguments, none used yet


Copyright © 2010 DuraSpace. All Rights Reserved.