1 /* 2 * Copyright (c) 2002-2014, Mairie de 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.digglike.service; 35 36 import fr.paris.lutece.plugins.digglike.business.Digg; 37 import fr.paris.lutece.plugins.digglike.business.DiggSubmit; 38 import fr.paris.lutece.plugins.digglike.business.IEntry; 39 import fr.paris.lutece.plugins.digglike.business.SubmitFilter; 40 import fr.paris.lutece.portal.business.style.Theme; 41 import fr.paris.lutece.portal.service.plugin.Plugin; 42 43 import org.springframework.transaction.annotation.Transactional; 44 45 import java.util.List; 46 import java.util.Locale; 47 import java.util.Map; 48 49 50 public interface IDiggSubmitService 51 { 52 /** 53 * Creation of an instance of record 54 * 55 * @param diggSubmit The instance of the diggSubmit which contains the informations to store 56 * @param plugin the Plugin 57 * @return the id of {@link Theme} diggsubmit 58 */ 59 @Transactional( "digglike.transactionManager" ) 60 int create( DiggSubmit diggSubmit, Plugin plugin, Locale locale ); 61 62 /** 63 * Remove the record whose identifier is specified in parameter 64 * 65 * @param nIdDiggSubmit the id of the diggSubmit 66 * @param plugin the Plugin 67 */ 68 @Transactional( "digglike.transactionManager" ) 69 void remove( int nIdDiggSubmit, Plugin plugin ); 70 71 /** 72 * Update of the diggSubmit which is specified in parameter 73 * 74 * @param diggSubmit The instance of the diggSubmit which contains the informations to update 75 * @param plugin the Plugin 76 * 77 */ 78 @Transactional( "digglike.transactionManager" ) 79 void update( DiggSubmit diggSubmit, Plugin plugin ); 80 81 /** 82 * Update of the diggSubmit which is specified in parameter 83 * @param diggSubmit 84 * @param bUpdateIndex 85 * @param plugin 86 */ 87 @Transactional( "digglike.transactionManager" ) 88 void update( DiggSubmit diggSubmit, boolean bUpdateIndex, Plugin plugin ); 89 90 /** 91 * Returns an instance of a DiggSubmit whose identifier is specified in parameter 92 * 93 * @param nKey The diggSubmit primary key 94 * @param bLoadCommentList true if the comment list must be get 95 * @param plugin the Plugin 96 * @return an instance of DiggSubmit 97 */ 98 DiggSubmit findByPrimaryKey( int nKey, boolean bLoadCommentList, Plugin plugin ); 99 100 /** 101 * Returns an instance of a DiggSubmit whose identifier is specified in parameter 102 * 103 * @param nKey The diggSubmit primary key 104 * @param bLoadCommentList true if the comment list must be get 105 * @param numberMaxCommentLoad the number max of parent comment Load 106 * @param plugin the Plugin 107 * @return an instance of DiggSubmit 108 */ 109 DiggSubmit findByPrimaryKey( int nKey, boolean bLoadCommentList, Integer numberMaxCommentLoad, Plugin plugin ); 110 111 /** 112 * Returns an instance of a DiggSubmit whose identifier is specified in parameter 113 * 114 * @param nKey The diggSubmit primary key 115 * @param bLoadCommentList true if the comment list must be get 116 * @param bLoadResponseList true if the response list must be get 117 * @param plugin the Plugin 118 * @return an instance of DiggSubmit 119 */ 120 DiggSubmit findByPrimaryKey( int nKey, boolean bLoadCommentList, boolean bLoadResponseList, Plugin plugin ); 121 122 /** 123 * Load the data of all the diggSubmit who verify the filter and returns them in a list 124 * @param filter the filter 125 * @param plugin the plugin 126 * @return the list of diggSubmit 127 */ 128 List<DiggSubmit> getDiggSubmitList( SubmitFilter filter, Plugin plugin ); 129 130 // /** 131 // * Load the data of all the diggSubmit with the number of comment by digg submit who verify the filter and returns them in a list 132 // * @param filter the filter 133 // * @param plugin the plugin 134 // * @return the list of diggSubmit 135 // */ 136 // List<DiggSubmit> getDiggSubmitListWithNumberComment( SubmitFilter filter, Plugin plugin ); 137 138 /** 139 * Load the id of all the diggSubmit who verify the filter and returns them in a list 140 * @param filter the filter 141 * @param plugin the plugin 142 * @return the list of diggSubmit id 143 */ 144 List<Integer> getDiggSubmitListId( SubmitFilter filter, Plugin plugin ); 145 146 /** 147 * Load the data of all the diggSubmit who verify the filter and returns them in a list 148 * @param filter the filter 149 * @param plugin the plugin 150 * @param nNumberMaxDiggSubmit Max Number of Diggsubmit return 151 * @return the list of diggSubmit 152 */ 153 List<DiggSubmit> getDiggSubmitList( SubmitFilter filter, Plugin plugin, int nNumberMaxDiggSubmit ); 154 155 /** 156 * Load the number of all the diggSubmit who verify the filter 157 * @param filter the filter 158 * @param plugin the plugin 159 * @return the list of diggSubmit 160 */ 161 int getCountDiggSubmit( SubmitFilter filter, Plugin plugin ); 162 163 /** 164 * return the id of the next digg submit in the list 165 * @param nIdCurrentDiggSubmit the id of the current digg submit 166 * @param filter the filter 167 * @param plugin the plugin 168 * @return the id of the next digg submit in the list 169 */ 170 int findNextIdDiggSubmitInTheList( int nIdCurrentDiggSubmit, SubmitFilter filter, Plugin plugin ); 171 172 /** 173 * return the id of the prev digg submit in the list 174 * @param nIdCurrentDiggSubmit the id of the current digg submit 175 * @param filter the filter 176 * @param plugin the plugin 177 * @return the id of the prev digg submit in the list 178 */ 179 int findPrevIdDiggSubmitInTheList( int nIdCurrentDiggSubmit, SubmitFilter filter, Plugin plugin ); 180 181 /** 182 * move an element in the list of diggSubmit and update the order 183 * @param nPositionElement the position of the element to move 184 * @param nNewPositionElement the new position of the element 185 * @param nIdDigg the digg id 186 * @param bListPinned true if the list to update contains only pinned diggsubmit 187 * @param plugin the plugin 188 */ 189 @Transactional( "digglike.transactionManager" ) 190 void updateDiggSubmitOrder( Integer nPositionElement, Integer nNewPositionElement, int nIdDigg, 191 boolean bListPinned, Plugin plugin ); 192 193 /** 194 * Search the max order number of contacts for one list 195 * @param nIdDigg the Id of the Digg 196 * @param bListPinned true if the list 197 * @return int the max order 198 * @param plugin The Plugin object 199 */ 200 int getMaxOrderList( int nIdDigg, boolean bListPinned, Plugin plugin ); 201 202 /** 203 * Update the display off all digg submit associated to a digg 204 * 205 * @param nIdDigg 206 * the id digg 207 * @param plugin the plugin 208 * 209 * @locale locale the locale 210 */ 211 @Transactional( "digglike.transactionManager" ) 212 void updateAllDisplayOfDiggSubmit( Integer nIdDigg, Plugin plugin, Locale locale ); 213 214 /** 215 * update the display of the diggsubmit 216 * @param nIdDiggSubmit the diggSubmit Id 217 * @param plugin the plugin 218 * @param locale the locale 219 * @param digg the digg 220 * @param mapEntry a map of entry assocaited to the digg 221 */ 222 @Transactional( "digglike.transactionManager" ) 223 void updateDisplayDiggSubmit( Integer nIdDiggSubmit, Plugin plugin, Locale locale, Digg digg, 224 Map<Integer, IEntry> mapEntry ); 225 }