Package org.dspace.eperson
Class SubscribeCLITool
- java.lang.Object
-
- org.dspace.eperson.SubscribeCLITool
-
public class SubscribeCLITool extends Object
CLI tool used for sending new item e-mail alerts to users- Version:
- $Revision$
- Author:
- Robert Tansley
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidmain(String[] argv)Method for invoking subscriptions via the command linestatic voidprocessDaily(Context context, boolean test)Process subscriptions.static voidsendEmail(Context context, EPerson eperson, List<Collection> collections, boolean test)Sends an email to the given e-person with details of new items in the given collections, items that appeared yesterday.
-
-
-
Method Detail
-
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- The relevant DSpace Context.test- If true, do a "dry run", i.e. don't actually send email, just log the attempt- Throws:
SQLException- An exception that provides information on a database access error or other errors.IOException- A general class of exceptions produced by failed or interrupted I/O operations.
-
sendEmail
public static void sendEmail(Context context, EPerson eperson, List<Collection> 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 objecteperson- eperson to send tocollections- List of collection IDs (Integers)test- If true, do a "dry run", i.e. don't actually send email, just log the attempt- Throws:
IOException- A general class of exceptions produced by failed or interrupted I/O operations.javax.mail.MessagingException- A general class of exceptions for sending email.SQLException- An exception that provides information on a database access error or other errors.
-
main
public static void main(String[] argv)
Method for invoking subscriptions via the command line- Parameters:
argv- the command line arguments given
-
-