Class SubscribeCLITool


  • public class SubscribeCLITool
    extends Object
    CLI tool used for sending new item e-mail alerts to users
    Version:
    $Revision$
    Author:
    Robert Tansley
    • 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 object
        eperson - eperson to send to
        collections - 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