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: /**
012: * @author Gennady Krizhevsky
013: */
014: public interface CallFactory extends QueryFactoryBase, QueryFactoryCtl {
015:
016: //
017: // Call:
018: //
019:
020: /**
021: * Creates preset query object
022: *
023: * @param sql SQL statement
024: * @return new <code>Call</code> instance
025: */
026: Call newCall(String sql);
027:
028: /**
029: * Creates preset call object from another one used a template
030: *
031: * @param call Call used as a template
032: * @return new <code>Call</code> instance
033: */
034: Call newCall(Call call);
035:
036: /**
037: * Creates new call object
038: *
039: * @return new <code>Call</code> instance
040: */
041: Call newCall();
042:
043: /**
044: * Creates preset call object
045: *
046: * @param singularResultFactory singular result factory
047: * @return new <code>Call</code> instance
048: */
049: Call newCall(PersistentObjectFactory singularResultFactory);
050:
051: //
052: // Disconnected:
053: //
054:
055: /**
056: * Creates preset query object which when executed brings only one page of results
057: *
058: * @param call query object
059: * @param offset 0-based offset
060: * @param pageSize page size
061: * @return new <code>Call</code> instance
062: */
063: Call newDisconnectedPageCall(Call call, long offset, long pageSize);
064:
065: /**
066: * Creates preset call object which when executed brings only one page of results
067: *
068: * @param offset 0-based offset
069: * @param pageSize page size
070: * @return new <code>Call</code> instance
071: */
072: Call newDisconnectedPageCall(long offset, long pageSize);
073:
074: /**
075: * Creates preset call object which when executed brings only one page of results
076: *
077: * @param singularResultFactory singular result factory
078: * @param offset 0-based offset
079: * @param pageSize page size
080: * @return new <code>Call</code> instance
081: */
082: Call newDisconnectedPageCall(
083: AbstractPersistentObject singularResultFactory,
084: long offset, long pageSize);
085:
086: //
087: // Connected:
088: //
089:
090: /**
091: * Creates preset call object which when executed brings only one page of results
092: * and does not disconnect from the database. It keeps cursor/result set open and only closes it either
093: * when there is nothing to retrieve or on transaction commit.
094: * <br><p>The following snippet shows how to use it:</br></p>
095: * <PRE>
096: * Call call = persistency.getCallFactory().newConnectedForwardPageCall(new Person(), 1000);
097: *
098: * List persons;
099: * while ((persons = persistency.selectSinglePartResultCall(call).size() > 0 ) {
100: * // Do your processing here
101: * }
102: * </PRE>
103: *
104: * @param singularResultFactory singular result factory
105: * @param pageSize page size
106: * @return new <code>Call</code> instance
107: */
108: Call newConnectedForwardPageCall(
109: AbstractPersistentObject singularResultFactory,
110: long pageSize);
111:
112: /**
113: * Creates preset call object which when executed brings only one page of results
114: * and does not disconnect from the database. It keeps cursor/result set open and only closes it either
115: * when there is nothing to retrieve or on transaction commit.
116: * <br><p>The following snippet shows how to use it:</br></p>
117: * <PRE>
118: * Call call = persistency.getCallFactory().newConnectedForwardPageCall(new Person(), 1000);
119: *
120: * List persons;
121: * while ((persons = persistency.selectSinglePartResultCall(call).size() > 0 ) {
122: * // Do your processing here
123: * }
124: * </PRE>
125: *
126: * @param call non-paginated Call object
127: * @param pageSize page size
128: * @return new <code>Call</code> instance
129: */
130: Call newConnectedForwardPageCall(Call call, long pageSize);
131:
132: /**
133: * Creates preset call object which when executed brings only one page of results
134: * and does not disconnect from the database. It keeps cursor/result set open and only closes it either
135: * when there is nothing to retrieve or on transaction commit.
136: * <br><p>The following snippet shows how to use it:</br></p>
137: * <PRE>
138: * Call call = persistency.getCallFactory().newConnectedForwardPageCall(new Person(), 1000);
139: *
140: * List persons;
141: * while ((persons = persistency.selectSinglePartResultCall(call).size() > 0 ) {
142: * // Do your processing here
143: * }
144: * </PRE>
145: *
146: * @param pageSize page size
147: * @return new <code>Call</code> instance
148: */
149: Call newConnectedForwardPageCall(long pageSize);
150:
151: }
|