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.14.2.3 2005/12/21 22:27:09 tomdz Exp $
026: */
027: public abstract class AbstractQueryImpl implements Query, Serializable {
028: static final long serialVersionUID = -6265085604410295816L;
029:
030: private int m_startAtIndex = Query.NO_START_AT_INDEX;
031: private int m_endAtIndex = Query.NO_END_AT_INDEX;
032: private int m_fullSize = 0;
033: private int fetchSize;
034: protected Class m_searchClass;
035: protected Class m_baseClass;
036: private boolean m_withExtents = true;
037:
038: public AbstractQueryImpl() {
039: }
040:
041: public AbstractQueryImpl(Class aSearchClass) {
042: m_searchClass = aSearchClass;
043: m_baseClass = aSearchClass;
044: }
045:
046: public int getStartAtIndex() {
047: return m_startAtIndex;
048: }
049:
050: public void setStartAtIndex(int startAtIndex) {
051: m_startAtIndex = startAtIndex;
052: }
053:
054: public int getEndAtIndex() {
055: return m_endAtIndex;
056: }
057:
058: public void setEndAtIndex(int endAtIndex) {
059: m_endAtIndex = endAtIndex;
060: }
061:
062: public void fullSize(int size) {
063: m_fullSize = size;
064: }
065:
066: public int fullSize() {
067: return m_fullSize;
068: }
069:
070: public void setWithExtents(boolean withExtents) {
071: m_withExtents = withExtents;
072: }
073:
074: public boolean getWithExtents() {
075: return m_withExtents;
076: }
077:
078: /*
079: * @see Query#getSearchClass()
080: */
081: public Class getSearchClass() {
082: return m_searchClass;
083: }
084:
085: /*
086: * @see Query#getBaseClass()
087: */
088: public Class getBaseClass() {
089: return m_baseClass;
090: }
091:
092: /* (non-Javadoc)
093: * @see org.apache.ojb.broker.query.Query#getGroupBy()
094: */
095: public List getGroupBy() {
096: return null;
097: }
098:
099: /* (non-Javadoc)
100: * @see org.apache.ojb.broker.query.Query#getOrderBy()
101: */
102: public List getOrderBy() {
103: return null;
104: }
105:
106: /* (non-Javadoc)
107: * @see org.apache.ojb.broker.query.Query#getPrefetchedRelationships()
108: */
109: public List getPrefetchedRelationships() {
110: return null;
111: }
112:
113: /* (non-Javadoc)
114: * @see org.apache.ojb.broker.query.Query#getCriteria()
115: */
116: public Criteria getCriteria() {
117: return null;
118: }
119:
120: /* (non-Javadoc)
121: * @see org.apache.ojb.broker.query.Query#getExampleObject()
122: */
123: public Object getExampleObject() {
124: return null;
125: }
126:
127: /* (non-Javadoc)
128: * @see org.apache.ojb.broker.query.Query#getHavingCriteria()
129: */
130: public Criteria getHavingCriteria() {
131: return null;
132: }
133:
134: /* (non-Javadoc)
135: * @see org.apache.ojb.broker.query.Query#isDistinct()
136: */
137: public boolean isDistinct() {
138: return false;
139: }
140:
141: public boolean usePaging() {
142: return getEndAtIndex() > NO_END_AT_INDEX
143: || getStartAtIndex() > NO_START_AT_INDEX;
144: }
145:
146: public void setFetchSize(int fetchSize) {
147: this .fetchSize = fetchSize;
148: }
149:
150: public int getFetchSize() {
151: return fetchSize;
152: }
153:
154: }
|