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.page;
35
36 import fr.paris.lutece.portal.service.image.ImageResource;
37 import fr.paris.lutece.util.ReferenceList;
38
39 import java.util.Collection;
40 import java.util.List;
41
42
43 /**
44 * IPageDAO Interface
45 */
46 public interface IPageDAO
47 {
48 /**
49 * Insert a new record in the table.
50 * @param page The Page object
51 */
52 void insert( Page page );
53
54 /**
55 * load the data of level from the table
56 * @param nPageId The identifier of the object Page
57 * @param bPortlets The boolean
58 * @return The Instance of the object Page
59 */
60 Page load( int nPageId, boolean bPortlets );
61
62 /**
63 * load the data of level from the table without image content
64 * @param nPageId The identifier of the object Page
65 * @param bPortlets The boolean
66 * @return The Instance of the object Page
67 */
68 Page loadWithoutImageContent( int nPageId, boolean bPortlets );
69
70 /**
71 * load a page associated to a portlet
72 * @param nPorletId The identifier of the object portlet associate to the page
73 * @return The Instance of the object Page
74 */
75 Page loadPageByIdPortlet( int nPorletId );
76
77 /**
78 * Delete a record from the table
79 * @param nPageId The identifier of the object nPageId
80 */
81 void delete( int nPageId );
82
83 /**
84 * Update the record in the table
85 * @param page The instance of the page to update
86 */
87 void store( Page page );
88
89 /**
90 * Select all the child pages for a page which is specified in parameter
91 *
92 * @param nParentPageId The parent page identifier
93 * @return The list of objects Page (without portlets list)
94 */
95 Collection<Page> selectChildPages( int nParentPageId );
96
97 /**
98 * Select all child pages for a page which is specified in parameter
99 * For each pages, only select : Id, pageParentId, name and description
100 * @param nParentPageId the ParentPageId identifier
101 * @return The list of objects Page
102 */
103 Collection<Page> selectChildPagesMinimalData( int nParentPageId );
104
105 /**
106 * Loads all the pages for a portal
107 * @return The pages of the current portal (without portlets list, of course !)
108 */
109 List<Page> selectAllPages( );
110
111 /**
112 * Invalidate the page after a modification
113 *
114 * @param nPageId the page identifier
115 */
116 void invalidatePage( int nPageId );
117
118 /**
119 * Load the Referencelist of documentTypes
120 * @return listDocumentTypes
121 */
122 ReferenceList getPagesList( );
123
124 /**
125 * Return the list of all the pages filtered by Lutece Role specified in parameter
126 *
127 * @param strRoleKey The Lutece Role key
128 * @return a collection of pages
129 */
130 Collection<Page> getPagesByRoleKey( String strRoleKey );
131
132 /**
133 * Search the last order of child page list
134 * @param nParentPageId The parent page Id
135 * @return The new page order
136 */
137 int selectNewChildPageOrder( int nParentPageId );
138
139 /**
140 * Load a image corresponding to an Page
141 *
142 * @param nIdPage The Page Id
143 * @return the instance of the ImageContent
144 */
145 ImageResource loadImageResource( int nIdPage );
146
147 /**
148 * Tests if page exist
149 *
150 * @param nPageId The identifier of the document
151 * @return true if the page existed, false otherwise
152 */
153 boolean checkPageExist( int nPageId );
154
155 /**
156 * Load the last modified page
157 * @return the last modified {@link Page}
158 */
159 Page loadLastModifiedPage( );
160
161 /**
162 * Update the authorization node of the page
163 * @param nIdPage the page id
164 * @param nIdAuthorizationNode the authorization node id
165 */
166 void updateAutorisationNode( int nIdPage, Integer nIdAuthorizationNode );
167
168 /**
169 * select list of children Pages Which Must Change their authorization node
170 * @param nIdParentPage the id of the parent page
171 * @return an id list
172 */
173 List<Integer> selectPageForChangeAutorisationNode( int nIdParentPage );
174 }