Java tutorial
// Description: Java7 in-memory RAM DbIO implementation for Domain. /* * CF Asterisk 11 Configuration Model * * Copyright (c) 2013-2014 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/>. * * This source code incorporates modified modules originally licensed * under the Apache 2.0 license by MSS Code Factory including CFSecurity * (net-sourceforge-msscodefactory-2.0-cfsecurity.xml), * CFInternet (net-sourceforge-msscodefactory-2.0-cfinternet.xml), and * CFCrm 2.0 (net-sourceforge-msscodefactory-2.0-cfcrm.xml), with all of the * required models being available as part of the MSS Code Factory 1.11 * distribution source and install zips. * * You can download installations of MSS Code Factory 1.11 from * http://msscodefactory.sourceforge.net/ * * *********************************************************************** * * Code manufactured by MSS Code Factory */ package net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstRam; import java.sql.*; import java.util.*; import net.sourceforge.msscodefactory.cflib.v1_11.CFLib.*; import org.apache.commons.codec.binary.Base64; import net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAst.*; import net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstRam.*; /* * CFAstRamDomainTable in-memory RAM DbIO implementation * for Domain. */ public class CFAstRamDomainTable implements ICFAstDomainTable { private CFAstRamSchema schema; private Map<CFAstDomainBasePKey, CFAstDomainBuff> dictByPKey = new HashMap<CFAstDomainBasePKey, CFAstDomainBuff>(); private SortedMap<CFAstDomainBySubDomIdxKey, SortedMap<CFAstDomainBasePKey, CFAstDomainBuff>> dictBySubDomIdx = new TreeMap<CFAstDomainBySubDomIdxKey, SortedMap<CFAstDomainBasePKey, CFAstDomainBuff>>(); private SortedMap<CFAstDomainByNameIdxKey, CFAstDomainBuff> dictByNameIdx = new TreeMap<CFAstDomainByNameIdxKey, CFAstDomainBuff>(); public CFAstRamDomainTable(CFAstRamSchema argSchema) { schema = argSchema; } public void createDomain(CFAstAuthorization Authorization, CFAstDomainBuff Buff) { schema.getTableDomainBase().createDomainBase(Authorization, Buff); CFAstDomainBasePKey pkey = schema.getFactoryDomainBase().newPKey(); pkey.setClassCode(Buff.getClassCode()); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredId(Buff.getRequiredId()); CFAstDomainBySubDomIdxKey keySubDomIdx = schema.getFactoryDomain().newSubDomIdxKey(); keySubDomIdx.setRequiredTenantId(Buff.getRequiredTenantId()); keySubDomIdx.setRequiredSubDomainOfId(Buff.getRequiredSubDomainOfId()); CFAstDomainByNameIdxKey keyNameIdx = schema.getFactoryDomain().newNameIdxKey(); keyNameIdx.setRequiredTenantId(Buff.getRequiredTenantId()); keyNameIdx.setRequiredSubDomainOfId(Buff.getRequiredSubDomainOfId()); keyNameIdx.setRequiredName(Buff.getRequiredName()); // Validate unique indexes if (dictByPKey.containsKey(pkey)) { throw CFLib.getDefaultExceptionFactory().newPrimaryKeyNotNewException(getClass(), "createDomain", pkey); } if (dictByNameIdx.containsKey(keyNameIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "createDomain", "DomainNameIdx", keyNameIdx); } // Validate foreign keys { boolean allNull = true; allNull = false; allNull = false; if (!allNull) { if (null == schema.getTableDomainBase().readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId(), Buff.getRequiredId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "createDomain", "Superclass", "SuperClass", "DomainBase", null); } } } { boolean allNull = true; allNull = false; allNull = false; if (!allNull) { if (null == schema.getTableDomainBase().readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId(), Buff.getRequiredSubDomainOfId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "createDomain", "Container", "ParentDomain", "DomainBase", null); } } } // Proceed with adding the new record dictByPKey.put(pkey, Buff); SortedMap<CFAstDomainBasePKey, CFAstDomainBuff> subdictSubDomIdx; if (dictBySubDomIdx.containsKey(keySubDomIdx)) { subdictSubDomIdx = dictBySubDomIdx.get(keySubDomIdx); } else { subdictSubDomIdx = new TreeMap<CFAstDomainBasePKey, CFAstDomainBuff>(); dictBySubDomIdx.put(keySubDomIdx, subdictSubDomIdx); } subdictSubDomIdx.put(pkey, Buff); dictByNameIdx.put(keyNameIdx, Buff); } public CFAstDomainBuff readDerived(CFAstAuthorization Authorization, CFAstDomainBasePKey PKey) { final String S_ProcName = "CFAstRamDomain.readDerived() "; CFAstDomainBasePKey key = schema.getFactoryDomainBase().newPKey(); key.setRequiredTenantId(PKey.getRequiredTenantId()); key.setRequiredId(PKey.getRequiredId()); CFAstDomainBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public CFAstDomainBuff lockDerived(CFAstAuthorization Authorization, CFAstDomainBasePKey PKey) { final String S_ProcName = "CFAstRamDomain.readDerived() "; CFAstDomainBasePKey key = schema.getFactoryDomainBase().newPKey(); key.setRequiredTenantId(PKey.getRequiredTenantId()); key.setRequiredId(PKey.getRequiredId()); CFAstDomainBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public CFAstDomainBuff[] readAllDerived(CFAstAuthorization Authorization) { final String S_ProcName = "CFAstRamDomain.readAllDerived() "; CFAstDomainBuff[] retList = new CFAstDomainBuff[dictByPKey.values().size()]; Iterator<CFAstDomainBuff> iter = dictByPKey.values().iterator(); int idx = 0; while (iter.hasNext()) { retList[idx++] = iter.next(); } return (retList); } public CFAstDomainBuff[] readDerivedByTenantIdx(CFAstAuthorization Authorization, long TenantId) { final String S_ProcName = "CFAstRamDomainBase.readDerivedByTenantIdx() "; CFAstDomainBaseBuff buffList[] = schema.getTableDomainBase().readDerivedByTenantIdx(Authorization, TenantId); if (buffList == null) { return (null); } else { CFAstDomainBaseBuff buff; ArrayList<CFAstDomainBuff> filteredList = new ArrayList<CFAstDomainBuff>(); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && (buff instanceof CFAstDomainBuff)) { filteredList.add((CFAstDomainBuff) buff); } } return (filteredList.toArray(new CFAstDomainBuff[0])); } } public CFAstDomainBuff[] readDerivedBySubDomIdx(CFAstAuthorization Authorization, long TenantId, long SubDomainOfId) { final String S_ProcName = "CFAstRamDomain.readDerivedBySubDomIdx() "; CFAstDomainBySubDomIdxKey key = schema.getFactoryDomain().newSubDomIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredSubDomainOfId(SubDomainOfId); CFAstDomainBuff[] recArray; if (dictBySubDomIdx.containsKey(key)) { SortedMap<CFAstDomainBasePKey, CFAstDomainBuff> subdictSubDomIdx = dictBySubDomIdx.get(key); recArray = new CFAstDomainBuff[subdictSubDomIdx.size()]; Iterator<CFAstDomainBuff> iter = subdictSubDomIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new CFAstDomainBuff[0]; } return (recArray); } public CFAstDomainBuff readDerivedByNameIdx(CFAstAuthorization Authorization, long TenantId, long SubDomainOfId, String Name) { final String S_ProcName = "CFAstRamDomain.readDerivedByNameIdx() "; CFAstDomainByNameIdxKey key = schema.getFactoryDomain().newNameIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredSubDomainOfId(SubDomainOfId); key.setRequiredName(Name); CFAstDomainBuff buff; if (dictByNameIdx.containsKey(key)) { buff = dictByNameIdx.get(key); } else { buff = null; } return (buff); } public CFAstDomainBuff readDerivedByIdIdx(CFAstAuthorization Authorization, long TenantId, long Id) { final String S_ProcName = "CFAstRamDomainBase.readDerivedByIdIdx() "; CFAstDomainBasePKey key = schema.getFactoryDomainBase().newPKey(); key.setRequiredTenantId(TenantId); key.setRequiredId(Id); CFAstDomainBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public CFAstDomainBuff readBuff(CFAstAuthorization Authorization, CFAstDomainBasePKey PKey) { final String S_ProcName = "CFAstRamDomain.readBuff() "; CFAstDomainBuff buff = readDerived(Authorization, PKey); if ((buff != null) && (!buff.getClassCode().equals("DOMN"))) { buff = null; } return (buff); } public CFAstDomainBuff lockBuff(CFAstAuthorization Authorization, CFAstDomainBasePKey PKey) { final String S_ProcName = "CFAstRamDomain.readBuff() "; CFAstDomainBuff buff = readDerived(Authorization, PKey); if ((buff != null) && (!buff.getClassCode().equals("DOMN"))) { buff = null; } return (buff); } public CFAstDomainBuff[] readAllBuff(CFAstAuthorization Authorization) { final String S_ProcName = "CFAstRamDomain.readAllBuff() "; CFAstDomainBuff buff; ArrayList<CFAstDomainBuff> filteredList = new ArrayList<CFAstDomainBuff>(); CFAstDomainBuff[] buffList = readAllDerived(Authorization); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("DOMN")) { filteredList.add(buff); } } return (filteredList.toArray(new CFAstDomainBuff[0])); } public CFAstDomainBuff readBuffByIdIdx(CFAstAuthorization Authorization, long TenantId, long Id) { final String S_ProcName = "CFAstRamDomainBase.readBuffByIdIdx() "; CFAstDomainBaseBuff buff = readDerivedByIdIdx(Authorization, TenantId, Id); if ((buff != null) && buff.getClassCode().equals("BDOM")) { return ((CFAstDomainBuff) buff); } else { return (null); } } public CFAstDomainBuff[] readBuffByTenantIdx(CFAstAuthorization Authorization, long TenantId) { final String S_ProcName = "CFAstRamDomainBase.readBuffByTenantIdx() "; CFAstDomainBaseBuff buff; ArrayList<CFAstDomainBuff> filteredList = new ArrayList<CFAstDomainBuff>(); CFAstDomainBaseBuff[] buffList = readDerivedByTenantIdx(Authorization, TenantId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("BDOM")) { filteredList.add((CFAstDomainBuff) buff); } } return (filteredList.toArray(new CFAstDomainBuff[0])); } public CFAstDomainBuff[] readBuffBySubDomIdx(CFAstAuthorization Authorization, long TenantId, long SubDomainOfId) { final String S_ProcName = "CFAstRamDomain.readBuffBySubDomIdx() "; CFAstDomainBuff buff; ArrayList<CFAstDomainBuff> filteredList = new ArrayList<CFAstDomainBuff>(); CFAstDomainBuff[] buffList = readDerivedBySubDomIdx(Authorization, TenantId, SubDomainOfId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("DOMN")) { filteredList.add((CFAstDomainBuff) buff); } } return (filteredList.toArray(new CFAstDomainBuff[0])); } public CFAstDomainBuff readBuffByNameIdx(CFAstAuthorization Authorization, long TenantId, long SubDomainOfId, String Name) { final String S_ProcName = "CFAstRamDomain.readBuffByNameIdx() "; CFAstDomainBuff buff = readDerivedByNameIdx(Authorization, TenantId, SubDomainOfId, Name); if ((buff != null) && buff.getClassCode().equals("DOMN")) { return ((CFAstDomainBuff) buff); } else { return (null); } } public void updateDomain(CFAstAuthorization Authorization, CFAstDomainBuff Buff) { schema.getTableDomainBase().updateDomainBase(Authorization, Buff); CFAstDomainBasePKey pkey = schema.getFactoryDomainBase().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredId(Buff.getRequiredId()); CFAstDomainBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateDomain", "Existing record not found", "Domain", pkey); } CFAstDomainBySubDomIdxKey existingKeySubDomIdx = schema.getFactoryDomain().newSubDomIdxKey(); existingKeySubDomIdx.setRequiredTenantId(existing.getRequiredTenantId()); existingKeySubDomIdx.setRequiredSubDomainOfId(existing.getRequiredSubDomainOfId()); CFAstDomainBySubDomIdxKey newKeySubDomIdx = schema.getFactoryDomain().newSubDomIdxKey(); newKeySubDomIdx.setRequiredTenantId(Buff.getRequiredTenantId()); newKeySubDomIdx.setRequiredSubDomainOfId(Buff.getRequiredSubDomainOfId()); CFAstDomainByNameIdxKey existingKeyNameIdx = schema.getFactoryDomain().newNameIdxKey(); existingKeyNameIdx.setRequiredTenantId(existing.getRequiredTenantId()); existingKeyNameIdx.setRequiredSubDomainOfId(existing.getRequiredSubDomainOfId()); existingKeyNameIdx.setRequiredName(existing.getRequiredName()); CFAstDomainByNameIdxKey newKeyNameIdx = schema.getFactoryDomain().newNameIdxKey(); newKeyNameIdx.setRequiredTenantId(Buff.getRequiredTenantId()); newKeyNameIdx.setRequiredSubDomainOfId(Buff.getRequiredSubDomainOfId()); newKeyNameIdx.setRequiredName(Buff.getRequiredName()); // Check unique indexes if (!existingKeyNameIdx.equals(newKeyNameIdx)) { if (dictByNameIdx.containsKey(newKeyNameIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "updateDomain", "DomainNameIdx", newKeyNameIdx); } } // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema.getTableDomainBase().readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId(), Buff.getRequiredId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateDomain", "Superclass", "SuperClass", "DomainBase", null); } } } { boolean allNull = true; if (allNull) { if (null == schema.getTableDomainBase().readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId(), Buff.getRequiredSubDomainOfId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateDomain", "Container", "ParentDomain", "DomainBase", null); } } } // Update is valid SortedMap<CFAstDomainBasePKey, CFAstDomainBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); subdict = dictBySubDomIdx.get(existingKeySubDomIdx); if (subdict != null) { subdict.remove(pkey); } if (dictBySubDomIdx.containsKey(newKeySubDomIdx)) { subdict = dictBySubDomIdx.get(newKeySubDomIdx); } else { subdict = new TreeMap<CFAstDomainBasePKey, CFAstDomainBuff>(); dictBySubDomIdx.put(newKeySubDomIdx, subdict); } subdict.put(pkey, Buff); dictByNameIdx.remove(existingKeyNameIdx); dictByNameIdx.put(newKeyNameIdx, Buff); } public void deleteDomain(CFAstAuthorization Authorization, CFAstDomainBuff Buff) { final String S_ProcName = "CFAstRamDomainTable.deleteDomain() "; CFAstDomainBasePKey pkey = schema.getFactoryDomainBase().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredId(Buff.getRequiredId()); CFAstDomainBuff existing = dictByPKey.get(pkey); if (existing == null) { return; } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteDomain", pkey); } CFAstDomainBySubDomIdxKey keySubDomIdx = schema.getFactoryDomain().newSubDomIdxKey(); keySubDomIdx.setRequiredTenantId(existing.getRequiredTenantId()); keySubDomIdx.setRequiredSubDomainOfId(existing.getRequiredSubDomainOfId()); CFAstDomainByNameIdxKey keyNameIdx = schema.getFactoryDomain().newNameIdxKey(); keyNameIdx.setRequiredTenantId(existing.getRequiredTenantId()); keyNameIdx.setRequiredSubDomainOfId(existing.getRequiredSubDomainOfId()); keyNameIdx.setRequiredName(existing.getRequiredName()); // Validate reverse foreign keys // Delete is valid schema.getTableTopProject().deleteTopProjectByDomainIdx(Authorization, Buff.getRequiredTenantId(), Buff.getRequiredId()); SortedMap<CFAstDomainBasePKey, CFAstDomainBuff> subdict; dictByPKey.remove(pkey); subdict = dictBySubDomIdx.get(keySubDomIdx); subdict.remove(pkey); dictByNameIdx.remove(keyNameIdx); schema.getTableDomainBase().deleteDomainBase(Authorization, Buff); } public void deleteDomainBySubDomIdx(CFAstAuthorization Authorization, long argTenantId, long argSubDomainOfId) { CFAstDomainBySubDomIdxKey key = schema.getFactoryDomain().newSubDomIdxKey(); key.setRequiredTenantId(argTenantId); key.setRequiredSubDomainOfId(argSubDomainOfId); deleteDomainBySubDomIdx(Authorization, key); } public void deleteDomainBySubDomIdx(CFAstAuthorization Authorization, CFAstDomainBySubDomIdxKey argKey) { CFAstDomainBuff cur; LinkedList<CFAstDomainBuff> matchSet = new LinkedList<CFAstDomainBuff>(); Iterator<CFAstDomainBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAstDomainBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteDomain(Authorization, cur); } } public void deleteDomainByNameIdx(CFAstAuthorization Authorization, long argTenantId, long argSubDomainOfId, String argName) { CFAstDomainByNameIdxKey key = schema.getFactoryDomain().newNameIdxKey(); key.setRequiredTenantId(argTenantId); key.setRequiredSubDomainOfId(argSubDomainOfId); key.setRequiredName(argName); deleteDomainByNameIdx(Authorization, key); } public void deleteDomainByNameIdx(CFAstAuthorization Authorization, CFAstDomainByNameIdxKey argKey) { CFAstDomainBuff cur; LinkedList<CFAstDomainBuff> matchSet = new LinkedList<CFAstDomainBuff>(); Iterator<CFAstDomainBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAstDomainBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteDomain(Authorization, cur); } } public void deleteDomainByIdIdx(CFAstAuthorization Authorization, long argTenantId, long argId) { CFAstDomainBasePKey key = schema.getFactoryDomainBase().newPKey(); key.setRequiredTenantId(argTenantId); key.setRequiredId(argId); deleteDomainByIdIdx(Authorization, key); } public void deleteDomainByIdIdx(CFAstAuthorization Authorization, CFAstDomainBasePKey argKey) { CFAstDomainBuff cur; LinkedList<CFAstDomainBuff> matchSet = new LinkedList<CFAstDomainBuff>(); Iterator<CFAstDomainBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAstDomainBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteDomain(Authorization, cur); } } public void deleteDomainByTenantIdx(CFAstAuthorization Authorization, long argTenantId) { CFAstDomainBaseByTenantIdxKey key = schema.getFactoryDomainBase().newTenantIdxKey(); key.setRequiredTenantId(argTenantId); deleteDomainByTenantIdx(Authorization, key); } public void deleteDomainByTenantIdx(CFAstAuthorization Authorization, CFAstDomainBaseByTenantIdxKey argKey) { CFAstDomainBuff cur; LinkedList<CFAstDomainBuff> matchSet = new LinkedList<CFAstDomainBuff>(); Iterator<CFAstDomainBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAstDomainBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteDomain(Authorization, cur); } } public CFAstCursor openDomainCursorAll(CFAstAuthorization Authorization) { CFAstCursor cursor = new CFAstRamDomainCursor(Authorization, schema, dictByPKey.values()); return (cursor); } public CFAstCursor openDomainCursorBySubDomIdx(CFAstAuthorization Authorization, long TenantId, long SubDomainOfId) { CFAstCursor cursor; CFAstDomainBySubDomIdxKey key = schema.getFactoryDomain().newSubDomIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredSubDomainOfId(SubDomainOfId); if (dictBySubDomIdx.containsKey(key)) { SortedMap<CFAstDomainBasePKey, CFAstDomainBuff> subdictSubDomIdx = dictBySubDomIdx.get(key); cursor = new CFAstRamDomainCursor(Authorization, schema, subdictSubDomIdx.values()); } else { cursor = new CFAstRamDomainCursor(Authorization, schema, new ArrayList<CFAstDomainBuff>()); } return (cursor); } public void closeDomainCursor(CFAstCursor Cursor) { // Cursor.DataReader.Close(); } public CFAstDomainBuff nextDomainCursor(CFAstCursor Cursor) { CFAstRamDomainCursor cursor = (CFAstRamDomainCursor) Cursor; CFAstDomainBuff rec = cursor.getCursor().next(); cursor.setRowIdx(cursor.getRowIdx() + 1); return (rec); } public CFAstDomainBuff prevDomainCursor(CFAstCursor Cursor) { int targetRowIdx = (Cursor.getRowIdx() > 1) ? Cursor.getRowIdx() - 1 : 1; CFAstDomainBuff rec = null; if (Cursor.getRowIdx() >= targetRowIdx) { Cursor.reset(); } while (Cursor.getRowIdx() < targetRowIdx) { rec = nextDomainCursor(Cursor); } return (rec); } public CFAstDomainBuff firstDomainCursor(CFAstCursor Cursor) { int targetRowIdx = 1; CFAstDomainBuff rec = null; Cursor.reset(); while (Cursor.getRowIdx() < targetRowIdx) { rec = nextDomainCursor(Cursor); } return (rec); } public CFAstDomainBuff lastDomainCursor(CFAstCursor Cursor) { throw CFLib.getDefaultExceptionFactory().newNotImplementedYetException(getClass(), "lastDomainCursor"); } public CFAstDomainBuff nthDomainCursor(CFAstCursor Cursor, int Idx) { int targetRowIdx = Idx; CFAstDomainBuff rec = null; if (Cursor.getRowIdx() >= targetRowIdx) { Cursor.reset(); } while (Cursor.getRowIdx() < targetRowIdx) { rec = nextDomainCursor(Cursor); } return (rec); } public void releasePreparedStatements() { } }