1   /**
2    * Copyright (c) 2000-2009 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
12   * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
13   * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
14   * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
15   * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
16   * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
17   * SOFTWARE.
18   */
19  
20  package com.liferay.portal.dao.orm.hibernate;
21  
22  import com.liferay.portal.kernel.dao.orm.ORMException;
23  import com.liferay.portal.kernel.dao.orm.ScrollableResults;
24  
25  /**
26   * <a href="ScrollableResultsImpl.java.html"><b><i>View Source</i></b></a>
27   *
28   * @author Brian Wing Shun Chan
29   *
30   */
31  public class ScrollableResultsImpl implements ScrollableResults {
32  
33      public ScrollableResultsImpl(
34          org.hibernate.ScrollableResults scrollableResults) {
35  
36          _scrollableResults = scrollableResults;
37      }
38  
39      public boolean first() throws ORMException {
40          try {
41              return _scrollableResults.first();
42          }
43          catch (Exception e) {
44              throw ExceptionTranslator.translate(e);
45          }
46      }
47  
48      public Object get(int i) throws ORMException {
49          try {
50              return _scrollableResults.get(i);
51          }
52          catch (Exception e) {
53              throw ExceptionTranslator.translate(e);
54          }
55      }
56  
57      public boolean last() throws ORMException {
58          try {
59              return _scrollableResults.last();
60          }
61          catch (Exception e) {
62              throw ExceptionTranslator.translate(e);
63          }
64      }
65  
66      public boolean next() throws ORMException {
67          try {
68              return _scrollableResults.next();
69          }
70          catch (Exception e) {
71              throw ExceptionTranslator.translate(e);
72          }
73      }
74  
75      public boolean previous() throws ORMException {
76          try {
77              return _scrollableResults.previous();
78          }
79          catch (Exception e) {
80              throw ExceptionTranslator.translate(e);
81          }
82      }
83  
84      public boolean scroll(int i) throws ORMException {
85          try {
86              return _scrollableResults.scroll(i);
87          }
88          catch (Exception e) {
89              throw ExceptionTranslator.translate(e);
90          }
91  
92      }
93  
94      private org.hibernate.ScrollableResults _scrollableResults;
95  
96  }