fr.paris.lutece.plugins.newsletter.business.topic
Class NewsletterTopicDao

java.lang.Object
  extended by fr.paris.lutece.plugins.newsletter.business.topic.NewsletterTopicDao
All Implemented Interfaces:
INewsletterTopicDAO

public class NewsletterTopicDao
extends Object
implements INewsletterTopicDAO

DAO implementation for NewsletterTopic


Constructor Summary
NewsletterTopicDao()
           
 
Method Summary
 void fillBlankInOrder(int nIdNewsletter, int nOrder, int nSection, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Fill a blank in the order of topics of a newsletter.
 List<NewsletterTopic> findAllByIdNewsletter(int nIdNewsletter, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Get the list of NewsletterTopic associated with a given newsletter.
 List<NewsletterTopic> findByNewsletterIdAndOrder(int nIdNewsletter, int nOrder, int nSection, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Get the list of newsletter topics associated to a given newsletter and with the given order in a section
 NewsletterTopic findByPrimaryKey(int nId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Get a NewsletterTopic by its primary key from the database
 int getLastOrder(int nIdNewsletter, int nSection, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Get the highest order for a given newsletter and a given section
 int getNewOrder(int nIdNewsletter, int nSection, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Get the next available order value for topics of a newsletter
 void insert(NewsletterTopic newsletterTopic, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Insert a new NewsletterTopic into the database
 void remove(int nId, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Delete a NewsletterTopic from the database
 void removeAllByIdNewsletter(int nIdNewsletter, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Remove every topic associated with a given newsletter
 void update(NewsletterTopic newsletterTopic, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Update a NewsletterTopic in the database
 void updateNewsletterTopicOrder(int nIdNewsletterTopic, int nNewOrder, fr.paris.lutece.portal.service.plugin.Plugin plugin)
          Update the order of a newsletter topic
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NewsletterTopicDao

public NewsletterTopicDao()
Method Detail

findByPrimaryKey

public NewsletterTopic findByPrimaryKey(int nId,
                                        fr.paris.lutece.portal.service.plugin.Plugin plugin)
Get a NewsletterTopic by its primary key from the database

Specified by:
findByPrimaryKey in interface INewsletterTopicDAO
Parameters:
nId - The id of the NewsletterTopic to get
plugin - The plugin
Returns:
The NewsletterTopic with the given id, or null if no NewsletterTopic has this id.

insert

public void insert(NewsletterTopic newsletterTopic,
                   fr.paris.lutece.portal.service.plugin.Plugin plugin)
Insert a new NewsletterTopic into the database

Specified by:
insert in interface INewsletterTopicDAO
Parameters:
newsletterTopic - The NewsletterTopic to insert.
plugin - The plugin

update

public void update(NewsletterTopic newsletterTopic,
                   fr.paris.lutece.portal.service.plugin.Plugin plugin)
Update a NewsletterTopic in the database

Specified by:
update in interface INewsletterTopicDAO
Parameters:
newsletterTopic - The new values of the NewsletterTopic.
plugin - The plugin

remove

public void remove(int nId,
                   fr.paris.lutece.portal.service.plugin.Plugin plugin)
Delete a NewsletterTopic from the database

Specified by:
remove in interface INewsletterTopicDAO
Parameters:
nId - The id of the NewsletterTopic to delete.
plugin - The plugin

findAllByIdNewsletter

public List<NewsletterTopic> findAllByIdNewsletter(int nIdNewsletter,
                                                   fr.paris.lutece.portal.service.plugin.Plugin plugin)
Get the list of NewsletterTopic associated with a given newsletter.

Specified by:
findAllByIdNewsletter in interface INewsletterTopicDAO
Parameters:
nIdNewsletter - The id of the newsletter
plugin - The plugin
Returns:
The list of NewsletterTopic found.

updateNewsletterTopicOrder

public void updateNewsletterTopicOrder(int nIdNewsletterTopic,
                                       int nNewOrder,
                                       fr.paris.lutece.portal.service.plugin.Plugin plugin)
Update the order of a newsletter topic

Specified by:
updateNewsletterTopicOrder in interface INewsletterTopicDAO
Parameters:
nIdNewsletterTopic - The id of the newsletter topic to update
nNewOrder - The new order of the topic
plugin - The plugin

findByNewsletterIdAndOrder

public List<NewsletterTopic> findByNewsletterIdAndOrder(int nIdNewsletter,
                                                        int nOrder,
                                                        int nSection,
                                                        fr.paris.lutece.portal.service.plugin.Plugin plugin)
Get the list of newsletter topics associated to a given newsletter and with the given order in a section

Specified by:
findByNewsletterIdAndOrder in interface INewsletterTopicDAO
Parameters:
nIdNewsletter - The id of the newsletter the topic must be associated with.
nOrder - The order the topics must have
nSection - The section of the Topic
plugin - The plugin
Returns:
The list of newsletter topics. The list should contain only one or zero element. If it has more, then it indicates that several topics have the same order and should be reordered.

getNewOrder

public int getNewOrder(int nIdNewsletter,
                       int nSection,
                       fr.paris.lutece.portal.service.plugin.Plugin plugin)
Get the next available order value for topics of a newsletter

Specified by:
getNewOrder in interface INewsletterTopicDAO
Parameters:
nIdNewsletter - The id of the newsletter
nSection - The section of the newsletter
plugin - The plugin
Returns:
The next available order value

getLastOrder

public int getLastOrder(int nIdNewsletter,
                        int nSection,
                        fr.paris.lutece.portal.service.plugin.Plugin plugin)
Get the highest order for a given newsletter and a given section

Specified by:
getLastOrder in interface INewsletterTopicDAO
Parameters:
nIdNewsletter - The id of the newsletter
nSection - The id of the section
plugin - The plugin
Returns:
The highest order actually used for the given newsletter and the given section

fillBlankInOrder

public void fillBlankInOrder(int nIdNewsletter,
                             int nOrder,
                             int nSection,
                             fr.paris.lutece.portal.service.plugin.Plugin plugin)
Fill a blank in the order of topics of a newsletter.

Specified by:
fillBlankInOrder in interface INewsletterTopicDAO
Parameters:
nIdNewsletter - The newsletter to update the topics of
nOrder - The order with no topic
nSection - The section of topics to update
plugin - the plugin

removeAllByIdNewsletter

public void removeAllByIdNewsletter(int nIdNewsletter,
                                    fr.paris.lutece.portal.service.plugin.Plugin plugin)
Remove every topic associated with a given newsletter

Specified by:
removeAllByIdNewsletter in interface INewsletterTopicDAO
Parameters:
nIdNewsletter - The id of the newsletter to remove the topics of.
plugin - The plugin


Copyright © 2013 Mairie de Paris. All Rights Reserved.