View Javadoc
1   /*
2    * Copyright (c) 2002-2023, 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.plugins.document.business.publication;
35  
36  import java.util.Collection;
37  import java.util.Date;
38  
39  /**
40   *
41   * This class porvides Data Access methods for DocumentPublicationDAO interface
42   *
43   */
44  public interface IDocumentPublicationDAO
45  {
46      /**
47       * Insert the documentsPublication object
48       *
49       * @param documentPublication
50       *            The document Publication object
51       */
52      void insert( DocumentPublication documentPublication );
53  
54      /**
55       * Update the {@link DocumentPublication} object
56       *
57       * @param documentPublication
58       *            The {@link DocumentPublication} object
59       */
60      void store( DocumentPublication documentPublication );
61  
62      /**
63       * Delete records for table document_published specified by portlet id and document id
64       *
65       * @param nPortletId
66       *            the portlet identifier
67       * @param nDocumentId
68       *            the document identifier
69       */
70      void delete( int nPortletId, int nDocumentId );
71  
72      /**
73       * Delete records for table document_published specified by portlet id
74       *
75       * @param nPortletId
76       *            the portlet identifier
77       */
78      void deleteFromPortletId( int nPortletId );
79  
80      /**
81       * Delete records for table document_published specified by portlet id
82       *
83       * @param nDocumentId
84       *            the document identifier
85       */
86      void deleteFromDocumentId( int nDocumentId );
87  
88      /**
89       * Select the {@link DocumentPublication} object specified by the portlet id and document id
90       * 
91       * @param nPortletId
92       *            The portlet identifier
93       * @param nDocumentId
94       *            The document identifier
95       * @return The {@link DocumentPublication} object or null if the object does not exists
96       */
97      DocumentPublication select( int nPortletId, int nDocumentId );
98  
99      /**
100      * Select the list of {@link DocumentPublication} objects specified by the portlet id
101      * 
102      * @param nPortletId
103      *            The portlet identifier
104      * @return The {@link DocumentPublication} objects list (empty list if no objects found)
105      */
106     Collection<DocumentPublication> selectByPortletId( int nPortletId );
107 
108     /**
109      * Select the list of {@link DocumentPublication} objects specified by the document id
110      * 
111      * @param nDocumentId
112      *            The document identifier
113      * @return The {@link DocumentPublication} objects list (empty list if no objects found)
114      */
115     Collection<DocumentPublication> selectByDocumentId( int nDocumentId );
116 
117     /**
118      * Select the list of {@link DocumentPublication} objects specified by the portlet id and the status
119      * 
120      * @param nPortletId
121      *            The portlet identifier
122      * @param nStatus
123      *            The status
124      * @return The {@link DocumentPublication} objects list (empty list if no objects found)
125      */
126     Collection<DocumentPublication> selectByPortletIdAndStatus( int nPortletId, int nStatus );
127 
128     /**
129      * Select the list of {@link DocumentPublication} objects specified by the document id and the status
130      * 
131      * @param nDocumentId
132      *            The document identifier
133      * @param nStatus
134      *            The status
135      * @return The {@link DocumentPublication} objects list (empty list if no objects found)
136      */
137     Collection<DocumentPublication> selectByDocumentIdAndStatus( int nDocumentId, int nStatus );
138 
139     /**
140      * Find the list of {@link DocumentPublication} objects specified the status and published at or after the specified date
141      * 
142      * @param datePublishing
143      *            The publication date
144      * @param nStatus
145      *            The status
146      * @return The {@link DocumentPublication} objects {@link Collection} ordered by documentOrder ascending. The list is empty if no objects found.
147      */
148     Collection<DocumentPublication> selectSinceDatePublishingAndStatus( Date datePublishing, int nStatus );
149 
150     /**
151      * Select the max order from a list of {@link DocumentPublication} specified by portlet id
152      * 
153      * @param nPortletId
154      *            the portlet identifer
155      * @return The max order of document
156      */
157     int selectMaxDocumentOrder( int nPortletId );
158 
159     /**
160      * Return a document identifier in a distinct order
161      *
162      * @param nDocumentOrder
163      *            The order number
164      * @param nPortletId
165      *            the portlet identifier
166      * @return The order of the Document
167      */
168     int selectDocumentIdByOrder( int nDocumentOrder, int nPortletId );
169 }