View Javadoc
1   /*
2    * Copyright (c) 2002-2024, 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.grubusiness.business.demand;
35  
36  import fr.paris.lutece.plugins.grubusiness.business.notification.NotificationFilter;
37  
38  import java.util.Collection;
39  import java.util.List;
40  
41  /**
42   * This interface represents a data access object for Demand object
43   *
44   */
45  public interface IDemandDAO
46  {
47      /**
48       * Finds the demands associated to the specified customer id
49       * 
50       * @param strCustomerId
51       *            the customer id
52       * @return the demands. An empty collection is returned if no demands has been found.
53       */
54      Collection<Demand> loadByCustomerId( String strCustomerId );
55  
56      /**
57       * Finds the demands associated to the specified reference
58       * 
59       * @param strReference
60       *            the reference
61       * @return the demands. An empty collection is returned if no demands has been found.
62       */
63      Collection<Demand> loadByReference( String strReference );
64  
65      /**
66       * Search demands by filter
67       * 
68       * @param filter
69       * @return the demands list
70       */
71      Collection<Demand> loadByFilter( NotificationFilter filter );
72  
73      /**
74       * Search demands by filter
75       * 
76       * @param filter
77       * @return the demands list
78       */
79      List<Integer> loadIdsByFilter( NotificationFilter filter );
80  
81      /**
82       * load demands corresponding to the id list
83       * 
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( int nId );
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 demand id
137      * 
138      * @param strDemandId
139      * @return the demand coresponding to given demand id.
140      */
141     Demand loadByDemandId( String strDemandId );
142     
143     /**
144      * Finds demands associated to the demand id and type id
145      * 
146      * @param strDemandId
147      * @return the demand coresponding to given demand id.
148      */
149     Demand loadByDemandIdAndTypeId( String strDemandId, String strDemandTypeId );
150 
151     /**
152      * Load demand ids ordered by date notification
153      * 
154      * @param strCustomerId
155      * @param strNotificationType
156      * @param strIdDemandType
157      *            (Optional can be null)
158      * @return The list of demand ids
159      */
160     List<Integer> loadIdsByCustomerIdAndIdDemandType( String strCustomerId, String strNotificationType, String strIdDemandType );
161 
162     /**
163      * Load demand ids by status
164      * 
165      * @param strCustomerId
166      * @param listStatus
167      * @param strNotificationType
168      * @param strIdDemandType
169      *            (Optional can be null)
170      * @return The list of demand ids
171      */
172     List<Integer> loadIdsByStatus( String strCustomerId, List<String> listStatus, String strNotificationType, String strIdDemandType );
173 }