1 22 23 package org.xquark.mapper.storage; 24 25 import java.sql.SQLException ; 26 27 import org.xquark.mapper.dbms.TableInfo; 28 import org.xquark.mapper.metadata.UOIDManager; 29 30 34 public abstract class QueryStructExplorer extends StructExplorer 35 { 36 private static final String RCSRevision = "$Revision: 1.1 $"; 37 private static final String RCSName = "$Name: $"; 38 39 protected boolean currentResultExhausted = true; 40 protected int currentSubPathIndex = -2; 41 protected int subPathIndex = -1; 42 43 public QueryStructExplorer(TableInfo tableInfo, UOIDManager manager) 44 { 45 super(tableInfo, manager); 46 } 47 48 public short getPath() 49 { 50 if (resultActive()) 51 return super.getPath(); 52 else 53 return -2; 54 } 55 56 public long getUOID() 57 { 58 if (resultActive()) 59 return super.getUOID(); 60 else 61 return -1; 62 } 63 64 void freezeCurrentSubPath() 65 { 66 currentSubPathIndex++; 67 updateResultSegmentationFlag(); 68 } 69 70 public void reset() throws SQLException 71 { 72 super.reset(); 73 currentSubPathIndex = -2; 74 subPathIndex = -1; 75 currentResultExhausted = true; 76 } 77 78 protected void updateResultSegmentationFlag() 79 { 80 currentResultExhausted = (currentSubPathIndex != subPathIndex); 81 } 82 83 boolean resultActive() 84 { 85 return notExhausted && !currentResultExhausted; 86 } 87 } 88 | Popular Tags |