1 /* 2 * Copyright (c) 2002-2022, 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.portal.business.portlet; 35 36 import fr.paris.lutece.portal.business.stylesheet.StyleSheet; 37 import fr.paris.lutece.util.ReferenceList; 38 39 import java.util.Collection; 40 import java.util.List; 41 42 /** 43 * IPortletDAO Interface 44 * 45 */ 46 public interface IPortletDAO 47 { 48 /** 49 * Insert a new record in the table. NB : The portlet identifier will already been obtained by the portlet girl 50 * 51 * @param portlet 52 * the portlet to insert in the database 53 */ 54 void insert( Portlet portlet ); 55 56 /** 57 * Delete a record from the table and its alias 58 * 59 * @param nPortletId 60 * the identifier of the portlet to be deleted 61 */ 62 void delete( int nPortletId ); 63 64 /** 65 * Load the data of a portlet from the database 66 * 67 * @param nPortletId 68 * the portlet identifier 69 * @return the object Portlet initialized with the data of the database 70 */ 71 Portlet load( int nPortletId ); 72 73 /** 74 * Update the record in the table 75 * 76 * @param portlet 77 * the portlet reference 78 */ 79 void store( Portlet portlet ); 80 81 /** 82 * Update the portlet status : 0 for activated - 1 for suspended 83 * 84 * @param portlet 85 * the portlet to upadte in the database 86 * @param nStatus 87 * the status to update 88 */ 89 void updateStatus( Portlet portlet, int nStatus ); 90 91 /** 92 * Update the portlet status : 0 for activated - 1 for suspended 93 * 94 * @param portlet 95 * the portlet to upadte in the database 96 * @param nColumn 97 * the column to update 98 * @param nOrder 99 * the order to update 100 */ 101 void updatePosition( Portlet portlet, int nColumn, int nOrder ); 102 103 /** 104 * Returns the stylesheet of the portlet according to the mode 105 * 106 * @param nPortletId 107 * the identifier of the portlet 108 * @param nIdMode 109 * the selected mode 110 * @return the stylesheet 111 */ 112 StyleSheet selectXslFile( int nPortletId, int nIdMode ); 113 114 /** 115 * Returns the list of portlets in a distinct name 116 * 117 * @param strPortletName 118 * the name of portlet 119 * @return the list in form of Collection 120 */ 121 Collection<PortletImpl> selectPortletsListbyName( String strPortletName ); 122 123 /** 124 * Returns a list of portlets according to the selected type 125 * 126 * @param strPortletTypeId 127 * the portlet type 128 * @return the portlets in form of Collection 129 */ 130 List<Portlet> selectPortletsByType( String strPortletTypeId ); 131 132 /** 133 * Returns all the styles corresponding to a portlet type 134 * 135 * @param strPortletTypeId 136 * the identifier of the portlet type 137 * @return the list of styles in form of ReferenceList 138 */ 139 ReferenceList selectStylesList( String strPortletTypeId ); 140 141 /** 142 * Indicates if the portlet has alias in the database or not. 143 * 144 * @param nPortletId 145 * the identifier of the portlet 146 * @return true if the portlet has some alias, false if not. 147 */ 148 boolean hasAlias( int nPortletId ); 149 150 /** 151 * Returns the instance of the PortletType whose identifier is specified in parameter 152 * 153 * @param strPortletTypeId 154 * the identifier of the portlet type 155 * @return the instance of the portlet type 156 */ 157 PortletType selectPortletType( String strPortletTypeId ); 158 159 /** 160 * Returns the list of the portlets associated to the style 161 * 162 * @param nStyleId 163 * the identifier of the style 164 * @return the list of the portlets in form of a Collection of Portlets objects 165 */ 166 Collection<PortletImpl> selectPortletListByStyle( int nStyleId ); 167 168 /** 169 * Returns the list of the alias portlets associated to the original portlet 170 * 171 * @param nPortletId 172 * the original portlet id 173 * @return the list of alais portlets. 174 */ 175 Collection<Portlet> selectAliasesForPortlet( int nPortletId ); 176 177 /** 178 * Gets a collection of portlets associated to a given role 179 * 180 * @param strRole 181 * The role 182 * @return The collection 183 */ 184 Collection<Portlet> selectPortletsByRole( String strRole ); 185 186 /** 187 * Load the last modified portlet 188 * 189 * @return the last modified {@link Portlet} 190 */ 191 Portlet loadLastModifiedPortlet( ); 192 193 /** 194 * Get list of used orders for a column 195 * 196 * @param pageId 197 * the page id 198 * @param columnId 199 * the column id 200 * @return list of orders used for this column 201 */ 202 List<Integer> getUsedOrdersForColumns( int pageId, int columnId ); 203 }