001    /**
002     * Copyright (c) 2000-2010 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            public boolean first() throws ORMException {
032                    try {
033                            return _scrollableResults.first();
034                    }
035                    catch (Exception e) {
036                            throw ExceptionTranslator.translate(e);
037                    }
038            }
039    
040            public Object[] get() throws ORMException {
041                    try {
042                            return _scrollableResults.get();
043                    }
044                    catch (Exception e) {
045                            throw ExceptionTranslator.translate(e);
046                    }
047            }
048    
049            public Object get(int i) throws ORMException {
050                    try {
051                            return _scrollableResults.get(i);
052                    }
053                    catch (Exception e) {
054                            throw ExceptionTranslator.translate(e);
055                    }
056            }
057    
058            public boolean last() throws ORMException {
059                    try {
060                            return _scrollableResults.last();
061                    }
062                    catch (Exception e) {
063                            throw ExceptionTranslator.translate(e);
064                    }
065            }
066    
067            public boolean next() throws ORMException {
068                    try {
069                            return _scrollableResults.next();
070                    }
071                    catch (Exception e) {
072                            throw ExceptionTranslator.translate(e);
073                    }
074            }
075    
076            public boolean previous() throws ORMException {
077                    try {
078                            return _scrollableResults.previous();
079                    }
080                    catch (Exception e) {
081                            throw ExceptionTranslator.translate(e);
082                    }
083            }
084    
085            public boolean scroll(int i) throws ORMException {
086                    try {
087                            return _scrollableResults.scroll(i);
088                    }
089                    catch (Exception e) {
090                            throw ExceptionTranslator.translate(e);
091                    }
092    
093            }
094    
095            private org.hibernate.ScrollableResults _scrollableResults;
096    
097    }