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.blog.business; 35 36 import fr.paris.lutece.portal.service.plugin.Plugin; 37 import fr.paris.lutece.util.ReferenceList; 38 39 import java.util.List; 40 41 /** 42 * IBlogDAO Interface 43 */ 44 public interface IBlogDAO 45 { 46 /** 47 * Insert a new record in the table. 48 * 49 * @param blog 50 * instance of the Blog object to insert 51 * @param plugin 52 * the Plugin 53 */ 54 void insert( Blog blog, Plugin plugin ); 55 56 /** 57 * Insert a new record in the table. 58 * 59 * @param blog 60 * instance of the blog object to insert 61 * @param plugin 62 * the Plugin 63 */ 64 void insertVersion( Blog blog, Plugin plugin ); 65 66 /** 67 * Update the record in the table 68 * 69 * @param blog 70 * the reference of the blog 71 * @param plugin 72 * the Plugin 73 */ 74 void store( Blog blog, Plugin plugin ); 75 76 /** 77 * Delete a record from the table 78 * 79 * @param nKey 80 * The identifier of the blog to delete 81 * @param plugin 82 * the Plugin 83 */ 84 void delete( int nKey, Plugin plugin ); 85 86 /** 87 * Delete a record from the table 88 * 89 * @param nKey 90 * The identifier of the blog to delete 91 * @param plugin 92 * the Plugin 93 */ 94 void deleteVersions( int nKey, Plugin plugin ); 95 96 /** 97 * Delete a blog's specific version record from the table 98 * 99 * @param nIdBlog 100 * The identifier of the blog to process 101 * @param nVersion 102 * The value of the version to delete 103 * @param plugin 104 * the Plugin 105 */ 106 void deleteSpecificVersion( int nIdBlog, int nVersion, Plugin plugin ); 107 108 // ///////////////////////////////////////////////////////////////////////// 109 // Finders 110 111 /** 112 * Load the data from the table 113 * 114 * @param nKey 115 * The identifier of the blog 116 * @param plugin 117 * the Plugin 118 * @return The instance of the blog 119 */ 120 Blog load( int nKey, Plugin plugin ); 121 122 /** 123 * Load the data from the table 124 * 125 * @param strName 126 * The name of the blog 127 * @param plugin 128 * the Plugin 129 * @return The instance of the blog 130 */ 131 Blog loadByName( String strName, Plugin plugin ); 132 133 /** 134 * Load the data from the table 135 * 136 * @param nId 137 * The identifier of the blog 138 * @param nVersion 139 * The version 140 * @param plugin 141 * the Plugin 142 * @return The instance of the blog 143 */ 144 Blog loadVersion( int nId, int nVersion, Plugin plugin ); 145 146 /** 147 * Load the data of all the blog objects and returns them as a list 148 * 149 * @param plugin 150 * the Plugin 151 * @return The list which contains the data of all the blog objects 152 */ 153 List<Blog> selectBlogsList( Plugin plugin ); 154 155 /** 156 * Load the data of nLimit last modified blog objects and returns them as a list 157 * 158 * @param plugin 159 * the Plugin 160 * @param nLimit 161 * number of blogument 162 * @return The list which contains the data of of nLimit last modified blog objects 163 */ 164 List<Blog> selectlastModifiedBlogsList( Plugin plugin, int nLimit ); 165 166 /** 167 * Load the data of nLimit last versions of a specific blog and returns them as a list 168 * 169 * @param nId 170 * The blog's primary key 171 * @param nLimit 172 * Maximum amount of Blog Object versions to return 173 * @return The list which contains the data of nLimit last versions of the blog 174 */ 175 List<Blog> selectLastBlogVersionsList( int nId, int nLimit, Plugin plugin ); 176 177 /** 178 * Load the data of all the blog objects and returns them as a list 179 * 180 * @param plugin 181 * the Plugin 182 * @return The list which contains the data of all the blog objects 183 */ 184 List<Blog> selectBlogsVersionsList( int nId, Plugin plugin ); 185 186 /** 187 * Load the data of all the users edited the blog and returns them as a list 188 * 189 * @param plugin 190 * the Plugin 191 * @return The list which contains the data of all the users edited blog objects 192 */ 193 List<String> selectAllUsersEditedBlog( int nId, Plugin plugin ); 194 195 /** 196 * Load the id of all the Blog objects and returns them as a list 197 * 198 * @param plugin 199 * the Plugin 200 * @return The list which contains the id of all the Blog objects 201 */ 202 List<Integer> selectIdBlogsList( Plugin plugin ); 203 204 /** 205 * Load the data of all the Blog objects and returns them as a referenceList 206 * 207 * @param plugin 208 * the Plugin 209 * @return The referenceList which contains the data of all the Blog objects 210 */ 211 ReferenceList selectBlogsReferenceList( Plugin plugin ); 212 213 /** 214 * Load the list of Blogs 215 * 216 * @param filter 217 * The BlogFilter Object 218 * @return The Collection of the Blogss 219 */ 220 List<Blog> selectByFilter( BlogFilter filter ); 221 222 /** 223 * Load the list of Blogs objects and returns them as a list 224 * 225 * @param nIdTag 226 * @param plugin 227 * the Plugin 228 * @return the list of Blogs objects 229 */ 230 List<Blog> loadBlogByIdTag( int nIdTag, Plugin plugin ); 231 232 List<Blog> selectWithoutBinaries( Plugin plugin ); 233 234 }