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.portlet; 35 36 import java.util.Collection; 37 import java.util.Date; 38 import java.util.List; 39 40 import fr.paris.lutece.portal.service.plugin.Plugin; 41 42 public interface IBlogPublicationDAO 43 { 44 45 /** 46 * Insert a list of doc for a specified blogPublication 47 * 48 * @param blogPublication 49 * the blogPublication to insert 50 * @param plugin 51 * the plugin 52 */ 53 void insertBlogsId( BlogPublication blogPublication, Plugin plugin ); 54 55 /** 56 * Delete docs for the specified portlet 57 * 58 * @param nDocId 59 * The doc identifier 60 * @param plugin 61 * the plugin 62 */ 63 void deleteBlogsId( int nDocId, Plugin plugin ); 64 65 /** 66 * Load a list of BLOGPublication 67 * 68 * @param nDocId 69 * @param plugin 70 * the plugin 71 * @return List of IdDoc 72 */ 73 List<BlogPublication> loadBlogsId( int nDocId, Plugin plugin ); 74 75 /** 76 * load a list BLOGPublication by the portlet id 77 * 78 * @param nIdPortlet 79 * The protlet id 80 * @param plugin 81 * the plugin 82 * @return list of BLOGPublication 83 */ 84 List<BlogPublication> loadBlogsByPortlet( int nIdPortlet, Plugin plugin ); 85 86 /** 87 * Load a list BLOGPublication by the portlet id, and published at or after the specified date. 88 * 89 * @param nIdPortlet 90 * The portlet id 91 * @param datePublishing 92 * The publication end date 93 * @param dateEndPublishing 94 * The publication date 95 * @param plugin 96 * the plugin 97 * @return list of BLOGPublication 98 */ 99 List<BlogPublication> loadBlogsByPortletAndPublicationDate( int nIdPortlet, Date datePublishing, Date dateEndPublishing, Plugin plugin ); 100 101 /** 102 * Delete the BLOGPublication by portlet id 103 * 104 * @param nIdPortlet 105 * The portlet id 106 * @param plugin 107 * the plugin 108 */ 109 void deleteBlogByIdPortlet( int nIdPortlet, Plugin plugin ); 110 111 /** 112 * load a BLOGPublication by BLOG id and portlet id 113 * 114 * @param nPortletId 115 * The portlet id 116 * @param nDocId 117 * The blogs id 118 * @param plugin 119 * the plugin 120 * @return blogPublication 121 */ 122 BlogPublication loadBlogsPublication( int nPortletId, int nDocId, Plugin plugin ); 123 124 /** 125 * Update an instance of the BLOGPublication 126 * 127 * @param blogPublication 128 * the publication data 129 * @param plugin 130 * the plugin 131 */ 132 void store( BlogPublication blogPublication, Plugin plugin ); 133 134 /** 135 * Remove BLOGPublication by primary kley 136 * 137 * @param nDocId 138 * @param nIdPortlet 139 * @param plugin 140 * the plugin 141 */ 142 void remove( int nDocId, int nIdPortlet, Plugin plugin ); 143 144 /** 145 * Load all BLOGPublication 146 * 147 * @param plugin 148 * @return The list of BLOGPublication 149 */ 150 List<BlogPublication> loadAllBlogsPublication( Plugin plugin ); 151 152 /** 153 * Find the list of {@link BlogPublication} objects specified the status and published at or after the specified date 154 * 155 * @param datePublishing 156 * The publication end date 157 * @param dateEndPublishing 158 * The publication date 159 * @param nStatus 160 * The status 161 * @param plugin 162 * the plugin 163 * @return The {@link BlogPublication} objects {@link Collection} ordered by BlogOrder ascending. The list is empty if no objects found. 164 */ 165 Collection<BlogPublication> selectSinceDatePublishingAndStatus( Date datePublishing, Date dateEndPublishing, int nStatus, Plugin plugin ); 166 167 /** 168 * Get the list of id of published BLOGs associated with a given collection of portlets. 169 * 170 * @param nPortletsIds 171 * The list of portlet ids. 172 * @param datePublishing 173 * The publication date 174 * @param dateEndPublishing 175 * The publication end date 176 * @param plugin 177 * The blog plugin 178 * @return The list of blogs id. 179 */ 180 List<Integer> getPublishedBlogsIdsListByPortletIds( int [ ] nPortletsIds, Date datePublishing, Date dateEndPublishing, Plugin plugin ); 181 182 /** 183 * Get the list of published Blogs associated with given collection of portlets. Returns only the blogs updated after given dateUpdated 184 * 185 * @param nPortletsIds 186 * The list of portlets ids 187 * @param dateUpdatedFrom 188 * The date from the blogs had been updated 189 * @param plugin 190 * the plugin 191 * @return the list of blogs id 192 */ 193 List<Integer> getLastPublishedBlogsIdsListByPortletIds( int [ ] nPortletsIds, Date dateUpdatedFrom, Plugin plugin ); 194 195 /** 196 * Counts the number of valid publication of a blog at a given date. 197 * 198 * @param nIdBlog 199 * @param date 200 * @param plugin 201 * @return 202 */ 203 int countPublicationByIdBlogAndDate( int nIdBlog, Date date, Plugin plugin ); 204 }