1 /* 2 * Copyright (c) 2002-2017, 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.grubusiness.business.demand; 35 36 import fr.paris.lutece.plugins.grubusiness.business.notification.NotificationFilter; 37 import fr.paris.lutece.plugins.grubusiness.business.web.rs.DemandDisplay; 38 39 import java.util.Collection; 40 import java.util.List; 41 42 /** 43 * This interface represents a data access object for Demand object 44 * 45 */ 46 public interface IDemandDAO 47 { 48 /** 49 * Finds the demands associated to the specified customer id 50 * 51 * @param strCustomerId 52 * the customer id 53 * @return the demands. An empty collection is returned if no demands has been found. 54 */ 55 Collection<Demand> loadByCustomerId( String strCustomerId ); 56 57 /** 58 * Finds the demands associated to the specified reference 59 * 60 * @param strReference 61 * the reference 62 * @return the demands. An empty collection is returned if no demands has been found. 63 */ 64 Collection<Demand> loadByReference( String strReference ); 65 66 /** 67 * Search demands by filter 68 * 69 * @param filter 70 * @return the demands list 71 */ 72 Collection<Demand> loadByFilter( NotificationFilter filter ); 73 74 /** 75 * Search demands by filter 76 * 77 * @param filter 78 * @return the demands list 79 */ 80 List<Integer> loadIdsByFilter( NotificationFilter filter ); 81 82 /** 83 * load demands corresponding to the id list 84 * @param listIds 85 * @return the demands 86 */ 87 List<Demand> loadByIds( List<Integer> listIds); 88 89 /** 90 * Finds a demand with the specified id and type id 91 * 92 * @param strDemandId 93 * the demand id 94 * @param strDemandTypeId 95 * the demand type id 96 * @return the demand if found, {@code null} otherwise 97 */ 98 Demand load( String strDemandId, String strDemandTypeId ); 99 100 /** 101 * Insert a demand 102 * 103 * @param demand 104 * the demand to insert 105 * @return the inserted demand 106 */ 107 Demand insert( Demand demand ); 108 109 /** 110 * Stores a demand 111 * 112 * @param demand 113 * the demand to store 114 * @return the stored demand 115 */ 116 Demand store( Demand demand ); 117 118 /** 119 * Deletes a demand with the specified id and type id 120 * 121 * @param strDemandId 122 * the demand id 123 * @param strDemandTypeId 124 * the demand type id 125 */ 126 void delete( String strDemandId, String strDemandTypeId ); 127 128 /** 129 * Load the ids of the demands 130 * 131 * @return The list of demand ids 132 */ 133 List<String> loadAllIds( ); 134 135 /** 136 * Finds demands associated to the id 137 * 138 * @param strId 139 * @return the demand coresponding to given id. 140 */ 141 Demand loadById( String strId ); 142 143 /** 144 * Load demand ids ordered by date notification 145 * @param strCustomerId 146 * @param strNotificationType 147 * @param strIdDemandType (Optional can be null) 148 * @return The list of demand ids 149 */ 150 List<Integer> loadIdsByCustomerIdAndIdDemandType ( String strCustomerId, String strNotificationType, String strIdDemandType ); 151 152 /** 153 * Load demand ids by status 154 * @param strCustomerId 155 * @param listStatus 156 * @param strNotificationType 157 * @param strIdDemandType (Optional can be null) 158 * @return The list of demand ids 159 */ 160 List<Integer> loadIdsByStatus ( String strCustomerId, List<String> listStatus, String strNotificationType, String strIdDemandType ); 161 }