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

java.lang.Object
  extended by fr.paris.lutece.plugins.newsletter.business.NewsLetterDAO
All Implemented Interfaces:
INewsLetterDAO

public final class NewsLetterDAO
extends java.lang.Object
implements INewsLetterDAO

This class provides Data Access methods for NewsLetter objects


Constructor Summary
NewsLetterDAO()
           
 
Method Summary
 void associateNewsLetterTheme(int nNewsLetterId, int nThemeId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Associate a new topic to a newsletter
 boolean checkLinkedPortlet(int nIdNewsletter)
          Check whether a portlet is linked to a newsletter
 boolean checkPrimaryKey(int nKey, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Check the unicity of the primary key
 void delete(int nNewsLetterId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Remove a record from the table
 void deleteAllSubscribers(int nNewsLetterId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Removes all the subscribers attached to a newsletter
 void deleteNewsLetterTheme(int nNewsLetterId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Remove the relationship between a newsletter and the list of themes
 void deleteSubscriber(int nNewsLetterId, int nSubscriberId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Remove the subscriber's inscription to a newsletter
 void insert(NewsLetter newsLetter, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Insert a new record in the table.
 void insertSubscriber(int nNewsLetterId, int nSubscriberId, java.sql.Timestamp tToday, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Insert a new subscriber for a newsletter
 boolean isRegistered(int nNewsLetterId, int nSubscriberId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          check if the subscriber is not yet registered to a newsletter
 boolean isTemplateUsed(int nTemplateId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          controls that a template is used by a newsletter
 NewsLetter load(int nNewsLetterId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          loads the data of the newsletter from the table
 int newPrimaryKey(fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Generate a new primary key to add a newsletter
 java.util.Collection<NewsLetter> selectAll(fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Select the list of the newsletters available
 java.lang.String selectDocumentList(int nPortletId)
          loads the list of document
 java.util.Collection<fr.paris.lutece.plugins.document.business.Document> selectDocumentsByDateAndList(int nPortletId, java.sql.Timestamp dateLastSending)
          Select the list of documents published since the last sending of the newsletter
 fr.paris.lutece.util.ReferenceList selectDocumentTypePortlets()
          Returns the list of the portlets which are document portlets
 int selectNbrSubscribers(int nNewsLetterId, java.lang.String strSearchString, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Counts the subscribers for a newsletter
 int[] selectNewsletterThemeIds(int nNewsletterId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          loads the list of documents
 fr.paris.lutece.util.ReferenceList selectThemesFromIds(int[] nKeyArray)
          loads the list of topics from a given list of ids
 void store(NewsLetter newsLetter, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Update the record in the table
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NewsLetterDAO

public NewsLetterDAO()
Method Detail

insert

public void insert(NewsLetter newsLetter,
                   fr.paris.lutece.portal.service.plugin.Plugin plugin)
Insert a new record in the table.

Specified by:
insert in interface INewsLetterDAO
Parameters:
newsLetter - the object to insert
plugin - the Plugin

delete

public void delete(int nNewsLetterId,
                   fr.paris.lutece.portal.service.plugin.Plugin plugin)
Remove a record from the table

Specified by:
delete in interface INewsLetterDAO
Parameters:
nNewsLetterId - the newsletter identifier
plugin - the Plugin

load

public NewsLetter load(int nNewsLetterId,
                       fr.paris.lutece.portal.service.plugin.Plugin plugin)
loads the data of the newsletter from the table

Specified by:
load in interface INewsLetterDAO
Parameters:
nNewsLetterId - the newsletter identifier
plugin - the Plugin
Returns:
the object inserted

store

public void store(NewsLetter newsLetter,
                  fr.paris.lutece.portal.service.plugin.Plugin plugin)
Update the record in the table

Specified by:
store in interface INewsLetterDAO
Parameters:
newsLetter - the object to be updated
plugin - the Plugin

checkPrimaryKey

public boolean checkPrimaryKey(int nKey,
                               fr.paris.lutece.portal.service.plugin.Plugin plugin)
Check the unicity of the primary key

Specified by:
checkPrimaryKey in interface INewsLetterDAO
Parameters:
nKey - the key to be checked
plugin - the Plugin
Returns:
true if the identifier exist and false if not

checkLinkedPortlet

public boolean checkLinkedPortlet(int nIdNewsletter)
Check whether a portlet is linked to a newsletter

Specified by:
checkLinkedPortlet in interface INewsLetterDAO
Parameters:
nIdNewsletter - the id of the newsletter
Returns:
true if the newsletter is used by subscription portlet

newPrimaryKey

public int newPrimaryKey(fr.paris.lutece.portal.service.plugin.Plugin plugin)
Generate a new primary key to add a newsletter

Specified by:
newPrimaryKey in interface INewsLetterDAO
Parameters:
plugin - the Plugin
Returns:
the new key

selectAll

public java.util.Collection<NewsLetter> selectAll(fr.paris.lutece.portal.service.plugin.Plugin plugin)
Select the list of the newsletters available

Specified by:
selectAll in interface INewsLetterDAO
Parameters:
plugin - the Plugin
Returns:
a collection of objects

insertSubscriber

public void insertSubscriber(int nNewsLetterId,
                             int nSubscriberId,
                             java.sql.Timestamp tToday,
                             fr.paris.lutece.portal.service.plugin.Plugin plugin)
Insert a new subscriber for a newsletter

Specified by:
insertSubscriber in interface INewsLetterDAO
Parameters:
nNewsLetterId - the newsletter identifier
nSubscriberId - the subscriber identifier
tToday - The day
plugin - the Plugin

deleteSubscriber

public void deleteSubscriber(int nNewsLetterId,
                             int nSubscriberId,
                             fr.paris.lutece.portal.service.plugin.Plugin plugin)
Remove the subscriber's inscription to a newsletter

Specified by:
deleteSubscriber in interface INewsLetterDAO
Parameters:
nNewsLetterId - the newsletter identifier
nSubscriberId - the subscriber identifier
plugin - the Plugin

isRegistered

public boolean isRegistered(int nNewsLetterId,
                            int nSubscriberId,
                            fr.paris.lutece.portal.service.plugin.Plugin plugin)
check if the subscriber is not yet registered to a newsletter

Specified by:
isRegistered in interface INewsLetterDAO
Parameters:
nNewsLetterId - the newsletter identifier
nSubscriberId - the subscriber identifier
plugin - the Plugin
Returns:
true if he is registered and false if not

isTemplateUsed

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

Specified by:
isTemplateUsed in interface INewsLetterDAO
Parameters:
nTemplateId - the template identifier
plugin - the Plugin
Returns:
true if the template is used, false if not

selectThemesFromIds

public fr.paris.lutece.util.ReferenceList selectThemesFromIds(int[] nKeyArray)
loads the list of topics from a given list of ids

Specified by:
selectThemesFromIds in interface INewsLetterDAO
Parameters:
nKeyArray - the theme identifiers list
Returns:
the list of topics

selectDocumentList

public java.lang.String selectDocumentList(int nPortletId)
loads the list of document

Specified by:
selectDocumentList in interface INewsLetterDAO
Parameters:
nPortletId - the portlet id
Returns:
the name of the topic

selectNewsletterThemeIds

public int[] selectNewsletterThemeIds(int nNewsletterId,
                                      fr.paris.lutece.portal.service.plugin.Plugin plugin)
loads the list of documents

Specified by:
selectNewsletterThemeIds in interface INewsLetterDAO
Parameters:
nNewsletterId - the newsletter identifier
plugin - the plugin
Returns:
the array of ids

associateNewsLetterTheme

public void associateNewsLetterTheme(int nNewsLetterId,
                                     int nThemeId,
                                     fr.paris.lutece.portal.service.plugin.Plugin plugin)
Associate a new topic to a newsletter

Specified by:
associateNewsLetterTheme in interface INewsLetterDAO
Parameters:
nNewsLetterId - the newsletter identifier
nThemeId - the topic identifier
plugin - the Plugin

deleteNewsLetterTheme

public void deleteNewsLetterTheme(int nNewsLetterId,
                                  fr.paris.lutece.portal.service.plugin.Plugin plugin)
Remove the relationship between a newsletter and the list of themes

Specified by:
deleteNewsLetterTheme in interface INewsLetterDAO
Parameters:
nNewsLetterId - the newsletter identifier
plugin - the Plugin

selectDocumentsByDateAndList

public java.util.Collection<fr.paris.lutece.plugins.document.business.Document> selectDocumentsByDateAndList(int nPortletId,
                                                                                                             java.sql.Timestamp dateLastSending)
Select the list of documents published since the last sending of the newsletter

Specified by:
selectDocumentsByDateAndList in interface INewsLetterDAO
Parameters:
nPortletId - the topic identifier to select documents
dateLastSending - the date of the last newsletter sending
Returns:
a list of documents

selectNbrSubscribers

public int selectNbrSubscribers(int nNewsLetterId,
                                java.lang.String strSearchString,
                                fr.paris.lutece.portal.service.plugin.Plugin plugin)
Counts the subscribers for a newsletter

Specified by:
selectNbrSubscribers in interface INewsLetterDAO
Parameters:
nNewsLetterId - the newsletter newsletter
strSearchString - the string to search in the subscriber's email
plugin - the Plugin
Returns:
the number of subscribers

selectDocumentTypePortlets

public fr.paris.lutece.util.ReferenceList selectDocumentTypePortlets()
Returns the list of the portlets which are document portlets

Specified by:
selectDocumentTypePortlets in interface INewsLetterDAO
Returns:
the list in form of a Collection object

deleteAllSubscribers

public void deleteAllSubscribers(int nNewsLetterId,
                                 fr.paris.lutece.portal.service.plugin.Plugin plugin)
Removes all the subscribers attached to a newsletter

Parameters:
nNewsLetterId - the newsletter identifier
plugin - the Plugin


Copyright © 2007 Mairie de Paris. All Rights Reserved.