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.whatsnew.business.portlet; 35 36 import fr.paris.lutece.plugins.whatsnew.business.PortletDocumentLink; 37 import fr.paris.lutece.portal.business.portlet.IPortletInterfaceDAO; 38 import fr.paris.lutece.portal.business.portlet.Portlet; 39 import fr.paris.lutece.portal.service.plugin.Plugin; 40 41 import java.util.List; 42 43 44 /** 45 * 46 * IWhatsNewPortletDAO 47 * 48 */ 49 public interface IWhatsNewPortletDAO extends IPortletInterfaceDAO 50 { 51 /** 52 * Delete a record from the table 53 * @param nPortletId The identifier of the portlet 54 */ 55 void delete( int nPortletId ); 56 57 /** 58 * Insert a new record in the table whatsnew_portlet 59 * @param portlet the instance of the Portlet object to insert 60 */ 61 void insert( Portlet portlet ); 62 63 /** 64 * Loads the data of What's new Portlet whose identifier is specified in parameter 65 * @param nPortletId The Portlet identifier 66 * @return the whatsNew object 67 */ 68 Portlet load( int nPortletId ); 69 70 /** 71 * Update the record in the table 72 * @param portlet The instance of the object portlet 73 */ 74 void store( Portlet portlet ); 75 76 /** 77 * Find all WhatsNew portlets 78 * @return a list of {@link WhatsNewPortlet} 79 */ 80 List<WhatsNewPortlet> findAll( ); 81 82 /** 83 * Load all page IDs associated to the given whatNewPortletId 84 * @param nWhatsNewPortletId the ID of the portlet 85 * @param plugin {@link Plugin} 86 * @return a list of page IDs 87 */ 88 List<Integer> loadPageIdsFromWhatsNewPortletId( int nWhatsNewPortletId, Plugin plugin ); 89 90 /** 91 * Insert a link between a whatsnew portlet and a page 92 * @param nWhatsNewPortletId the ID of the portlet 93 * @param nPageId the page ID 94 * @param plugin {@link Plugin} 95 */ 96 void insertPageForWhatsNew( int nWhatsNewPortletId, int nPageId, Plugin plugin ); 97 98 /** 99 * Delete all links of a whatsnew portlet to the pages 100 * @param nWhatsNewPortletId the ID of the portlet 101 * @param plugin {@link Plugin} 102 */ 103 void deletePagesFromWhatsNew( int nWhatsNewPortletId, Plugin plugin ); 104 105 /** 106 * Delete a link between a whatsnew portlet and a page 107 * @param nWhatsNewPortletId the ID of the portlet 108 * @param nPageId the page ID 109 * @param plugin {@link Plugin} 110 */ 111 void deleteLinkWhatsNewPortletToPage( int nWhatsNewPortletId, int nPageId, Plugin plugin ); 112 113 /** 114 * Load all portlet IDs associated to the given whatsNewPortletId 115 * @param nWhatsNewPortletId the ID of the portlet 116 * @param plugin {@link Plugin} 117 * @return a list of portlet IDs 118 */ 119 List<Integer> loadPortletIdsFromWhatsNewPortletId( int nWhatsNewPortletId, Plugin plugin ); 120 121 /** 122 * Insert a link between a whatsnew portlet and a portlet 123 * @param nWhatsNewPortletId the ID of the whatsnew portlet 124 * @param nPortletId the ID of the portlet 125 * @param plugin {@link Plugin} 126 */ 127 void insertPortletForWhatsNew( int nWhatsNewPortletId, int nPortletId, Plugin plugin ); 128 129 /** 130 * Delete all links of a whatsnew portlet to the portlets 131 * @param nWhatsNewPortletId the ID of the whatsnew portlet 132 * @param plugin {@link Plugin} 133 */ 134 void deletePortletsFromWhatsNew( int nWhatsNewPortletId, Plugin plugin ); 135 136 /** 137 * Delete a link between a whatsnew portlet and a portlet 138 * @param nWhatsNewPortletId the ID of the whatsnew portlet 139 * @param nPortletId the ID of the portlet 140 * @param plugin {@link Plugin} 141 */ 142 void deleteLinkWhatsNewPortletToPortlet( int nWhatsNewPortletId, int nPortletId, Plugin plugin ); 143 144 /** 145 * Load all the documents associated to the given whatsnewPortletId 146 * @param nWhatsNewPortletId the ID of the portlet 147 * @param plugin {@link Plugin} 148 * @return a list of {@link PortletDocumentLink} 149 */ 150 List<PortletDocumentLink> loadDocumentFromWhatsNewPortletId( int nWhatsNewPortletId, Plugin plugin ); 151 152 /** 153 * Insert a link between a document and a whatsnew portlet 154 * @param nWhatsNewId the ID of the whatsnew portlet 155 * @param pdLink {@link PortletDocumentLink} 156 * @param plugin {@link Plugin} 157 */ 158 void insertDocumentForWhatsNew( int nWhatsNewId, PortletDocumentLink pdLink, Plugin plugin ); 159 160 /** 161 * Delete all links of a whatsnew portlet to the documents 162 * @param nWhatsNewPortletId the ID of the portlet 163 * @param plugin {@link Plugin} 164 */ 165 void deleteDocumentsFromWhatsNew( int nWhatsNewPortletId, Plugin plugin ); 166 167 /** 168 * Delete a link between a whatsnew portlet and a document 169 * @param nWhatsNewPortletId the ID of the portlet 170 * @param pdLink {@link PortletDocumentLink} 171 * @param plugin {@link Plugin} 172 */ 173 void deleteLinkWhatsNewPortletToDocument( int nWhatsNewPortletId, PortletDocumentLink pdLink, Plugin plugin ); 174 }