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 List<Blog> selectBlogsListByArchiveStatus( boolean isArchived, Plugin plugin );
156
157 /**
158 * Load the data of nLimit last modified blog objects and returns them as a list
159 *
160 * @param plugin
161 * the Plugin
162 * @param nLimit
163 * number of blogument
164 * @return The list which contains the data of of nLimit last modified blog objects
165 */
166 List<Blog> selectlastModifiedBlogsList( Plugin plugin, int nLimit );
167
168 /**
169 * Load the data of nLimit last versions of a specific blog and returns them as a list
170 *
171 * @param nId
172 * The blog's primary key
173 * @param nLimit
174 * Maximum amount of Blog Object versions to return
175 * @return The list which contains the data of nLimit last versions of the blog
176 */
177 List<Blog> selectLastBlogVersionsList( int nId, int nLimit, Plugin plugin );
178
179 /**
180 * Load the data of all the blog objects and returns them as a list
181 *
182 * @param plugin
183 * the Plugin
184 * @return The list which contains the data of all the blog objects
185 */
186 List<Blog> selectBlogsVersionsList( int nId, Plugin plugin );
187
188 /**
189 * Load the data of all the users edited the blog and returns them as a list
190 *
191 * @param plugin
192 * the Plugin
193 * @return The list which contains the data of all the users edited blog objects
194 */
195 List<String> selectAllUsersEditedBlog( int nId, Plugin plugin );
196
197 /**
198 * Load the id of all the Blog objects and returns them as a list
199 *
200 * @param plugin
201 * the Plugin
202 * @return The list which contains the id of all the Blog objects
203 */
204 List<Integer> selectIdBlogsList( Plugin plugin );
205
206 /**
207 * Load the data of all the Blog objects and returns them as a referenceList
208 *
209 * @param plugin
210 * the Plugin
211 * @return The referenceList which contains the data of all the Blog objects
212 */
213 ReferenceList selectBlogsReferenceList( Plugin plugin );
214
215 /**
216 * Load the list of Blogs
217 *
218 * @param filter
219 * The BlogFilter Object
220 * @return The Collection of the Blogss
221 */
222 List<Blog> selectByFilter( BlogFilter filter );
223
224 /**
225 * Load the list of Blogs objects and returns them as a list
226 *
227 * @param nIdTag
228 * @param plugin
229 * the Plugin
230 * @return the list of Blogs objects
231 */
232 List<Blog> loadBlogByIdTag( int nIdTag, Plugin plugin );
233
234 List<Blog> selectWithoutBinaries( Plugin plugin );
235
236 int getActualVersionNumber( java.sql.Timestamp strUpdateDate, int nId, fr.paris.lutece.portal.service.plugin.Plugin plugin );
237
238 void updateBlogArchiveId( int nIdBlog, boolean bArchive, Plugin plugin );
239 }