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