001: /**
002: * Objective Database Abstraction Layer (ODAL)
003: * Copyright (c) 2004, The ODAL Development Group
004: * All rights reserved.
005: * For definition of the ODAL Development Group please refer to LICENCE.txt file
006: *
007: * Distributable under LGPL license.
008: * See terms of license at gnu.org.
009: */package com.completex.objective.components.persistency;
010:
011: import com.completex.objective.components.persistency.type.CollectionFactory;
012: import com.completex.objective.components.persistency.core.impl.query.QueryContextImpl;
013: import com.completex.objective.components.persistency.core.impl.query.QueryContext;
014:
015: import java.util.Set;
016:
017: /**
018: * Container for utility methods that make sense for both Query and Call
019: *
020: * @author Gennady Krizhevsky
021: */
022: public interface ResultableQuery extends BasicQuery {
023: //
024: // Result Factories:
025: //
026: /**
027: * Sets singular result factory.
028: *
029: * @param singularResultFactory singular result factory
030: */
031: void setSingularResultFactory(
032: PersistentObjectFactory singularResultFactory);
033:
034: /**
035: * Returns singular result factory. Used when retrieving
036: * data from ResultSet.
037: *
038: * @see PersistentObjectFactory
039: * @return singular result factory
040: */
041: PersistentObjectFactory getSingularResultFactory();
042:
043: /**
044: * Nullifies singular result factory
045: */
046: void nullifySingularResultFactory();
047:
048: /**
049: * Sets multiple result factory. Multiple result factory
050: * is used when retrieving data from ResultSet to instantiate
051: * proper Collection type.
052: *
053: * @param multipleResultFactory multiple result factory
054: */
055: void setMultipleResultFactory(
056: CollectionFactory multipleResultFactory);
057:
058: /**
059: * Returns multiple result factory
060: *
061: * @return multiple result factory
062: */
063: CollectionFactory getMultipleResultFactory();
064:
065: /**
066: * Returns true query hint is set to use star in select clauses and names of PersistentObject columns when
067: * retrieving from ResultSet.
068: *
069: * @return true query hint is set to use star in select clauses and names of PersistentObject columns when
070: * retrieving from ResultSet.
071: */
072: boolean isUseColumnNames();
073:
074: /**
075: * Sets query hint to use star in select clauses and names of PersistentObject columns when
076: * retrieving from ResultSet.
077: *
078: * @param useColumnNames
079: */
080: void setUseColumnNames(boolean useColumnNames);
081:
082: //
083: // Query type:
084: //
085:
086: /**
087: * Sets flag if query is of Disconnected Page Query type.
088: * Disconnected Page Query object when executed brings only one page of results.
089: *
090: * @param disconnectedPageQuery flag if query is of Disconnected Page Query type.
091: */
092: void setDisconnectedPageQuery(boolean disconnectedPageQuery);
093:
094: /**
095: * Returns true if query is of Disconnected Page Query type.
096: *
097: * @return true if query is of Disconnected Page Query type.
098: */
099: boolean isDisconnectedPageQuery();
100:
101: /**
102: * Returns true if this query is of Select Disconnected Page Query type
103: *
104: * @return true if this query is of Select Disconnected Page Query type
105: */
106: boolean isSelectDisconnectedPageQuery();
107:
108: /**
109: * Returns true if this query is of Select Connected Forward Page Query type.
110: * Query is considered of Select Connected Forward Page Query type if
111: * its page size is > 0, it !isDisconnectedPageQuery() and it !isCount() query.
112: * When executed Select Connected Forward Page Query brings only one page of results
113: * and does not disconnect from the database. It keeps cursor/result set open and only closes it either
114: * when there is nothing to retrieve or on transaction commit.
115: *
116: * @return true if this query is of Select Connected Forward Page Query type
117: */
118: boolean isSelectConnectedForwardPageQuery();
119:
120: /**
121: * Returns true if query closed
122: *
123: * @return true if query closed
124: */
125: boolean isClosed();
126:
127: /**
128: *
129: * @return number of parameters set
130: */
131: int parametersSize();
132:
133: /**
134: * Get parameter at specific index
135: *
136: * @param index
137: * @return Parameter
138: */
139: Parameter getParameter(int index);
140:
141: /**
142: * Returns max value in LIMIT clause
143: *
144: * @return max value in LIMIT clause
145: */
146: int getLimitMax();
147:
148: /**
149: * @deprecated - use setColumnFilter
150: * @param excludedFields
151: */
152: void setExcludedFields(Set excludedFields);
153:
154: /**
155: * Returns current CompoundColumnFilter. If filter is not set - creates a new instance of it before that.
156: *
157: * @return CompoundColumnFilter
158: */
159: CompoundColumnFilter columnFilters();
160:
161: /**
162: * Return column filter set for this query
163: *
164: * @return column filter set for this query
165: */
166: CompoundColumnFilter getCompoundColumnFilter();
167:
168: /**
169: * Sets column filter that allows for sparsely populated result objects
170: *
171: * @see CompoundColumnFilter
172: * @param columnFilter
173: */
174: void setCompoundColumnFilter(CompoundColumnFilter columnFilter);
175:
176: boolean isDisableQueryContext();
177:
178: void setDisableQueryContext(boolean disableQueryContext);
179:
180: /**
181: * Returns true if this is UNION query
182: *
183: * @return true if this is UNION query
184: */
185: boolean isUnion();
186:
187: /**
188: * Returns the object passed as a parameter if useQueryContext == false, or
189: * object with the same key if it was retrieved by this query previously
190: * otherwise.
191: *
192: * @param po
193: * @return the object passed as a parameter if useQueryContext == false, or
194: * object with the same key if it was retrieved by this query previously
195: * otherwise.
196: */
197: AbstractPersistentObject resolveThroughQueryContext(
198: AbstractPersistentObject po, QueryContext queryContext);
199: }
|