|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ptc.windchill.upgrade.util.ConditionalPagedTableIterator
ConditionalPagedTableIterator determines which Paging mechanism to use depending upon what is available. The PDS paging API is available to release 6.0 and later versions of Windchill. For earlier release, use a simplied version of paging provided by this tool. In addition to this, ConditionalPagedTableIterator also hides the fact that paging is occuring, i.e. the program using this class acts as though it is iterating through a simple ResultSet without bothering with the details of paging.
Field Summary | |
private StandardACProcessor |
acp_
|
(package private) Connection |
conn
|
private static boolean |
DEVELOPER_MODE
|
(package private) int |
offset
|
(package private) int |
pageSize
|
private PersistentObjectManager |
pom_
|
(package private) QuerySpec |
querySpec
|
private boolean |
RELEASE_5
|
(package private) QueryResult |
result
|
(package private) Exception |
savedException
|
(package private) long |
sessionId
|
static String |
TEMP_INSERT_STR
|
static String |
TEMP_SELECT_STR
|
private static String |
TEMP_TABLE__CLASS_NAME
|
private static String |
TEMP_TABLE_NAME
|
private static String |
TEMP_TABLE_OID
|
private static String |
TEMP_TABLE_ROW_ORDER
|
private static String |
TEMP_TABLE_SESSION_ID
|
(package private) int |
totalSize
|
Constructor Summary | |
private |
ConditionalPagedTableIterator(PersistentObjectManager pom)
|
Method Summary | |
private QuerySpec |
addWhereToQuerySpec(String class_name,
QuerySpec select)
|
void |
cleanup()
|
private void |
closePagingSession()
|
private void |
createTempTable()
|
private void |
dropTempTable()
|
private int |
executeStatement(String statement)
|
private QueryResult |
fetchPagingSession(int offset,
int page_size,
long session_id)
Returns the next object in the ResultSet. |
private String |
getPrimaryTableName(String class_name)
|
long |
getSessionId()
The initial query stores OIDs in a temp table. |
static String |
getTableAlias()
Returns alias of the table defined in the FROM clause. |
static int |
getTableIndex()
Returns index of table used in SearchConditions. |
static int |
getTempIndex()
Returns index of the temp table used in SearchConditions. |
int |
getTotalSize()
Returns the number of rows in the temp table for this session id. |
boolean |
hasNext()
Returns true if the iteration has more elements. |
private void |
init(int page_size)
|
private void |
init(long session_id,
int page_size,
String class_name)
|
private void |
init(long session_id,
int page_size,
String class_name,
String[] attr_list,
String[] column_list,
String insert_stmt)
|
private void |
init(long session_id,
String class_name)
|
private QuerySpec |
initPageQuerySpec(String class_name)
|
private QuerySpec |
initPageQuerySpec(String class_name,
String[] attr_list,
String[] column_list)
|
private QuerySpec |
initQuerySpec(String class_name,
boolean selectable)
|
private int |
initTempTable(long session_id,
String id_col,
String class_name)
|
private int |
initTempTable(String insert_stmt)
|
private boolean |
isRelease5()
|
static ConditionalPagedTableIterator |
newPagingIterator(int page_size,
PersistentObjectManager pom)
Instantiates and initializes a ConditionalPagedTableIterator. |
static ConditionalPagedTableIterator |
newPagingIterator(long session_id,
int page_size,
String class_name,
PersistentObjectManager pom)
Instantiates and initializes a ConditionalPagedTableIterator. |
static ConditionalPagedTableIterator |
newPagingIterator(long session_id,
int page_size,
String class_name,
String[] attr_list,
String[] column_list,
String insert_stmt,
PersistentObjectManager pom)
Instantiates and initializes a ConditionalPagedTableIterator. |
Object |
next()
Returns the next element in the iteration. |
private void |
openPagingSession(String class_name)
Returns the next object in the ResultSet. |
private void |
openPagingSession(String class_name,
String[] attr_list,
String[] column_list,
String insert_stmt)
Returns the next object in the ResultSet. |
void |
remove()
Removes from the underlying collection the last element returned by the iterator (optional operation). |
private void |
reportException(Exception e)
|
void |
resetQuery(long session_id,
String class_name)
Clears out the previous query and starts a new paging query with the given QuerySpec. |
private void |
setRelease5(String release_level)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final boolean DEVELOPER_MODE
private static String TEMP_TABLE_NAME
private static String TEMP_TABLE_OID
private static String TEMP_TABLE_ROW_ORDER
private static String TEMP_TABLE_SESSION_ID
private static String TEMP_TABLE__CLASS_NAME
public static final String TEMP_INSERT_STR
public static final String TEMP_SELECT_STR
long sessionId
int totalSize
QueryResult result
int pageSize
int offset
QuerySpec querySpec
Exception savedException
Connection conn
private boolean RELEASE_5
private PersistentObjectManager pom_
private StandardACProcessor acp_
Constructor Detail |
private ConditionalPagedTableIterator(PersistentObjectManager pom)
Method Detail |
public static ConditionalPagedTableIterator newPagingIterator(int page_size, PersistentObjectManager pom) throws WTException
WTException
public static ConditionalPagedTableIterator newPagingIterator(long session_id, int page_size, String class_name, PersistentObjectManager pom) throws WTException
WTException
public static ConditionalPagedTableIterator newPagingIterator(long session_id, int page_size, String class_name, String[] attr_list, String[] column_list, String insert_stmt, PersistentObjectManager pom) throws WTException
Usage:
String[] attr_list = new String[1];
attr_list[0] = "name";
column_list = null; //This is used for columns no longer in the model
insert_stmt = ConditionalPagedTableIterator.TEMP_INSERT_STR + "MY_TABLE" +
"WHERE columnA < 4000 ORDER BY IDA3B5";
pom = (PersistentObjectManager)(context.getPomHandler().getPom());
iterator = ConditionalPagedTableIterator.newPagingIterator(session_id,
page_size,
class_name,
attr_list,
column_list,
insert_stmt,
pom);
WTException
public boolean hasNext()
hasNext
in interface Iterator
public Object next()
next
in interface Iterator
public void remove()
remove
in interface Iterator
public int getTotalSize()
public long getSessionId()
public void resetQuery(long session_id, String class_name) throws WTException
WTException
public static int getTableIndex()
public static int getTempIndex()
public static String getTableAlias()
private void init(int page_size) throws WTException
WTException
private void init(long session_id, int page_size, String class_name) throws WTException
WTException
private void init(long session_id, String class_name) throws WTException
WTException
private void init(long session_id, int page_size, String class_name, String[] attr_list, String[] column_list, String insert_stmt) throws WTException
WTException
public void cleanup() throws WTException
WTException
private void createTempTable() throws WTException
WTException
private void dropTempTable() throws WTException
WTException
private int initTempTable(long session_id, String id_col, String class_name) throws WTException
WTException
private int initTempTable(String insert_stmt) throws WTException
WTException
private String getPrimaryTableName(String class_name) throws WTException
WTException
private QuerySpec initQuerySpec(String class_name, boolean selectable) throws QueryException, WTException
QueryException
WTException
private QuerySpec initPageQuerySpec(String class_name, String[] attr_list, String[] column_list) throws QueryException, WTException
QueryException
WTException
private QuerySpec initPageQuerySpec(String class_name) throws QueryException, WTException
QueryException
WTException
private QuerySpec addWhereToQuerySpec(String class_name, QuerySpec select) throws QueryException, WTException
QueryException
WTException
private void openPagingSession(String class_name) throws WTException
WTException
private void openPagingSession(String class_name, String[] attr_list, String[] column_list, String insert_stmt) throws WTException
WTException
private QueryResult fetchPagingSession(int offset, int page_size, long session_id) throws WTException
WTException
private void closePagingSession() throws WTException
WTException
private void reportException(Exception e)
private int executeStatement(String statement) throws Exception
Exception
private boolean isRelease5()
private void setRelease5(String release_level)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |