View Javadoc
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.dbpage.business;
35  
36  import fr.paris.lutece.portal.service.plugin.Plugin;
37  import fr.paris.lutece.util.ReferenceList;
38  
39  import java.util.Collection;
40  import java.util.List;
41  
42  
43  /**
44  *  IDbPageDatabaseSectionDAO interface
45   */
46  public interface IDbPageDatabaseSectionDAO
47  {
48      /**
49       * Insert a new record in the table.
50       * @param dbPageDatabaseSection The dbPageDatabaseSection object
51       * @param plugin The plugin
52       */
53      void insert( DbPageDatabaseSection dbPageDatabaseSection, Plugin plugin );
54  
55      /**
56       * Calculates the number of sections in a page
57       * @param nDbPageId The id of the page
58       * @param plugin The plugin
59       * @return The number of sections
60       */
61      int countSections( int nDbPageId, Plugin plugin );
62  
63      /**
64       * Delete a record from the table
65       * @param nDbPageDatabaseSectionId The DbPageDatabaseSection Id
66       * @param plugin The plugin
67       */
68      void delete( int nDbPageDatabaseSectionId, Plugin plugin );
69  
70      /**
71       * Modify the order of a section
72       * @param nPageId The Page identifier
73       * @param nNewOrder The order number
74       * @param nIdSection The Section identifier
75       * @param plugin The plugin
76       */
77      void getModifySectionOrder( int nPageId, int nNewOrder, int nIdSection, Plugin plugin );
78  
79      /**
80       * Load the data of DbPageDatabaseSection from the table
81       * @param nDbPageDatabaseSectionId The identifier of DbPageDatabaseSection
82       * @param plugin The plugin
83       * @return the instance of the DbPageDatabaseSection
84       */
85      DbPageDatabaseSection load( int nDbPageDatabaseSectionId, Plugin plugin );
86  
87      /**
88       * Load the sections related to a page
89       * @param nDbPageId The identifier of DbPageDatabase
90       * @param plugin The plugin
91       * @return the A List of the DbPageDatabaseSections
92       */
93      List<DbPageDatabaseSection> loadSectionsByPageId( int nDbPageId, Plugin plugin );
94  
95      /**
96       * This method is used to find the sections of a dbpage
97       * @param strRoleKey The role key
98       * @param plugin The plugin object
99       * @return Collection of DbPageDatabaseSection
100      */
101     Collection<DbPageDatabaseSection> loadSectionsByRoleKey( String strRoleKey, Plugin plugin );
102 
103     /**
104      * @param nIdSection1 the section order
105      * @param nOrderSection1 the section order
106      * @param nIdSection2 the section order
107      * @param nOrderSection2 the section order
108      * @param plugin The plugin
109      */
110     void reorderSections( int nIdSection1, int nOrderSection1, int nIdSection2, int nOrderSection2, Plugin plugin );
111 
112     /**
113      * Load the list of dbPageDatabaseSections by page
114      * @param plugin The plugin
115      * @return The List of the DbPageDatabaseSections
116      */
117     List<DbPageDatabaseSection> selectDbPageDatabaseSectionList( Plugin plugin );
118 
119     /**
120      * Returns the identifier of a section in a distinct order
121      * @param nPageId The identifier of the page
122      * @param nSectionOrder The order number
123      * @param plugin The plugin
124      * @return The order of the Section
125      */
126     int selectIdByOrder( int nPageId, int nSectionOrder, Plugin plugin );
127 
128     /**
129      * Returns the highest order on a page
130      * @param nPageId The identifier of the page
131      * @param plugin The plugin
132      * @return The order of the Section
133      */
134     int selectMaxIdOrder( int nPageId, Plugin plugin );
135 
136     /**
137      * Load the list of orders
138      * @param nPageId The identifier of the page
139      * @param plugin The plugin
140      * @return The ReferenceList of the Orders
141      */
142     ReferenceList selectOrderList( int nPageId, Plugin plugin );
143 
144     /**
145      * Update the record in the table
146      * @param plugin The plugin
147      * @param dbPageDatabaseSection The reference of dbPageDatabaseSection
148      */
149     void store( DbPageDatabaseSection dbPageDatabaseSection, Plugin plugin );
150     
151     boolean isSectionInPage(String strPageName, String strSection ,Plugin plugin );
152     
153 }