Java tutorial
// Description: Java6 in-memory RAM DbIO implementation for Project. /* * MSS Code Factory 1.10 * * Copyright (c) 2012 Mark Sobkow * * This program is available as free software under the GNU GPL v3, or * under a commercial license from Mark Sobkow. For commercial licensing * details, please contact msobkow@sasktel.net. * * Under the terms of the GPL: * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * *********************************************************************** * * Code manufactured * by MSS Code Factory version 1.9.3294 * * $Revision: 26 $ */ package net.sourceforge.msscodefactory.v1_10.MSSBamRam; import java.sql.*; import java.util.*; import net.sourceforge.msscodefactory.cflib.v1_9.CFLib.*; import org.apache.commons.codec.binary.Base64; import net.sourceforge.msscodefactory.v1_10.MSSBam.*; import net.sourceforge.msscodefactory.v1_10.MSSBamBL.*; import net.sourceforge.msscodefactory.v1_10.MSSBamBLRam.*; /* * MSSBamRamProjectTable in-memory RAM DbIO implementation * for Project. */ public class MSSBamRamProjectTable implements IMSSBamProjectTable { private MSSBamBLRamSchema schema; private Map<MSSBamAnyObjPKey, MSSBamProjectBuff> dictByPKey = new HashMap<MSSBamAnyObjPKey, MSSBamProjectBuff>(); private SortedMap<MSSBamProjectByOwnerIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamProjectBuff>> dictByOwnerIdx = new TreeMap<MSSBamProjectByOwnerIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamProjectBuff>>(); private SortedMap<MSSBamProjectBySubProjIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamProjectBuff>> dictBySubProjIdx = new TreeMap<MSSBamProjectBySubProjIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamProjectBuff>>(); public MSSBamRamProjectTable(MSSBamBLRamSchema argSchema) { schema = argSchema; } public void createProject(MSSBamAuthorization Authorization, MSSBamProjectBuff Buff) { MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey(); pkey.setClassCode(Buff.getClassCode()); pkey.setRequiredId(Buff.getRequiredId()); MSSBamProjectByOwnerIdxKey keyOwnerIdx = schema.getFactoryProject().newOwnerIdxKey(); keyOwnerIdx.setOptionalOwnerId(Buff.getOptionalOwnerId()); MSSBamProjectBySubProjIdxKey keySubProjIdx = schema.getFactoryProject().newSubProjIdxKey(); keySubProjIdx.setOptionalContainerProjectId(Buff.getOptionalContainerProjectId()); // Validate unique indexes if (dictByPKey.containsKey(pkey)) { throw CFLib.getDefaultExceptionFactory().newPrimaryKeyNotNewException(getClass(), "createProject", pkey); } // Validate foreign keys { boolean allNull = true; allNull = false; if (!allNull) { if (null == schema.getTableDomain().readDerivedByIdIdx(Authorization, Buff.getRequiredId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "createProject", "Superclass", "SuperClass", "Domain", null); } } } // Proceed with adding the new record dictByPKey.put(pkey, Buff); SortedMap<MSSBamAnyObjPKey, MSSBamProjectBuff> subdictOwnerIdx; if (dictByOwnerIdx.containsKey(keyOwnerIdx)) { subdictOwnerIdx = dictByOwnerIdx.get(keyOwnerIdx); } else { subdictOwnerIdx = new TreeMap<MSSBamAnyObjPKey, MSSBamProjectBuff>(); dictByOwnerIdx.put(keyOwnerIdx, subdictOwnerIdx); } subdictOwnerIdx.put(pkey, Buff); SortedMap<MSSBamAnyObjPKey, MSSBamProjectBuff> subdictSubProjIdx; if (dictBySubProjIdx.containsKey(keySubProjIdx)) { subdictSubProjIdx = dictBySubProjIdx.get(keySubProjIdx); } else { subdictSubProjIdx = new TreeMap<MSSBamAnyObjPKey, MSSBamProjectBuff>(); dictBySubProjIdx.put(keySubProjIdx, subdictSubProjIdx); } subdictSubProjIdx.put(pkey, Buff); } public MSSBamProjectBuff readDerived(MSSBamAuthorization Authorization, MSSBamAnyObjPKey PKey) { final String S_ProcName = "MSSBamRamProject.readDerived() "; MSSBamAnyObjPKey key = schema.getFactoryAnyObj().newPKey(); key.setRequiredId(PKey.getRequiredId()); MSSBamProjectBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public MSSBamProjectBuff[] readAllDerived(MSSBamAuthorization Authorization) { final String S_ProcName = "MSSBamRamProject.readAllDerived() "; MSSBamProjectBuff[] retList = new MSSBamProjectBuff[dictByPKey.values().size()]; Iterator<MSSBamProjectBuff> iter = dictByPKey.values().iterator(); int idx = 0; while (iter.hasNext()) { retList[idx++] = iter.next(); } return (retList); } public MSSBamProjectBuff[] readDerivedByTenantIdx(MSSBamAuthorization Authorization, long TenantId) { final String S_ProcName = "MSSBamRamAnyObj.readDerivedByTenantIdx() "; MSSBamAnyObjBuff buffList[] = schema.getTableAnyObj().readDerivedByTenantIdx(Authorization, TenantId); if (buffList == null) { return (null); } else { MSSBamAnyObjBuff buff; ArrayList<MSSBamProjectBuff> filteredList = new ArrayList<MSSBamProjectBuff>(); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && (buff instanceof MSSBamProjectBuff)) { filteredList.add((MSSBamProjectBuff) buff); } } return (filteredList.toArray(new MSSBamProjectBuff[0])); } } public MSSBamProjectBuff[] readDerivedByScopeIdx(MSSBamAuthorization Authorization, Long ScopeId) { final String S_ProcName = "MSSBamRamAnyObj.readDerivedByScopeIdx() "; MSSBamAnyObjBuff buffList[] = schema.getTableAnyObj().readDerivedByScopeIdx(Authorization, ScopeId); if (buffList == null) { return (null); } else { MSSBamAnyObjBuff buff; ArrayList<MSSBamProjectBuff> filteredList = new ArrayList<MSSBamProjectBuff>(); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && (buff instanceof MSSBamProjectBuff)) { filteredList.add((MSSBamProjectBuff) buff); } } return (filteredList.toArray(new MSSBamProjectBuff[0])); } } public MSSBamProjectBuff[] readDerivedByAuthorIdx(MSSBamAuthorization Authorization, Long AuthorId) { final String S_ProcName = "MSSBamRamAnyObj.readDerivedByAuthorIdx() "; MSSBamAnyObjBuff buffList[] = schema.getTableAnyObj().readDerivedByAuthorIdx(Authorization, AuthorId); if (buffList == null) { return (null); } else { MSSBamAnyObjBuff buff; ArrayList<MSSBamProjectBuff> filteredList = new ArrayList<MSSBamProjectBuff>(); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && (buff instanceof MSSBamProjectBuff)) { filteredList.add((MSSBamProjectBuff) buff); } } return (filteredList.toArray(new MSSBamProjectBuff[0])); } } public MSSBamProjectBuff readDerivedByUNameIdx(MSSBamAuthorization Authorization, Long ScopeId, String Name) { final String S_ProcName = "MSSBamRamAnyObj.readDerivedByUNameIdx() "; MSSBamAnyObjBuff buff = schema.getTableAnyObj().readDerivedByUNameIdx(Authorization, ScopeId, Name); if (buff == null) { return (null); } else if (buff instanceof MSSBamProjectBuff) { return ((MSSBamProjectBuff) buff); } else { return (null); } } public MSSBamProjectBuff[] readDerivedByContainerIdx(MSSBamAuthorization Authorization, Long ContainerDomainId) { final String S_ProcName = "MSSBamRamDomain.readDerivedByContainerIdx() "; MSSBamDomainBuff buffList[] = schema.getTableDomain().readDerivedByContainerIdx(Authorization, ContainerDomainId); if (buffList == null) { return (null); } else { MSSBamDomainBuff buff; ArrayList<MSSBamProjectBuff> filteredList = new ArrayList<MSSBamProjectBuff>(); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && (buff instanceof MSSBamProjectBuff)) { filteredList.add((MSSBamProjectBuff) buff); } } return (filteredList.toArray(new MSSBamProjectBuff[0])); } } public MSSBamProjectBuff[] readDerivedByOwnerIdx(MSSBamAuthorization Authorization, Long OwnerId) { final String S_ProcName = "MSSBamRamProject.readDerivedByOwnerIdx() "; MSSBamProjectByOwnerIdxKey key = schema.getFactoryProject().newOwnerIdxKey(); key.setOptionalOwnerId(OwnerId); MSSBamProjectBuff[] recArray; if (dictByOwnerIdx.containsKey(key)) { SortedMap<MSSBamAnyObjPKey, MSSBamProjectBuff> subdictOwnerIdx = dictByOwnerIdx.get(key); recArray = new MSSBamProjectBuff[subdictOwnerIdx.size()]; Iterator<MSSBamProjectBuff> iter = subdictOwnerIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new MSSBamProjectBuff[0]; } return (recArray); } public MSSBamProjectBuff[] readDerivedBySubProjIdx(MSSBamAuthorization Authorization, Long ContainerProjectId) { final String S_ProcName = "MSSBamRamProject.readDerivedBySubProjIdx() "; MSSBamProjectBySubProjIdxKey key = schema.getFactoryProject().newSubProjIdxKey(); key.setOptionalContainerProjectId(ContainerProjectId); MSSBamProjectBuff[] recArray; if (dictBySubProjIdx.containsKey(key)) { SortedMap<MSSBamAnyObjPKey, MSSBamProjectBuff> subdictSubProjIdx = dictBySubProjIdx.get(key); recArray = new MSSBamProjectBuff[subdictSubProjIdx.size()]; Iterator<MSSBamProjectBuff> iter = subdictSubProjIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new MSSBamProjectBuff[0]; } return (recArray); } public MSSBamProjectBuff readDerivedByIdIdx(MSSBamAuthorization Authorization, long Id) { final String S_ProcName = "MSSBamRamAnyObj.readDerivedByIdIdx() "; MSSBamAnyObjPKey key = schema.getFactoryAnyObj().newPKey(); key.setRequiredId(Id); MSSBamProjectBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public MSSBamProjectBuff readBuff(MSSBamAuthorization Authorization, MSSBamAnyObjPKey PKey) { final String S_ProcName = "MSSBamRamProject.readBuff() "; MSSBamProjectBuff buff = readDerived(Authorization, PKey); if ((buff != null) && (!buff.getClassCode().equals("PRJ"))) { buff = null; } return (buff); } public MSSBamProjectBuff[] readAllBuff(MSSBamAuthorization Authorization) { final String S_ProcName = "MSSBamRamProject.readAllBuff() "; MSSBamProjectBuff buff; ArrayList<MSSBamProjectBuff> filteredList = new ArrayList<MSSBamProjectBuff>(); MSSBamProjectBuff[] buffList = readAllDerived(Authorization); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("PRJ")) { filteredList.add(buff); } } return (filteredList.toArray(new MSSBamProjectBuff[0])); } public MSSBamProjectBuff readBuffByIdIdx(MSSBamAuthorization Authorization, long Id) { final String S_ProcName = "MSSBamRamAnyObj.readBuffByIdIdx() "; MSSBamAnyObjBuff buff = readDerivedByIdIdx(Authorization, Id); if ((buff != null) && buff.getClassCode().equals("ANYO")) { return ((MSSBamProjectBuff) buff); } else { return (null); } } public MSSBamProjectBuff[] readBuffByTenantIdx(MSSBamAuthorization Authorization, long TenantId) { final String S_ProcName = "MSSBamRamAnyObj.readBuffByTenantIdx() "; MSSBamAnyObjBuff buff; ArrayList<MSSBamProjectBuff> filteredList = new ArrayList<MSSBamProjectBuff>(); MSSBamAnyObjBuff[] buffList = readDerivedByTenantIdx(Authorization, TenantId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("ANYO")) { filteredList.add((MSSBamProjectBuff) buff); } } return (filteredList.toArray(new MSSBamProjectBuff[0])); } public MSSBamProjectBuff[] readBuffByScopeIdx(MSSBamAuthorization Authorization, Long ScopeId) { final String S_ProcName = "MSSBamRamAnyObj.readBuffByScopeIdx() "; MSSBamAnyObjBuff buff; ArrayList<MSSBamProjectBuff> filteredList = new ArrayList<MSSBamProjectBuff>(); MSSBamAnyObjBuff[] buffList = readDerivedByScopeIdx(Authorization, ScopeId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("ANYO")) { filteredList.add((MSSBamProjectBuff) buff); } } return (filteredList.toArray(new MSSBamProjectBuff[0])); } public MSSBamProjectBuff[] readBuffByAuthorIdx(MSSBamAuthorization Authorization, Long AuthorId) { final String S_ProcName = "MSSBamRamAnyObj.readBuffByAuthorIdx() "; MSSBamAnyObjBuff buff; ArrayList<MSSBamProjectBuff> filteredList = new ArrayList<MSSBamProjectBuff>(); MSSBamAnyObjBuff[] buffList = readDerivedByAuthorIdx(Authorization, AuthorId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("ANYO")) { filteredList.add((MSSBamProjectBuff) buff); } } return (filteredList.toArray(new MSSBamProjectBuff[0])); } public MSSBamProjectBuff readBuffByUNameIdx(MSSBamAuthorization Authorization, Long ScopeId, String Name) { final String S_ProcName = "MSSBamRamAnyObj.readBuffByUNameIdx() "; MSSBamAnyObjBuff buff = readDerivedByUNameIdx(Authorization, ScopeId, Name); if ((buff != null) && buff.getClassCode().equals("ANYO")) { return ((MSSBamProjectBuff) buff); } else { return (null); } } public MSSBamProjectBuff[] readBuffByContainerIdx(MSSBamAuthorization Authorization, Long ContainerDomainId) { final String S_ProcName = "MSSBamRamDomain.readBuffByContainerIdx() "; MSSBamDomainBuff buff; ArrayList<MSSBamProjectBuff> filteredList = new ArrayList<MSSBamProjectBuff>(); MSSBamDomainBuff[] buffList = readDerivedByContainerIdx(Authorization, ContainerDomainId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("DOM")) { filteredList.add((MSSBamProjectBuff) buff); } } return (filteredList.toArray(new MSSBamProjectBuff[0])); } public MSSBamProjectBuff[] readBuffByOwnerIdx(MSSBamAuthorization Authorization, Long OwnerId) { final String S_ProcName = "MSSBamRamProject.readBuffByOwnerIdx() "; MSSBamProjectBuff buff; ArrayList<MSSBamProjectBuff> filteredList = new ArrayList<MSSBamProjectBuff>(); MSSBamProjectBuff[] buffList = readDerivedByOwnerIdx(Authorization, OwnerId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("PRJ")) { filteredList.add((MSSBamProjectBuff) buff); } } return (filteredList.toArray(new MSSBamProjectBuff[0])); } public MSSBamProjectBuff[] readBuffBySubProjIdx(MSSBamAuthorization Authorization, Long ContainerProjectId) { final String S_ProcName = "MSSBamRamProject.readBuffBySubProjIdx() "; MSSBamProjectBuff buff; ArrayList<MSSBamProjectBuff> filteredList = new ArrayList<MSSBamProjectBuff>(); MSSBamProjectBuff[] buffList = readDerivedBySubProjIdx(Authorization, ContainerProjectId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("PRJ")) { filteredList.add((MSSBamProjectBuff) buff); } } return (filteredList.toArray(new MSSBamProjectBuff[0])); } public void updateProject(MSSBamAuthorization Authorization, MSSBamProjectBuff Buff) { MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey(); pkey.setRequiredId(Buff.getRequiredId()); MSSBamProjectBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateProject", "Existing record not found", "Project", pkey); } MSSBamProjectByOwnerIdxKey existingKeyOwnerIdx = schema.getFactoryProject().newOwnerIdxKey(); existingKeyOwnerIdx.setOptionalOwnerId(existing.getOptionalOwnerId()); MSSBamProjectByOwnerIdxKey newKeyOwnerIdx = schema.getFactoryProject().newOwnerIdxKey(); newKeyOwnerIdx.setOptionalOwnerId(Buff.getOptionalOwnerId()); MSSBamProjectBySubProjIdxKey existingKeySubProjIdx = schema.getFactoryProject().newSubProjIdxKey(); existingKeySubProjIdx.setOptionalContainerProjectId(existing.getOptionalContainerProjectId()); MSSBamProjectBySubProjIdxKey newKeySubProjIdx = schema.getFactoryProject().newSubProjIdxKey(); newKeySubProjIdx.setOptionalContainerProjectId(Buff.getOptionalContainerProjectId()); // Check unique indexes // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema.getTableDomain().readDerivedByIdIdx(Authorization, Buff.getRequiredId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateProject", "Superclass", "SuperClass", "Domain", null); } } } // Update is valid SortedMap<MSSBamAnyObjPKey, MSSBamProjectBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); subdict = dictByOwnerIdx.get(existingKeyOwnerIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByOwnerIdx.containsKey(newKeyOwnerIdx)) { subdict = dictByOwnerIdx.get(newKeyOwnerIdx); } else { subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamProjectBuff>(); dictByOwnerIdx.put(newKeyOwnerIdx, subdict); } subdict.put(pkey, Buff); subdict = dictBySubProjIdx.get(existingKeySubProjIdx); if (subdict != null) { subdict.remove(pkey); } if (dictBySubProjIdx.containsKey(newKeySubProjIdx)) { subdict = dictBySubProjIdx.get(newKeySubProjIdx); } else { subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamProjectBuff>(); dictBySubProjIdx.put(newKeySubProjIdx, subdict); } subdict.put(pkey, Buff); } public void deleteProject(MSSBamAuthorization Authorization, MSSBamProjectBuff Buff) { final String S_ProcName = "MSSBamRamProjectTable.deleteProject() "; MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey(); pkey.setRequiredId(schema.nextAnyObjIdGen()); MSSBamProjectBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteProject", "Existing record not found", "Project", pkey); } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteProject", pkey); } MSSBamProjectByOwnerIdxKey keyOwnerIdx = schema.getFactoryProject().newOwnerIdxKey(); keyOwnerIdx.setOptionalOwnerId(existing.getOptionalOwnerId()); MSSBamProjectBySubProjIdxKey keySubProjIdx = schema.getFactoryProject().newSubProjIdxKey(); keySubProjIdx.setOptionalContainerProjectId(existing.getOptionalContainerProjectId()); // Validate reverse foreign keys if (schema.getTableMajorVersion().readDerivedByProjIdx(Authorization, existing.getRequiredId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteProject", "Container", "Project", "MajorVersion", pkey); } // Delete is valid SortedMap<MSSBamAnyObjPKey, MSSBamProjectBuff> subdict; dictByPKey.remove(pkey); subdict = dictByOwnerIdx.get(keyOwnerIdx); subdict.remove(pkey); subdict = dictBySubProjIdx.get(keySubProjIdx); subdict.remove(pkey); } public MSSBamCursor openProjectCursorAll(MSSBamAuthorization Authorization) { MSSBamCursor cursor = new MSSBamRamProjectCursor(Authorization, schema, dictByPKey.values()); return (cursor); } public MSSBamCursor openProjectCursorByOwnerIdx(MSSBamAuthorization Authorization, Long OwnerId) { MSSBamCursor cursor; MSSBamProjectByOwnerIdxKey key = schema.getFactoryProject().newOwnerIdxKey(); key.setOptionalOwnerId(OwnerId); if (dictByOwnerIdx.containsKey(key)) { SortedMap<MSSBamAnyObjPKey, MSSBamProjectBuff> subdictOwnerIdx = dictByOwnerIdx.get(key); cursor = new MSSBamRamProjectCursor(Authorization, schema, subdictOwnerIdx.values()); } else { cursor = new MSSBamRamProjectCursor(Authorization, schema, new ArrayList<MSSBamProjectBuff>()); } return (cursor); } public MSSBamCursor openProjectCursorBySubProjIdx(MSSBamAuthorization Authorization, Long ContainerProjectId) { MSSBamCursor cursor; MSSBamProjectBySubProjIdxKey key = schema.getFactoryProject().newSubProjIdxKey(); key.setOptionalContainerProjectId(ContainerProjectId); if (dictBySubProjIdx.containsKey(key)) { SortedMap<MSSBamAnyObjPKey, MSSBamProjectBuff> subdictSubProjIdx = dictBySubProjIdx.get(key); cursor = new MSSBamRamProjectCursor(Authorization, schema, subdictSubProjIdx.values()); } else { cursor = new MSSBamRamProjectCursor(Authorization, schema, new ArrayList<MSSBamProjectBuff>()); } return (cursor); } public void closeProjectCursor(MSSBamCursor Cursor) { // Cursor.DataReader.Close(); } public MSSBamProjectBuff nextProjectCursor(MSSBamCursor Cursor) { MSSBamRamProjectCursor cursor = (MSSBamRamProjectCursor) Cursor; MSSBamProjectBuff rec = cursor.getCursor().next(); cursor.setRowIdx(cursor.getRowIdx() + 1); return (rec); } public MSSBamProjectBuff prevProjectCursor(MSSBamCursor Cursor) { int targetRowIdx = (Cursor.getRowIdx() > 1) ? Cursor.getRowIdx() - 1 : 1; MSSBamProjectBuff rec = null; if (Cursor.getRowIdx() >= targetRowIdx) { Cursor.reset(); } while (Cursor.getRowIdx() < targetRowIdx) { rec = nextProjectCursor(Cursor); } return (rec); } public MSSBamProjectBuff firstProjectCursor(MSSBamCursor Cursor) { int targetRowIdx = 1; MSSBamProjectBuff rec = null; Cursor.reset(); while (Cursor.getRowIdx() < targetRowIdx) { rec = nextProjectCursor(Cursor); } return (rec); } public MSSBamProjectBuff lastProjectCursor(MSSBamCursor Cursor) { throw CFLib.getDefaultExceptionFactory().newNotImplementedYetException(getClass(), "lastProjectCursor"); } public MSSBamProjectBuff nthProjectCursor(MSSBamCursor Cursor, int Idx) { int targetRowIdx = Idx; MSSBamProjectBuff rec = null; if (Cursor.getRowIdx() >= targetRowIdx) { Cursor.reset(); } while (Cursor.getRowIdx() < targetRowIdx) { rec = nextProjectCursor(Cursor); } return (rec); } }