Java tutorial
// Description: Java6 in-memory RAM DbIO implementation for Service. /* * 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.*; /* * MSSBamRamServiceTable in-memory RAM DbIO implementation * for Service. */ public class MSSBamRamServiceTable implements IMSSBamServiceTable { private MSSBamBLRamSchema schema; private Map<MSSBamServicePKey, MSSBamServiceBuff> dictByPKey = new HashMap<MSSBamServicePKey, MSSBamServiceBuff>(); private SortedMap<MSSBamServiceByHostIdxKey, SortedMap<MSSBamServicePKey, MSSBamServiceBuff>> dictByHostIdx = new TreeMap<MSSBamServiceByHostIdxKey, SortedMap<MSSBamServicePKey, MSSBamServiceBuff>>(); private SortedMap<MSSBamServiceByTypeIdxKey, SortedMap<MSSBamServicePKey, MSSBamServiceBuff>> dictByTypeIdx = new TreeMap<MSSBamServiceByTypeIdxKey, SortedMap<MSSBamServicePKey, MSSBamServiceBuff>>(); private SortedMap<MSSBamServiceByUTypeIdxKey, MSSBamServiceBuff> dictByUTypeIdx = new TreeMap<MSSBamServiceByUTypeIdxKey, MSSBamServiceBuff>(); private SortedMap<MSSBamServiceByUHostPortIdxKey, MSSBamServiceBuff> dictByUHostPortIdx = new TreeMap<MSSBamServiceByUHostPortIdxKey, MSSBamServiceBuff>(); public MSSBamRamServiceTable(MSSBamBLRamSchema argSchema) { schema = argSchema; } public void createService(MSSBamAuthorization Authorization, MSSBamServiceBuff Buff) { MSSBamServicePKey pkey = schema.getFactoryService().newPKey(); pkey.setRequiredServiceId(schema.nextServiceIdGen()); Buff.setRequiredServiceId(pkey.getRequiredServiceId()); MSSBamServiceByHostIdxKey keyHostIdx = schema.getFactoryService().newHostIdxKey(); keyHostIdx.setRequiredHostNodeId(Buff.getRequiredHostNodeId()); MSSBamServiceByTypeIdxKey keyTypeIdx = schema.getFactoryService().newTypeIdxKey(); keyTypeIdx.setRequiredServiceTypeId(Buff.getRequiredServiceTypeId()); MSSBamServiceByUTypeIdxKey keyUTypeIdx = schema.getFactoryService().newUTypeIdxKey(); keyUTypeIdx.setRequiredHostNodeId(Buff.getRequiredHostNodeId()); keyUTypeIdx.setRequiredServiceTypeId(Buff.getRequiredServiceTypeId()); MSSBamServiceByUHostPortIdxKey keyUHostPortIdx = schema.getFactoryService().newUHostPortIdxKey(); keyUHostPortIdx.setRequiredHostNodeId(Buff.getRequiredHostNodeId()); keyUHostPortIdx.setRequiredHostPort(Buff.getRequiredHostPort()); // Validate unique indexes if (dictByPKey.containsKey(pkey)) { throw CFLib.getDefaultExceptionFactory().newPrimaryKeyNotNewException(getClass(), "createService", pkey); } if (dictByUTypeIdx.containsKey(keyUTypeIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "createService", "ServiceUTypeIdx", keyUTypeIdx); } if (dictByUHostPortIdx.containsKey(keyUHostPortIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "createService", "ServiceUHostPort", keyUHostPortIdx); } // Validate foreign keys { boolean allNull = true; allNull = false; if (!allNull) { if (null == schema.getTableHostNode().readDerivedByIdIdx(Authorization, Buff.getRequiredHostNodeId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "createService", "Container", "ServiceHost", "HostNode", null); } } } // Proceed with adding the new record dictByPKey.put(pkey, Buff); SortedMap<MSSBamServicePKey, MSSBamServiceBuff> subdictHostIdx; if (dictByHostIdx.containsKey(keyHostIdx)) { subdictHostIdx = dictByHostIdx.get(keyHostIdx); } else { subdictHostIdx = new TreeMap<MSSBamServicePKey, MSSBamServiceBuff>(); dictByHostIdx.put(keyHostIdx, subdictHostIdx); } subdictHostIdx.put(pkey, Buff); SortedMap<MSSBamServicePKey, MSSBamServiceBuff> subdictTypeIdx; if (dictByTypeIdx.containsKey(keyTypeIdx)) { subdictTypeIdx = dictByTypeIdx.get(keyTypeIdx); } else { subdictTypeIdx = new TreeMap<MSSBamServicePKey, MSSBamServiceBuff>(); dictByTypeIdx.put(keyTypeIdx, subdictTypeIdx); } subdictTypeIdx.put(pkey, Buff); dictByUTypeIdx.put(keyUTypeIdx, Buff); dictByUHostPortIdx.put(keyUHostPortIdx, Buff); } public MSSBamServiceBuff readDerived(MSSBamAuthorization Authorization, MSSBamServicePKey PKey) { final String S_ProcName = "MSSBamRamService.readDerived() "; MSSBamServicePKey key = schema.getFactoryService().newPKey(); key.setRequiredServiceId(PKey.getRequiredServiceId()); MSSBamServiceBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public MSSBamServiceBuff[] readAllDerived(MSSBamAuthorization Authorization) { final String S_ProcName = "MSSBamRamService.readAllDerived() "; MSSBamServiceBuff[] retList = new MSSBamServiceBuff[dictByPKey.values().size()]; Iterator<MSSBamServiceBuff> iter = dictByPKey.values().iterator(); int idx = 0; while (iter.hasNext()) { retList[idx++] = iter.next(); } return (retList); } public MSSBamServiceBuff[] readDerivedByHostIdx(MSSBamAuthorization Authorization, long HostNodeId) { final String S_ProcName = "MSSBamRamService.readDerivedByHostIdx() "; MSSBamServiceByHostIdxKey key = schema.getFactoryService().newHostIdxKey(); key.setRequiredHostNodeId(HostNodeId); MSSBamServiceBuff[] recArray; if (dictByHostIdx.containsKey(key)) { SortedMap<MSSBamServicePKey, MSSBamServiceBuff> subdictHostIdx = dictByHostIdx.get(key); recArray = new MSSBamServiceBuff[subdictHostIdx.size()]; Iterator<MSSBamServiceBuff> iter = subdictHostIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new MSSBamServiceBuff[0]; } return (recArray); } public MSSBamServiceBuff[] readDerivedByTypeIdx(MSSBamAuthorization Authorization, int ServiceTypeId) { final String S_ProcName = "MSSBamRamService.readDerivedByTypeIdx() "; MSSBamServiceByTypeIdxKey key = schema.getFactoryService().newTypeIdxKey(); key.setRequiredServiceTypeId(ServiceTypeId); MSSBamServiceBuff[] recArray; if (dictByTypeIdx.containsKey(key)) { SortedMap<MSSBamServicePKey, MSSBamServiceBuff> subdictTypeIdx = dictByTypeIdx.get(key); recArray = new MSSBamServiceBuff[subdictTypeIdx.size()]; Iterator<MSSBamServiceBuff> iter = subdictTypeIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new MSSBamServiceBuff[0]; } return (recArray); } public MSSBamServiceBuff readDerivedByUTypeIdx(MSSBamAuthorization Authorization, long HostNodeId, int ServiceTypeId) { final String S_ProcName = "MSSBamRamService.readDerivedByUTypeIdx() "; MSSBamServiceByUTypeIdxKey key = schema.getFactoryService().newUTypeIdxKey(); key.setRequiredHostNodeId(HostNodeId); key.setRequiredServiceTypeId(ServiceTypeId); MSSBamServiceBuff buff; if (dictByUTypeIdx.containsKey(key)) { buff = dictByUTypeIdx.get(key); } else { buff = null; } return (buff); } public MSSBamServiceBuff readDerivedByUHostPortIdx(MSSBamAuthorization Authorization, long HostNodeId, short HostPort) { final String S_ProcName = "MSSBamRamService.readDerivedByUHostPortIdx() "; MSSBamServiceByUHostPortIdxKey key = schema.getFactoryService().newUHostPortIdxKey(); key.setRequiredHostNodeId(HostNodeId); key.setRequiredHostPort(HostPort); MSSBamServiceBuff buff; if (dictByUHostPortIdx.containsKey(key)) { buff = dictByUHostPortIdx.get(key); } else { buff = null; } return (buff); } public MSSBamServiceBuff readDerivedByIdIdx(MSSBamAuthorization Authorization, long ServiceId) { final String S_ProcName = "MSSBamRamService.readDerivedByIdIdx() "; MSSBamServicePKey key = schema.getFactoryService().newPKey(); key.setRequiredServiceId(ServiceId); MSSBamServiceBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public MSSBamServiceBuff readBuff(MSSBamAuthorization Authorization, MSSBamServicePKey PKey) { final String S_ProcName = "MSSBamRamService.readBuff() "; MSSBamServiceBuff buff = readDerived(Authorization, PKey); if ((buff != null) && (!buff.getClassCode().equals("HSVC"))) { buff = null; } return (buff); } public MSSBamServiceBuff[] readAllBuff(MSSBamAuthorization Authorization) { final String S_ProcName = "MSSBamRamService.readAllBuff() "; MSSBamServiceBuff buff; ArrayList<MSSBamServiceBuff> filteredList = new ArrayList<MSSBamServiceBuff>(); MSSBamServiceBuff[] buffList = readAllDerived(Authorization); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("HSVC")) { filteredList.add(buff); } } return (filteredList.toArray(new MSSBamServiceBuff[0])); } public MSSBamServiceBuff readBuffByIdIdx(MSSBamAuthorization Authorization, long ServiceId) { final String S_ProcName = "MSSBamRamService.readBuffByIdIdx() "; MSSBamServiceBuff buff = readDerivedByIdIdx(Authorization, ServiceId); if ((buff != null) && buff.getClassCode().equals("HSVC")) { return ((MSSBamServiceBuff) buff); } else { return (null); } } public MSSBamServiceBuff[] readBuffByHostIdx(MSSBamAuthorization Authorization, long HostNodeId) { final String S_ProcName = "MSSBamRamService.readBuffByHostIdx() "; MSSBamServiceBuff buff; ArrayList<MSSBamServiceBuff> filteredList = new ArrayList<MSSBamServiceBuff>(); MSSBamServiceBuff[] buffList = readDerivedByHostIdx(Authorization, HostNodeId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("HSVC")) { filteredList.add((MSSBamServiceBuff) buff); } } return (filteredList.toArray(new MSSBamServiceBuff[0])); } public MSSBamServiceBuff[] readBuffByTypeIdx(MSSBamAuthorization Authorization, int ServiceTypeId) { final String S_ProcName = "MSSBamRamService.readBuffByTypeIdx() "; MSSBamServiceBuff buff; ArrayList<MSSBamServiceBuff> filteredList = new ArrayList<MSSBamServiceBuff>(); MSSBamServiceBuff[] buffList = readDerivedByTypeIdx(Authorization, ServiceTypeId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("HSVC")) { filteredList.add((MSSBamServiceBuff) buff); } } return (filteredList.toArray(new MSSBamServiceBuff[0])); } public MSSBamServiceBuff readBuffByUTypeIdx(MSSBamAuthorization Authorization, long HostNodeId, int ServiceTypeId) { final String S_ProcName = "MSSBamRamService.readBuffByUTypeIdx() "; MSSBamServiceBuff buff = readDerivedByUTypeIdx(Authorization, HostNodeId, ServiceTypeId); if ((buff != null) && buff.getClassCode().equals("HSVC")) { return ((MSSBamServiceBuff) buff); } else { return (null); } } public MSSBamServiceBuff readBuffByUHostPortIdx(MSSBamAuthorization Authorization, long HostNodeId, short HostPort) { final String S_ProcName = "MSSBamRamService.readBuffByUHostPortIdx() "; MSSBamServiceBuff buff = readDerivedByUHostPortIdx(Authorization, HostNodeId, HostPort); if ((buff != null) && buff.getClassCode().equals("HSVC")) { return ((MSSBamServiceBuff) buff); } else { return (null); } } public void updateService(MSSBamAuthorization Authorization, MSSBamServiceBuff Buff) { MSSBamServicePKey pkey = schema.getFactoryService().newPKey(); pkey.setRequiredServiceId(Buff.getRequiredServiceId()); MSSBamServiceBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateService", "Existing record not found", "Service", pkey); } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateService", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); MSSBamServiceByHostIdxKey existingKeyHostIdx = schema.getFactoryService().newHostIdxKey(); existingKeyHostIdx.setRequiredHostNodeId(existing.getRequiredHostNodeId()); MSSBamServiceByHostIdxKey newKeyHostIdx = schema.getFactoryService().newHostIdxKey(); newKeyHostIdx.setRequiredHostNodeId(Buff.getRequiredHostNodeId()); MSSBamServiceByTypeIdxKey existingKeyTypeIdx = schema.getFactoryService().newTypeIdxKey(); existingKeyTypeIdx.setRequiredServiceTypeId(existing.getRequiredServiceTypeId()); MSSBamServiceByTypeIdxKey newKeyTypeIdx = schema.getFactoryService().newTypeIdxKey(); newKeyTypeIdx.setRequiredServiceTypeId(Buff.getRequiredServiceTypeId()); MSSBamServiceByUTypeIdxKey existingKeyUTypeIdx = schema.getFactoryService().newUTypeIdxKey(); existingKeyUTypeIdx.setRequiredHostNodeId(existing.getRequiredHostNodeId()); existingKeyUTypeIdx.setRequiredServiceTypeId(existing.getRequiredServiceTypeId()); MSSBamServiceByUTypeIdxKey newKeyUTypeIdx = schema.getFactoryService().newUTypeIdxKey(); newKeyUTypeIdx.setRequiredHostNodeId(Buff.getRequiredHostNodeId()); newKeyUTypeIdx.setRequiredServiceTypeId(Buff.getRequiredServiceTypeId()); MSSBamServiceByUHostPortIdxKey existingKeyUHostPortIdx = schema.getFactoryService().newUHostPortIdxKey(); existingKeyUHostPortIdx.setRequiredHostNodeId(existing.getRequiredHostNodeId()); existingKeyUHostPortIdx.setRequiredHostPort(existing.getRequiredHostPort()); MSSBamServiceByUHostPortIdxKey newKeyUHostPortIdx = schema.getFactoryService().newUHostPortIdxKey(); newKeyUHostPortIdx.setRequiredHostNodeId(Buff.getRequiredHostNodeId()); newKeyUHostPortIdx.setRequiredHostPort(Buff.getRequiredHostPort()); // Check unique indexes if (!existingKeyUTypeIdx.equals(newKeyUTypeIdx)) { if (dictByUTypeIdx.containsKey(newKeyUTypeIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "updateService", "ServiceUTypeIdx", newKeyUTypeIdx); } } if (!existingKeyUHostPortIdx.equals(newKeyUHostPortIdx)) { if (dictByUHostPortIdx.containsKey(newKeyUHostPortIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "updateService", "ServiceUHostPort", newKeyUHostPortIdx); } } // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema.getTableHostNode().readDerivedByIdIdx(Authorization, Buff.getRequiredHostNodeId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateService", "Container", "ServiceHost", "HostNode", null); } } } // Update is valid SortedMap<MSSBamServicePKey, MSSBamServiceBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); subdict = dictByHostIdx.get(existingKeyHostIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByHostIdx.containsKey(newKeyHostIdx)) { subdict = dictByHostIdx.get(newKeyHostIdx); } else { subdict = new TreeMap<MSSBamServicePKey, MSSBamServiceBuff>(); dictByHostIdx.put(newKeyHostIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByTypeIdx.get(existingKeyTypeIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByTypeIdx.containsKey(newKeyTypeIdx)) { subdict = dictByTypeIdx.get(newKeyTypeIdx); } else { subdict = new TreeMap<MSSBamServicePKey, MSSBamServiceBuff>(); dictByTypeIdx.put(newKeyTypeIdx, subdict); } subdict.put(pkey, Buff); dictByUTypeIdx.remove(existingKeyUTypeIdx); dictByUTypeIdx.put(newKeyUTypeIdx, Buff); dictByUHostPortIdx.remove(existingKeyUHostPortIdx); dictByUHostPortIdx.put(newKeyUHostPortIdx, Buff); } public void deleteService(MSSBamAuthorization Authorization, MSSBamServiceBuff Buff) { final String S_ProcName = "MSSBamRamServiceTable.deleteService() "; MSSBamServicePKey pkey = schema.getFactoryService().newPKey(); pkey.setRequiredServiceId(schema.nextServiceIdGen()); MSSBamServiceBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteService", "Existing record not found", "Service", pkey); } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteService", pkey); } MSSBamServiceByHostIdxKey keyHostIdx = schema.getFactoryService().newHostIdxKey(); keyHostIdx.setRequiredHostNodeId(existing.getRequiredHostNodeId()); MSSBamServiceByTypeIdxKey keyTypeIdx = schema.getFactoryService().newTypeIdxKey(); keyTypeIdx.setRequiredServiceTypeId(existing.getRequiredServiceTypeId()); MSSBamServiceByUTypeIdxKey keyUTypeIdx = schema.getFactoryService().newUTypeIdxKey(); keyUTypeIdx.setRequiredHostNodeId(existing.getRequiredHostNodeId()); keyUTypeIdx.setRequiredServiceTypeId(existing.getRequiredServiceTypeId()); MSSBamServiceByUHostPortIdxKey keyUHostPortIdx = schema.getFactoryService().newUHostPortIdxKey(); keyUHostPortIdx.setRequiredHostNodeId(existing.getRequiredHostNodeId()); keyUHostPortIdx.setRequiredHostPort(existing.getRequiredHostPort()); // Validate reverse foreign keys // Delete is valid SortedMap<MSSBamServicePKey, MSSBamServiceBuff> subdict; dictByPKey.remove(pkey); subdict = dictByHostIdx.get(keyHostIdx); subdict.remove(pkey); subdict = dictByTypeIdx.get(keyTypeIdx); subdict.remove(pkey); dictByUTypeIdx.remove(keyUTypeIdx); dictByUHostPortIdx.remove(keyUHostPortIdx); } public MSSBamCursor openServiceCursorAll(MSSBamAuthorization Authorization) { MSSBamCursor cursor = new MSSBamRamServiceCursor(Authorization, schema, dictByPKey.values()); return (cursor); } public MSSBamCursor openServiceCursorByHostIdx(MSSBamAuthorization Authorization, long HostNodeId) { MSSBamCursor cursor; MSSBamServiceByHostIdxKey key = schema.getFactoryService().newHostIdxKey(); key.setRequiredHostNodeId(HostNodeId); if (dictByHostIdx.containsKey(key)) { SortedMap<MSSBamServicePKey, MSSBamServiceBuff> subdictHostIdx = dictByHostIdx.get(key); cursor = new MSSBamRamServiceCursor(Authorization, schema, subdictHostIdx.values()); } else { cursor = new MSSBamRamServiceCursor(Authorization, schema, new ArrayList<MSSBamServiceBuff>()); } return (cursor); } public MSSBamCursor openServiceCursorByTypeIdx(MSSBamAuthorization Authorization, int ServiceTypeId) { MSSBamCursor cursor; MSSBamServiceByTypeIdxKey key = schema.getFactoryService().newTypeIdxKey(); key.setRequiredServiceTypeId(ServiceTypeId); if (dictByTypeIdx.containsKey(key)) { SortedMap<MSSBamServicePKey, MSSBamServiceBuff> subdictTypeIdx = dictByTypeIdx.get(key); cursor = new MSSBamRamServiceCursor(Authorization, schema, subdictTypeIdx.values()); } else { cursor = new MSSBamRamServiceCursor(Authorization, schema, new ArrayList<MSSBamServiceBuff>()); } return (cursor); } public void closeServiceCursor(MSSBamCursor Cursor) { // Cursor.DataReader.Close(); } public MSSBamServiceBuff nextServiceCursor(MSSBamCursor Cursor) { MSSBamRamServiceCursor cursor = (MSSBamRamServiceCursor) Cursor; MSSBamServiceBuff rec = cursor.getCursor().next(); cursor.setRowIdx(cursor.getRowIdx() + 1); return (rec); } public MSSBamServiceBuff prevServiceCursor(MSSBamCursor Cursor) { int targetRowIdx = (Cursor.getRowIdx() > 1) ? Cursor.getRowIdx() - 1 : 1; MSSBamServiceBuff rec = null; if (Cursor.getRowIdx() >= targetRowIdx) { Cursor.reset(); } while (Cursor.getRowIdx() < targetRowIdx) { rec = nextServiceCursor(Cursor); } return (rec); } public MSSBamServiceBuff firstServiceCursor(MSSBamCursor Cursor) { int targetRowIdx = 1; MSSBamServiceBuff rec = null; Cursor.reset(); while (Cursor.getRowIdx() < targetRowIdx) { rec = nextServiceCursor(Cursor); } return (rec); } public MSSBamServiceBuff lastServiceCursor(MSSBamCursor Cursor) { throw CFLib.getDefaultExceptionFactory().newNotImplementedYetException(getClass(), "lastServiceCursor"); } public MSSBamServiceBuff nthServiceCursor(MSSBamCursor Cursor, int Idx) { int targetRowIdx = Idx; MSSBamServiceBuff rec = null; if (Cursor.getRowIdx() >= targetRowIdx) { Cursor.reset(); } while (Cursor.getRowIdx() < targetRowIdx) { rec = nextServiceCursor(Cursor); } return (rec); } }