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