1 //----------------------------------------------------------------------
2 //
3 // PerfectJPattern: "Design patterns are good but components are better!"
4 // ICustomerDao.java Copyright (c) 2009 Giovanni Azua Garcia
5 // bravegag@hotmail.com
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License
9 // as published by the Free Software Foundation; either version 3
10 // of the License, or (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, see <http://www.gnu.org/licenses/>.
19 //
20 //----------------------------------------------------------------------
21 package org.perfectjpattern.jee.api.integration.dao;
22
23 import java.util.*;
24
25 import org.perfectjpattern.example.datamodel.*;
26 import org.perfectjpattern.jee.integration.dao.*;
27
28 /**
29 * Abstract definition of the Customer DAO. This definition was introduced
30 * to support the Spring Generic DAO example implementation.
31 * <br/><br/>
32 * Note that this interface is all the Java code needed to provide such
33 * custom finder capability. The {@link SpringGenericDao} implementation
34 * will take care of the rest that includes all the plumbing to Hibernate.
35 * At this point it is only required the appropriate Hibernate mapping.
36 *
37 * @see SpringGenericDao
38 *
39 * @author <a href="mailto:bravegag@hotmail.com">Giovanni Azua</a>
40 * @version $ $Date: Dec 9, 2008 1:14:39 AM $
41 */
42 public
43 interface ICustomerDao
44 extends IGenericDao<Long, Customer>
45 {
46 //------------------------------------------------------------------------
47 // public
48 //------------------------------------------------------------------------
49 /**
50 * Returns the List of matching {@link Customer} instances. Finds the
51 * customers that have completed a minimum number of orders over the given
52 * total amount within the given period.
53 * @param aBegin Period begin date
54 * @param anEnd Period end date
55 * @param aMinimum Minimum number of orders to search for
56 *
57 * @return List of matching {@link Customer} instances
58 */
59 @QueryParameters(names = { "Begin", "End", "Minimum" })
60 public List<Customer>
61 findByNumberOfOrdersBetween(Date aBegin, Date anEnd, long aMinimum);
62
63 //------------------------------------------------------------------------
64 /**
65 * Returns the List of matching {@link Customer} instances. Finds the
66 * top spenders/customers that have completed orders over the given total
67 * amount within the given period.
68 * @param aBegin Period begin date
69 * @param anEnd Period end date
70 * @param aTotal Total minimum spending to search for
71 *
72 * @return List of matching {@link Customer} instances
73 */
74 @QueryParameters(names = { "Begin", "End", "Total" })
75 public List<Customer>
76 findByTotalSpendingBetween(Date aBegin, Date anEnd, double aTotal);
77 }