fr.paris.lutece.plugins.newsletter.business
Class NewsLetterHome

java.lang.Object
  extended by fr.paris.lutece.plugins.newsletter.business.NewsLetterHome

public final class NewsLetterHome
extends java.lang.Object

This class provides instances management methods (create, find, ...) for NewsLetter objects


Method Summary
static void addSubscriber(int nNewsLetterId, int nSubscriberId, boolean bValidate, java.sql.Timestamp tToday, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          insert a new subscriber for e newsletter
static void addSubscriber(int nNewsLetterId, int nSubscriberId, java.sql.Timestamp tToday, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          insert a new subscriber for e newsletter.
static void associateNewsLetterDocumentList(int nNewsLetterId, int nDocumentListId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Associate a topic to a newsletter
static boolean checkLinkedPortlets(int nIdNewsletter)
          Verifies if a portlet uses a newsletter
static NewsLetter create(NewsLetter newsLetter, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Create an instance of the newsletter
static java.util.Collection<NewsLetter> findAll(fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Returns a collection of NewsLetter objects
static fr.paris.lutece.util.ReferenceList findAllId(fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Returns a ReferenceList of NewsLetter ids and names
static NewsLetter findByPrimaryKey(int nKey, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Returns an object NewsLetter from its identifier
static fr.paris.lutece.plugins.document.business.Document findDocumentById(int nDocumentId)
          Returns the documents for a given document id
static java.lang.String findDocumentListDescription(int nPortletId)
          loads the list of topics from a given id
static java.util.Collection<fr.paris.lutece.plugins.document.business.Document> findDocumentsByDateAndList(int nDocumentListId, java.sql.Timestamp dtDernierEnvoi)
          Returns the list of documents published by date and by topic
static int findNbrActiveSubscribers(int nNewsLetterId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Returns the number of active subscriber for a newsletter
static int findNbrSubscribers(int nNewsLetterId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Returns the number of subscriber for a newsletter
static int[] findNewsletterCategoryIds(int nNewsletterId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          loads the list of categories of the newsletter
static boolean findRegistration(int nNewsLetterId, int nSubscriberId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          controls that a subscriber is not yet registered for a newsletter
static boolean findTemplate(int nTemplateId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          controls that a template is used by a newsletter
static fr.paris.lutece.util.ReferenceList getAllCategories(fr.paris.lutece.portal.business.user.AdminUser user)
          Fetches all the categories defined
static fr.paris.lutece.util.ReferenceList getDocumentLists()
          Returns a collection any portlet containing at least a published document
static void remove(int nNewsLetterId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Remove the record from the identifier a newsletter
static void removeNewsLetterDocumentList(int nNewsLetterId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Removes the relationship between a list of topics and a newsletter
static void removeOldUnconfirmed(int nConfirmLimit, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Performs confirm unsubscription process
static void removeSubscriber(int nNewsLetterId, int nSubscriberId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          removes an subscriber's inscription for a newsletter
static NewsLetter update(NewsLetter newsLetter, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          update of the newsletter which is specified in parameter
static void validateSubscriber(int nNewsLetterId, int nSubscriberId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          validates a new subscriber for a newsletter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

create

public static NewsLetter create(NewsLetter newsLetter,
                                fr.paris.lutece.portal.service.plugin.Plugin plugin)
Create an instance of the newsletter

Parameters:
newsLetter - the object to insert into the database
plugin - the Plugin
Returns:
the instance created

update

public static NewsLetter update(NewsLetter newsLetter,
                                fr.paris.lutece.portal.service.plugin.Plugin plugin)
update of the newsletter which is specified in parameter

Parameters:
newsLetter - the instacne of newsletter which contains the data to store
plugin - the Plugin
Returns:
the new instance updated

remove

public static void remove(int nNewsLetterId,
                          fr.paris.lutece.portal.service.plugin.Plugin plugin)
Remove the record from the identifier a newsletter

Parameters:
nNewsLetterId - the newsletter identifier
plugin - the Plugin

findByPrimaryKey

public static NewsLetter findByPrimaryKey(int nKey,
                                          fr.paris.lutece.portal.service.plugin.Plugin plugin)
Returns an object NewsLetter from its identifier

Parameters:
nKey - the primary key of the newsletter
plugin - the Plugin
Returns:
an instance of the class

findAll

public static java.util.Collection<NewsLetter> findAll(fr.paris.lutece.portal.service.plugin.Plugin plugin)
Returns a collection of NewsLetter objects

Parameters:
plugin - the Plugin
Returns:
the collection of objects

findAllId

public static fr.paris.lutece.util.ReferenceList findAllId(fr.paris.lutece.portal.service.plugin.Plugin plugin)
Returns a ReferenceList of NewsLetter ids and names

Parameters:
plugin - the Plugin
Returns:
the ReferenceList of id and name

addSubscriber

public static void addSubscriber(int nNewsLetterId,
                                 int nSubscriberId,
                                 java.sql.Timestamp tToday,
                                 fr.paris.lutece.portal.service.plugin.Plugin plugin)
insert a new subscriber for e newsletter. subscriber is automaticaly marked as confirmed

Parameters:
nNewsLetterId - the newsletter identifier
nSubscriberId - the subscriber indentifier
plugin - the Plugin
tToday - the day

addSubscriber

public static void addSubscriber(int nNewsLetterId,
                                 int nSubscriberId,
                                 boolean bValidate,
                                 java.sql.Timestamp tToday,
                                 fr.paris.lutece.portal.service.plugin.Plugin plugin)
insert a new subscriber for e newsletter

Parameters:
nNewsLetterId - the newsletter identifier
nSubscriberId - the subscriber indentifier
bValidate - true if user is automaticaly confirmed, false otherwise
plugin - the Plugin
tToday - the day

validateSubscriber

public static void validateSubscriber(int nNewsLetterId,
                                      int nSubscriberId,
                                      fr.paris.lutece.portal.service.plugin.Plugin plugin)
validates a new subscriber for a newsletter

Parameters:
nNewsLetterId - the newsletter identifier
nSubscriberId - the subscriber indentifier
plugin - the Plugin

removeSubscriber

public static void removeSubscriber(int nNewsLetterId,
                                    int nSubscriberId,
                                    fr.paris.lutece.portal.service.plugin.Plugin plugin)
removes an subscriber's inscription for a newsletter

Parameters:
nNewsLetterId - the newsletter identifier
nSubscriberId - the subscriber identifier
plugin - the Plugin

removeOldUnconfirmed

public static void removeOldUnconfirmed(int nConfirmLimit,
                                        fr.paris.lutece.portal.service.plugin.Plugin plugin)
Performs confirm unsubscription process

Parameters:
nConfirmLimit - How many days before deleting a subscriber
plugin - the plugin

findNewsletterCategoryIds

public static int[] findNewsletterCategoryIds(int nNewsletterId,
                                              fr.paris.lutece.portal.service.plugin.Plugin plugin)
loads the list of categories of the newsletter

Parameters:
nNewsletterId - the newsletter identifier
plugin - the plugin
Returns:
the array of ids

findDocumentListDescription

public static java.lang.String findDocumentListDescription(int nPortletId)
loads the list of topics from a given id

Parameters:
nPortletId - the document list identifier
Returns:
the name of the topic

findNbrSubscribers

public static int findNbrSubscribers(int nNewsLetterId,
                                     fr.paris.lutece.portal.service.plugin.Plugin plugin)
Returns the number of subscriber for a newsletter

Parameters:
nNewsLetterId - the identifier of the newsletter
plugin - the Plugin
Returns:
the number of subscriber for a newsletter

findNbrActiveSubscribers

public static int findNbrActiveSubscribers(int nNewsLetterId,
                                           fr.paris.lutece.portal.service.plugin.Plugin plugin)
Returns the number of active subscriber for a newsletter

Parameters:
nNewsLetterId - the identifier of the newsletter
plugin - the Plugin
Returns:
the number of subscriber for a newsletter

associateNewsLetterDocumentList

public static void associateNewsLetterDocumentList(int nNewsLetterId,
                                                   int nDocumentListId,
                                                   fr.paris.lutece.portal.service.plugin.Plugin plugin)
Associate a topic to a newsletter

Parameters:
nNewsLetterId - the newsletter identifier
nDocumentListId - the topic identifier
plugin - the Plugin

removeNewsLetterDocumentList

public static void removeNewsLetterDocumentList(int nNewsLetterId,
                                                fr.paris.lutece.portal.service.plugin.Plugin plugin)
Removes the relationship between a list of topics and a newsletter

Parameters:
nNewsLetterId - the newsletter identifier
plugin - the Plugin

findDocumentsByDateAndList

public static java.util.Collection<fr.paris.lutece.plugins.document.business.Document> findDocumentsByDateAndList(int nDocumentListId,
                                                                                                                  java.sql.Timestamp dtDernierEnvoi)
Returns the list of documents published by date and by topic

Parameters:
nDocumentListId - the list identifier
dtDernierEnvoi - the date of the last sending
Returns:
a collection of document

findDocumentById

public static fr.paris.lutece.plugins.document.business.Document findDocumentById(int nDocumentId)
Returns the documents for a given document id

Parameters:
nDocumentId - the document id
Returns:
an DocumentPortlet object

findRegistration

public static boolean findRegistration(int nNewsLetterId,
                                       int nSubscriberId,
                                       fr.paris.lutece.portal.service.plugin.Plugin plugin)
controls that a subscriber is not yet registered for a newsletter

Parameters:
nNewsLetterId - the newsletter identifier
nSubscriberId - the subscriber identifier
plugin - the Plugin
Returns:
true if he is registered, false if not

findTemplate

public static boolean findTemplate(int nTemplateId,
                                   fr.paris.lutece.portal.service.plugin.Plugin plugin)
controls that a template is used by a newsletter

Parameters:
nTemplateId - the template identifier
plugin - the Plugin
Returns:
true if the template is used, false if not

checkLinkedPortlets

public static boolean checkLinkedPortlets(int nIdNewsletter)
Verifies if a portlet uses a newsletter

Parameters:
nIdNewsletter - the template identifier
Returns:
true if portlet uses newsletter

getDocumentLists

public static fr.paris.lutece.util.ReferenceList getDocumentLists()
Returns a collection any portlet containing at least a published document

Returns:
the portlets in form of Collection

getAllCategories

public static fr.paris.lutece.util.ReferenceList getAllCategories(fr.paris.lutece.portal.business.user.AdminUser user)
Fetches all the categories defined

Returns:
A list of all categories


Copyright © 2010 Mairie de Paris. All Rights Reserved.