001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.dao.orm.hibernate;
016    
017    import com.liferay.portal.kernel.dao.orm.ORMException;
018    import com.liferay.portal.kernel.dao.orm.ScrollableResults;
019    
020    /**
021     * @author Brian Wing Shun Chan
022     */
023    public class ScrollableResultsImpl implements ScrollableResults {
024    
025            public ScrollableResultsImpl(
026                    org.hibernate.ScrollableResults scrollableResults) {
027    
028                    _scrollableResults = scrollableResults;
029            }
030    
031            @Override
032            public boolean first() throws ORMException {
033                    try {
034                            return _scrollableResults.first();
035                    }
036                    catch (Exception e) {
037                            throw ExceptionTranslator.translate(e);
038                    }
039            }
040    
041            @Override
042            public Object[] get() throws ORMException {
043                    try {
044                            return _scrollableResults.get();
045                    }
046                    catch (Exception e) {
047                            throw ExceptionTranslator.translate(e);
048                    }
049            }
050    
051            @Override
052            public Object get(int i) throws ORMException {
053                    try {
054                            return _scrollableResults.get(i);
055                    }
056                    catch (Exception e) {
057                            throw ExceptionTranslator.translate(e);
058                    }
059            }
060    
061            @Override
062            public boolean last() throws ORMException {
063                    try {
064                            return _scrollableResults.last();
065                    }
066                    catch (Exception e) {
067                            throw ExceptionTranslator.translate(e);
068                    }
069            }
070    
071            @Override
072            public boolean next() throws ORMException {
073                    try {
074                            return _scrollableResults.next();
075                    }
076                    catch (Exception e) {
077                            throw ExceptionTranslator.translate(e);
078                    }
079            }
080    
081            @Override
082            public boolean previous() throws ORMException {
083                    try {
084                            return _scrollableResults.previous();
085                    }
086                    catch (Exception e) {
087                            throw ExceptionTranslator.translate(e);
088                    }
089            }
090    
091            @Override
092            public boolean scroll(int i) throws ORMException {
093                    try {
094                            return _scrollableResults.scroll(i);
095                    }
096                    catch (Exception e) {
097                            throw ExceptionTranslator.translate(e);
098                    }
099            }
100    
101            private org.hibernate.ScrollableResults _scrollableResults;
102    
103    }