View Javadoc
1   /***
2    * License Agreement.
3    * 
4    * JSPA (POJO-SP)
5    * 
6    * Copyright (C) 2009 HRX Pty Ltd
7    * 
8    * This file is part of JSPA.
9    * 
10   * JSPA is free software: you can redistribute it and/or modify it under the
11   * terms of the GNU Lesser General Public License version 3 as published by the
12   * Free Software Foundation.
13   * 
14   * JSPA is distributed in the hope that it will be useful, but WITHOUT ANY
15   * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16   * A PARTICULAR PURPOSE. See the Lesser General Public License for more details.
17   * 
18   * You should have received a copy of the GNU Lesser General Public License
19   * along with JSPA. If not, see <http://www.gnu.org/licenses/>.
20   */
21  package com.hrx.rasp.util.dao;
22  
23  import java.sql.ResultSet;
24  import java.sql.SQLException;
25  import java.util.List;
26  
27  import com.hrx.rasp.util.dao.exception.StoredProcedureProccessResultException;
28  
29  /***
30   * @author dan.stoica <dan.stoica@acslink.net.au>
31   *   
32   * The CursorResultBuilder is responsible to process the OracleTypes.CURSOR
33   * Results. The implementation is not responsible to close the ResultSet at the
34   * end of the execution. The Result set will be closed by the caller of this
35   * builder if this implementation wasn't.
36   * <p>
37   * The implementation of this interface must provide a no arguments Constructor.
38   * During the Stored Procedures result processing, the CURSOR parameters will be
39   * converted to a Collection of Java objects using the public or protected
40   * no-arg constructor of the class. A no-arg constructor must be accessible to
41   * the DAO Response Processor.
42   * </p>
43   * 
44   */
45  public interface ResultSetProcessor<E>
46  {
47  	/***
48  	 * Transforms the JDBC CURSOR into a Collection of Java objects
49  	 * 
50  	 * @param rs
51  	 *            The database CURSOR returned by the Stored Procedure
52  	 * 
53  	 * @param resultClass
54  	 * @param resultClassArgsTypes
55  	 * @return A collection of Java objects representing the CURSOR records
56  	 * 
57  	 * @throws SQLException
58  	 * @throws StoredProcedureProccessResultException
59  	 * 
60  	 */
61  	public List<E> create(ResultSet rs, Class<E> resultClass, boolean isSecret) throws SQLException, StoredProcedureProccessResultException;
62  
63  	/***
64  	 * @return The maximum number of results to retrieve from result set.
65  	 * 
66  	 */
67  	public int getMaxResult();
68  
69  	/***
70  	 * @param maxResult
71  	 *            Set the maximum number of results to retrieve from result set.
72  	 */
73  	public void setMaxResult(int maxResult);
74  
75  	/***
76  	 * The start position of the first result, numbered from 0 for ResutlSet
77  	 * parameters.
78  	 */
79  	public int getStartPosition();
80  
81  	/***
82  	 * @param startPosition
83  	 *            The start position of the first result, numbered from 0 for
84  	 *            ResutlSet parameters
85  	 * 
86  	 */
87  	public void setStartPosition(int startPosition);
88  
89  }