001    package org.apache.ojb.broker.query;
002    
003    /* Copyright 2002-2005 The Apache Software Foundation
004     *
005     * Licensed under the Apache License, Version 2.0 (the "License");
006     * you may not use this file except in compliance with the License.
007     * You may obtain a copy of the License at
008     *
009     *     http://www.apache.org/licenses/LICENSE-2.0
010     *
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */
017    
018    import java.io.Serializable;
019    import java.util.List;
020    
021    /**
022     * Abstract implemenation of Query interface
023     *
024     * @author ???
025     * @version $Id: AbstractQueryImpl.java,v 1.1 2007-08-24 22:17:36 ewestfal Exp $
026     */
027    public abstract class AbstractQueryImpl implements Query, Serializable
028    {
029            static final long serialVersionUID = -6265085604410295816L;
030        
031        private int m_startAtIndex = Query.NO_START_AT_INDEX;
032        private int m_endAtIndex = Query.NO_END_AT_INDEX;
033        private int m_fullSize = 0;
034        private int fetchSize;
035        protected Class m_searchClass;
036        protected Class m_baseClass;
037        private boolean m_withExtents = true;
038    
039        public AbstractQueryImpl()
040        {
041        }
042    
043        public AbstractQueryImpl(Class aSearchClass)
044        {
045            m_searchClass = aSearchClass;
046            m_baseClass = aSearchClass;
047        }
048    
049        public int getStartAtIndex()
050        {
051            return m_startAtIndex;
052        }
053    
054        public void setStartAtIndex(int startAtIndex)
055        {
056            m_startAtIndex = startAtIndex;
057        }
058    
059        public int getEndAtIndex()
060        {
061            return m_endAtIndex;
062        }
063        
064        public void setEndAtIndex(int endAtIndex)
065        {
066            m_endAtIndex = endAtIndex;
067        }
068        
069        public void fullSize(int size)
070        {
071            m_fullSize = size;
072        }
073        
074        public int fullSize()
075        {
076            return m_fullSize;
077        }
078        
079        public void setWithExtents(boolean withExtents)
080        {
081            m_withExtents = withExtents;
082        }
083        
084        public boolean getWithExtents()
085        {
086            return m_withExtents;
087        }
088    
089        /*
090         * @see Query#getSearchClass()
091         */
092        public Class getSearchClass()
093        {
094            return m_searchClass;
095        }
096    
097        /*
098         * @see Query#getBaseClass()
099         */
100        public Class getBaseClass()
101        {
102            return m_baseClass;
103        }
104    
105        /* (non-Javadoc)
106         * @see org.apache.ojb.broker.query.Query#getGroupBy()
107         */
108        public List getGroupBy()
109        {
110            return null;
111        }
112    
113        /* (non-Javadoc)
114         * @see org.apache.ojb.broker.query.Query#getOrderBy()
115         */
116        public List getOrderBy()
117        {
118            return null;
119        }
120    
121        /* (non-Javadoc)
122         * @see org.apache.ojb.broker.query.Query#getPrefetchedRelationships()
123         */
124        public List getPrefetchedRelationships()
125        {
126            return null;
127        }
128        
129    
130    
131            /* (non-Javadoc)
132             * @see org.apache.ojb.broker.query.Query#getCriteria()
133             */
134            public Criteria getCriteria()
135            {
136                    return null;
137            }
138    
139            /* (non-Javadoc)
140             * @see org.apache.ojb.broker.query.Query#getExampleObject()
141             */
142            public Object getExampleObject()
143            {
144                    return null;
145            }
146    
147            /* (non-Javadoc)
148             * @see org.apache.ojb.broker.query.Query#getHavingCriteria()
149             */
150            public Criteria getHavingCriteria()
151            {
152                    return null;
153            }
154    
155            /* (non-Javadoc)
156             * @see org.apache.ojb.broker.query.Query#isDistinct()
157             */
158            public boolean isDistinct()
159            {
160                    return false;
161            }
162    
163        public boolean usePaging()
164        {
165            return getEndAtIndex() > NO_END_AT_INDEX
166                || getStartAtIndex() > NO_START_AT_INDEX;
167        }
168    
169        public void setFetchSize(int fetchSize)
170        {
171            this.fetchSize = fetchSize;
172        }
173    
174        public int getFetchSize()
175        {
176            return fetchSize;
177        }
178    
179    }