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 35 package fr.paris.lutece.plugins.campaign.business; 36 37 import fr.paris.lutece.portal.service.plugin.Plugin; 38 import fr.paris.lutece.util.ReferenceList; 39 40 import java.util.Collection; 41 import java.util.List; 42 import java.util.Map; 43 44 /** 45 * IThemeDAO Interface 46 */ 47 public interface IThemeDAO 48 { 49 /** 50 * Insert a new record in the table. 51 * 52 * @param theme 53 * instance of the Theme object to insert 54 * @param plugin 55 * the Plugin 56 */ 57 void insert( Theme theme, Plugin plugin ); 58 59 /** 60 * Update the record in the table 61 * 62 * @param theme 63 * the reference of the Theme 64 * @param plugin 65 * the Plugin 66 */ 67 void store( Theme theme, Plugin plugin ); 68 69 /** 70 * Delete a record from the table 71 * 72 * @param nKey 73 * The identifier of the Theme to delete 74 * @param plugin 75 * the Plugin 76 */ 77 void delete( int nKey, Plugin plugin ); 78 79 /////////////////////////////////////////////////////////////////////////// 80 // Finders 81 82 /** 83 * Load the data from the table 84 * 85 * @param nKey 86 * The identifier of the theme 87 * @param plugin 88 * the Plugin 89 * @return The instance of the theme 90 */ 91 Theme load( int nKey, Plugin plugin ); 92 93 /** 94 * Load the data of all the theme objects and returns them as a list 95 * 96 * @param plugin 97 * the Plugin 98 * @return The list which contains the data of all the theme objects 99 */ 100 List<Theme> selectThemesList( Plugin plugin ); 101 102 /** 103 * Load the id of all the theme objects and returns them as a list 104 * 105 * @param plugin 106 * the Plugin 107 * @return The list which contains the id of all the theme objects 108 */ 109 List<Integer> selectIdThemesList( Plugin plugin ); 110 111 /** 112 * Load the data of all the theme objects and returns them as a referenceList 113 * 114 * @param plugin 115 * the Plugin 116 * @return The referenceList which contains the data of all the theme objects 117 */ 118 ReferenceList selectThemesReferenceList( Plugin plugin ); 119 120 /** 121 * Load the data of all the Theme objects for a campaign and returns them as a collection 122 * 123 * @param campaignCode 124 * Code de la campagne courante 125 * @param plugin 126 * the Plugin 127 * @return The collection which contains the data of all the Theme objects 128 */ 129 Collection<Theme> selectThemesListByCampaign( String codeCampaign, Plugin plugin ); 130 131 /** 132 * Load the data of all the Theme objects mapped from campaign and returns them as a map 133 * 134 * @param plugin 135 * the Plugin 136 * @return The collection which contains the data of all the Theme objects 137 */ 138 Map<String, List<Theme>> selectThemesMapByCampaign( Plugin plugin ); 139 140 /** 141 * Load the data from the table 142 * 143 * @param codeTheme 144 * The identifier of the Theme 145 * @param plugin 146 * the Plugin 147 * @return The instance of the Theme 148 */ 149 Theme loadByCodeTheme( String codeTheme, Plugin plugin ); 150 }