1 /* 2 * Copyright (c) 2002-2021, City of Paris 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * 1. Redistributions of source code must retain the above copyright notice 10 * and the following disclaimer. 11 * 12 * 2. Redistributions in binary form must reproduce the above copyright notice 13 * and the following disclaimer in the documentation and/or other materials 14 * provided with the distribution. 15 * 16 * 3. Neither the name of 'Mairie de Paris' nor 'Lutece' nor the names of its 17 * contributors may be used to endorse or promote products derived from 18 * this software without specific prior written permission. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE 24 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 * POSSIBILITY OF SUCH DAMAGE. 31 * 32 * License 1.0 33 */ 34 package fr.paris.lutece.plugins.newsletter.service.topic; 35 36 import fr.paris.lutece.plugins.newsletter.business.topic.NewsletterTopic; 37 import fr.paris.lutece.portal.business.user.AdminUser; 38 39 import java.util.Locale; 40 import java.util.Map; 41 42 /** 43 * Interface of services that provide topics for newsletters 44 */ 45 public interface INewsletterTopicService 46 { 47 /** 48 * Get the unique code of the topic type associated with this service. 49 * 50 * @return The unique code of the topic type associated with this service. 51 */ 52 String getNewsletterTopicTypeCode( ); 53 54 /** 55 * Get the localized name of the topic type associated with this service. 56 * 57 * @param locale 58 * The locale to use 59 * @return The name of the topic type associated with this service in the given locale. 60 */ 61 String getNewsletterTopicTypeName( Locale locale ); 62 63 /** 64 * Check if topics of this topic type need a configuration or not. 65 * 66 * @return True if topics of this topic type has a configuration page or not. 67 */ 68 boolean hasConfiguration( ); 69 70 /** 71 * Get the configuration page of the content type. 72 * 73 * @param newsletterTopic 74 * The newsletter topic to get the configuration of. 75 * @param strBaseUrl 76 * The base url 77 * @param user 78 * The current user 79 * @param locale 80 * The locale 81 * @return The HTML code of the configuration page 82 */ 83 String getConfigurationPage( NewsletterTopic newsletterTopic, String strBaseUrl, AdminUser user, Locale locale ); 84 85 /** 86 * @param mapParameters 87 * The collection of parameters of the configuration. Those parameters are request parameters in request contexts. 88 * @param newsletterTopic 89 * The newsletter topic to get the configuration of. 90 * @param user 91 * The current user 92 * @param locale 93 * The locale 94 */ 95 void saveConfiguration( Map<String, String [ ]> mapParameters, NewsletterTopic newsletterTopic, AdminUser user, Locale locale ); 96 97 /** 98 * Creates a new topic for a newsletter 99 * 100 * @param newsletterTopic 101 * The details of the topic to create 102 * @param user 103 * The current user 104 * @param locale 105 * The locale 106 */ 107 void createNewsletterTopic( NewsletterTopic newsletterTopic, AdminUser user, Locale locale ); 108 109 /** 110 * Remove a newsletter topic from its id. 111 * 112 * @param nNewsletterTopicId 113 * The id of the topic to remove. 114 */ 115 void removeNewsletterTopic( int nNewsletterTopicId ); 116 117 /** 118 * Get the html content of a topic. 119 * 120 * @param newsletterTopic 121 * The topic to get the html of. 122 * @param user 123 * The current user 124 * @param locale 125 * The locale 126 * @return The html content describing the topic to add to the newsletter. 127 */ 128 String getHtmlContent( NewsletterTopic newsletterTopic, AdminUser user, Locale locale ); 129 130 /** 131 * Copy a topic for a newsletter. 132 * 133 * @param id 134 * of the old newsletterTopic 135 * @param newsletterTopic 136 * The details of the topic to create 137 * @param user 138 * The current user 139 * @param locale 140 * The locale 141 */ 142 void copyNewsletterTopic( int oldTopicId, NewsletterTopic newsletterTopic, AdminUser user, Locale locale ); 143 }