Java tutorial
// Description: Java7 in-memory RAM DbIO implementation for TopDomain. /* * Code Factory Asterisk 11 Configuration Model * * Copyright (c) 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.1-cfsecurity.xml), * CFInternet (net-sourceforge-msscodefactory-2.1-cfinternet.xml), and * CFCrm 2.1 (net-sourceforge-msscodefactory-2.1-cfcrm.xml), with all of the * required models being available as part of the MSS Code Factory 2.0 * distribution source and install zips. * * You can download installations of MSS Code Factory 2.0 from * http://msscodefactory.sourceforge.net/ * * *********************************************************************** * * Code manufactured by MSS Code Factory */ package net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstRam; import java.sql.*; import java.util.*; import net.sourceforge.msscodefactory.cflib.v2_1.CFLib.*; import org.apache.commons.codec.binary.Base64; import net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAst.*; import net.sourceforge.msscodefactory.cfasterisk.v2_1.CFAstRam.*; /* * CFAstRamTopDomainTable in-memory RAM DbIO implementation * for TopDomain. */ public class CFAstRamTopDomainTable implements ICFAstTopDomainTable { private CFAstRamSchema schema; private Map<CFAstDomainBasePKey, CFAstTopDomainBuff> dictByPKey = new HashMap<CFAstDomainBasePKey, CFAstTopDomainBuff>(); private Map<CFAstTopDomainByTldIdxKey, Map<CFAstDomainBasePKey, CFAstTopDomainBuff>> dictByTldIdx = new HashMap<CFAstTopDomainByTldIdxKey, Map<CFAstDomainBasePKey, CFAstTopDomainBuff>>(); private Map<CFAstTopDomainByNameIdxKey, CFAstTopDomainBuff> dictByNameIdx = new HashMap<CFAstTopDomainByNameIdxKey, CFAstTopDomainBuff>(); public CFAstRamTopDomainTable(CFAstRamSchema argSchema) { schema = argSchema; } public void createTopDomain(CFAstAuthorization Authorization, CFAstTopDomainBuff Buff) { final String S_ProcName = "createTopDomain"; schema.getTableDomainBase().createDomainBase(Authorization, Buff); CFAstDomainBasePKey pkey = schema.getFactoryDomainBase().newPKey(); pkey.setClassCode(Buff.getClassCode()); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredId(Buff.getRequiredId()); CFAstTopDomainByTldIdxKey keyTldIdx = schema.getFactoryTopDomain().newTldIdxKey(); keyTldIdx.setRequiredTenantId(Buff.getRequiredTenantId()); keyTldIdx.setRequiredTldId(Buff.getRequiredTldId()); CFAstTopDomainByNameIdxKey keyNameIdx = schema.getFactoryTopDomain().newNameIdxKey(); keyNameIdx.setRequiredTenantId(Buff.getRequiredTenantId()); keyNameIdx.setRequiredTldId(Buff.getRequiredTldId()); keyNameIdx.setRequiredName(Buff.getRequiredName()); // Validate unique indexes if (dictByPKey.containsKey(pkey)) { throw CFLib.getDefaultExceptionFactory().newPrimaryKeyNotNewException(getClass(), S_ProcName, pkey); } if (dictByNameIdx.containsKey(keyNameIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, "TopDomainNameIdx", 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(), S_ProcName, "Superclass", "SuperClass", "DomainBase", null); } } } { boolean allNull = true; allNull = false; allNull = false; if (!allNull) { if (null == schema.getTableTld().readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId(), Buff.getRequiredTldId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), S_ProcName, "Container", "Tld", "Tld", null); } } } // Proceed with adding the new record dictByPKey.put(pkey, Buff); Map<CFAstDomainBasePKey, CFAstTopDomainBuff> subdictTldIdx; if (dictByTldIdx.containsKey(keyTldIdx)) { subdictTldIdx = dictByTldIdx.get(keyTldIdx); } else { subdictTldIdx = new HashMap<CFAstDomainBasePKey, CFAstTopDomainBuff>(); dictByTldIdx.put(keyTldIdx, subdictTldIdx); } subdictTldIdx.put(pkey, Buff); dictByNameIdx.put(keyNameIdx, Buff); } public CFAstTopDomainBuff readDerived(CFAstAuthorization Authorization, CFAstDomainBasePKey PKey) { final String S_ProcName = "CFAstRamTopDomain.readDerived() "; CFAstDomainBasePKey key = schema.getFactoryDomainBase().newPKey(); key.setRequiredTenantId(PKey.getRequiredTenantId()); key.setRequiredId(PKey.getRequiredId()); CFAstTopDomainBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public CFAstTopDomainBuff lockDerived(CFAstAuthorization Authorization, CFAstDomainBasePKey PKey) { final String S_ProcName = "CFAstRamTopDomain.readDerived() "; CFAstDomainBasePKey key = schema.getFactoryDomainBase().newPKey(); key.setRequiredTenantId(PKey.getRequiredTenantId()); key.setRequiredId(PKey.getRequiredId()); CFAstTopDomainBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public CFAstTopDomainBuff[] readAllDerived(CFAstAuthorization Authorization) { final String S_ProcName = "CFAstRamTopDomain.readAllDerived() "; CFAstTopDomainBuff[] retList = new CFAstTopDomainBuff[dictByPKey.values().size()]; Iterator<CFAstTopDomainBuff> iter = dictByPKey.values().iterator(); int idx = 0; while (iter.hasNext()) { retList[idx++] = iter.next(); } return (retList); } public CFAstTopDomainBuff[] 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<CFAstTopDomainBuff> filteredList = new ArrayList<CFAstTopDomainBuff>(); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && (buff instanceof CFAstTopDomainBuff)) { filteredList.add((CFAstTopDomainBuff) buff); } } return (filteredList.toArray(new CFAstTopDomainBuff[0])); } } public CFAstTopDomainBuff[] readDerivedByTldIdx(CFAstAuthorization Authorization, long TenantId, long TldId) { final String S_ProcName = "CFAstRamTopDomain.readDerivedByTldIdx() "; CFAstTopDomainByTldIdxKey key = schema.getFactoryTopDomain().newTldIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredTldId(TldId); CFAstTopDomainBuff[] recArray; if (dictByTldIdx.containsKey(key)) { Map<CFAstDomainBasePKey, CFAstTopDomainBuff> subdictTldIdx = dictByTldIdx.get(key); recArray = new CFAstTopDomainBuff[subdictTldIdx.size()]; Iterator<CFAstTopDomainBuff> iter = subdictTldIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { Map<CFAstDomainBasePKey, CFAstTopDomainBuff> subdictTldIdx = new HashMap<CFAstDomainBasePKey, CFAstTopDomainBuff>(); dictByTldIdx.put(key, subdictTldIdx); recArray = new CFAstTopDomainBuff[0]; } return (recArray); } public CFAstTopDomainBuff readDerivedByNameIdx(CFAstAuthorization Authorization, long TenantId, long TldId, String Name) { final String S_ProcName = "CFAstRamTopDomain.readDerivedByNameIdx() "; CFAstTopDomainByNameIdxKey key = schema.getFactoryTopDomain().newNameIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredTldId(TldId); key.setRequiredName(Name); CFAstTopDomainBuff buff; if (dictByNameIdx.containsKey(key)) { buff = dictByNameIdx.get(key); } else { buff = null; } return (buff); } public CFAstTopDomainBuff readDerivedByIdIdx(CFAstAuthorization Authorization, long TenantId, long Id) { final String S_ProcName = "CFAstRamDomainBase.readDerivedByIdIdx() "; CFAstDomainBasePKey key = schema.getFactoryDomainBase().newPKey(); key.setRequiredTenantId(TenantId); key.setRequiredId(Id); CFAstTopDomainBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public CFAstTopDomainBuff readBuff(CFAstAuthorization Authorization, CFAstDomainBasePKey PKey) { final String S_ProcName = "CFAstRamTopDomain.readBuff() "; CFAstTopDomainBuff buff = readDerived(Authorization, PKey); if ((buff != null) && (!buff.getClassCode().equals("TDOM"))) { buff = null; } return (buff); } public CFAstTopDomainBuff lockBuff(CFAstAuthorization Authorization, CFAstDomainBasePKey PKey) { final String S_ProcName = "CFAstRamTopDomain.readBuff() "; CFAstTopDomainBuff buff = readDerived(Authorization, PKey); if ((buff != null) && (!buff.getClassCode().equals("TDOM"))) { buff = null; } return (buff); } public CFAstTopDomainBuff[] readAllBuff(CFAstAuthorization Authorization) { final String S_ProcName = "CFAstRamTopDomain.readAllBuff() "; CFAstTopDomainBuff buff; ArrayList<CFAstTopDomainBuff> filteredList = new ArrayList<CFAstTopDomainBuff>(); CFAstTopDomainBuff[] buffList = readAllDerived(Authorization); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("TDOM")) { filteredList.add(buff); } } return (filteredList.toArray(new CFAstTopDomainBuff[0])); } public CFAstTopDomainBuff 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 ((CFAstTopDomainBuff) buff); } else { return (null); } } public CFAstTopDomainBuff[] readBuffByTenantIdx(CFAstAuthorization Authorization, long TenantId) { final String S_ProcName = "CFAstRamDomainBase.readBuffByTenantIdx() "; CFAstDomainBaseBuff buff; ArrayList<CFAstTopDomainBuff> filteredList = new ArrayList<CFAstTopDomainBuff>(); 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((CFAstTopDomainBuff) buff); } } return (filteredList.toArray(new CFAstTopDomainBuff[0])); } public CFAstTopDomainBuff[] readBuffByTldIdx(CFAstAuthorization Authorization, long TenantId, long TldId) { final String S_ProcName = "CFAstRamTopDomain.readBuffByTldIdx() "; CFAstTopDomainBuff buff; ArrayList<CFAstTopDomainBuff> filteredList = new ArrayList<CFAstTopDomainBuff>(); CFAstTopDomainBuff[] buffList = readDerivedByTldIdx(Authorization, TenantId, TldId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("TDOM")) { filteredList.add((CFAstTopDomainBuff) buff); } } return (filteredList.toArray(new CFAstTopDomainBuff[0])); } public CFAstTopDomainBuff readBuffByNameIdx(CFAstAuthorization Authorization, long TenantId, long TldId, String Name) { final String S_ProcName = "CFAstRamTopDomain.readBuffByNameIdx() "; CFAstTopDomainBuff buff = readDerivedByNameIdx(Authorization, TenantId, TldId, Name); if ((buff != null) && buff.getClassCode().equals("TDOM")) { return ((CFAstTopDomainBuff) buff); } else { return (null); } } public void updateTopDomain(CFAstAuthorization Authorization, CFAstTopDomainBuff Buff) { schema.getTableDomainBase().updateDomainBase(Authorization, Buff); CFAstDomainBasePKey pkey = schema.getFactoryDomainBase().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredId(Buff.getRequiredId()); CFAstTopDomainBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateTopDomain", "Existing record not found", "TopDomain", pkey); } CFAstTopDomainByTldIdxKey existingKeyTldIdx = schema.getFactoryTopDomain().newTldIdxKey(); existingKeyTldIdx.setRequiredTenantId(existing.getRequiredTenantId()); existingKeyTldIdx.setRequiredTldId(existing.getRequiredTldId()); CFAstTopDomainByTldIdxKey newKeyTldIdx = schema.getFactoryTopDomain().newTldIdxKey(); newKeyTldIdx.setRequiredTenantId(Buff.getRequiredTenantId()); newKeyTldIdx.setRequiredTldId(Buff.getRequiredTldId()); CFAstTopDomainByNameIdxKey existingKeyNameIdx = schema.getFactoryTopDomain().newNameIdxKey(); existingKeyNameIdx.setRequiredTenantId(existing.getRequiredTenantId()); existingKeyNameIdx.setRequiredTldId(existing.getRequiredTldId()); existingKeyNameIdx.setRequiredName(existing.getRequiredName()); CFAstTopDomainByNameIdxKey newKeyNameIdx = schema.getFactoryTopDomain().newNameIdxKey(); newKeyNameIdx.setRequiredTenantId(Buff.getRequiredTenantId()); newKeyNameIdx.setRequiredTldId(Buff.getRequiredTldId()); newKeyNameIdx.setRequiredName(Buff.getRequiredName()); // Check unique indexes if (!existingKeyNameIdx.equals(newKeyNameIdx)) { if (dictByNameIdx.containsKey(newKeyNameIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "updateTopDomain", "TopDomainNameIdx", newKeyNameIdx); } } // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema.getTableDomainBase().readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId(), Buff.getRequiredId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateTopDomain", "Superclass", "SuperClass", "DomainBase", null); } } } { boolean allNull = true; if (allNull) { if (null == schema.getTableTld().readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId(), Buff.getRequiredTldId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateTopDomain", "Container", "Tld", "Tld", null); } } } // Update is valid Map<CFAstDomainBasePKey, CFAstTopDomainBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); subdict = dictByTldIdx.get(existingKeyTldIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByTldIdx.containsKey(newKeyTldIdx)) { subdict = dictByTldIdx.get(newKeyTldIdx); } else { subdict = new HashMap<CFAstDomainBasePKey, CFAstTopDomainBuff>(); dictByTldIdx.put(newKeyTldIdx, subdict); } subdict.put(pkey, Buff); dictByNameIdx.remove(existingKeyNameIdx); dictByNameIdx.put(newKeyNameIdx, Buff); } public void deleteTopDomain(CFAstAuthorization Authorization, CFAstTopDomainBuff Buff) { final String S_ProcName = "CFAstRamTopDomainTable.deleteTopDomain() "; CFAstDomainBasePKey pkey = schema.getFactoryDomainBase().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredId(Buff.getRequiredId()); CFAstTopDomainBuff existing = dictByPKey.get(pkey); if (existing == null) { return; } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteTopDomain", pkey); } CFAstTopDomainByTldIdxKey keyTldIdx = schema.getFactoryTopDomain().newTldIdxKey(); keyTldIdx.setRequiredTenantId(existing.getRequiredTenantId()); keyTldIdx.setRequiredTldId(existing.getRequiredTldId()); CFAstTopDomainByNameIdxKey keyNameIdx = schema.getFactoryTopDomain().newNameIdxKey(); keyNameIdx.setRequiredTenantId(existing.getRequiredTenantId()); keyNameIdx.setRequiredTldId(existing.getRequiredTldId()); keyNameIdx.setRequiredName(existing.getRequiredName()); // Validate reverse foreign keys // Delete is valid schema.getTableDomain().deleteDomainBySubDomIdx(Authorization, Buff.getRequiredTenantId(), Buff.getRequiredId()); schema.getTableTopProject().deleteTopProjectByDomainIdx(Authorization, Buff.getRequiredTenantId(), Buff.getRequiredId()); Map<CFAstDomainBasePKey, CFAstTopDomainBuff> subdict; dictByPKey.remove(pkey); subdict = dictByTldIdx.get(keyTldIdx); subdict.remove(pkey); dictByNameIdx.remove(keyNameIdx); schema.getTableDomainBase().deleteDomainBase(Authorization, Buff); } public void deleteTopDomainByTldIdx(CFAstAuthorization Authorization, long argTenantId, long argTldId) { CFAstTopDomainByTldIdxKey key = schema.getFactoryTopDomain().newTldIdxKey(); key.setRequiredTenantId(argTenantId); key.setRequiredTldId(argTldId); deleteTopDomainByTldIdx(Authorization, key); } public void deleteTopDomainByTldIdx(CFAstAuthorization Authorization, CFAstTopDomainByTldIdxKey argKey) { CFAstTopDomainBuff cur; LinkedList<CFAstTopDomainBuff> matchSet = new LinkedList<CFAstTopDomainBuff>(); Iterator<CFAstTopDomainBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAstTopDomainBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteTopDomain(Authorization, cur); } } public void deleteTopDomainByNameIdx(CFAstAuthorization Authorization, long argTenantId, long argTldId, String argName) { CFAstTopDomainByNameIdxKey key = schema.getFactoryTopDomain().newNameIdxKey(); key.setRequiredTenantId(argTenantId); key.setRequiredTldId(argTldId); key.setRequiredName(argName); deleteTopDomainByNameIdx(Authorization, key); } public void deleteTopDomainByNameIdx(CFAstAuthorization Authorization, CFAstTopDomainByNameIdxKey argKey) { CFAstTopDomainBuff cur; LinkedList<CFAstTopDomainBuff> matchSet = new LinkedList<CFAstTopDomainBuff>(); Iterator<CFAstTopDomainBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAstTopDomainBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteTopDomain(Authorization, cur); } } public void deleteTopDomainByIdIdx(CFAstAuthorization Authorization, long argTenantId, long argId) { CFAstDomainBasePKey key = schema.getFactoryDomainBase().newPKey(); key.setRequiredTenantId(argTenantId); key.setRequiredId(argId); deleteTopDomainByIdIdx(Authorization, key); } public void deleteTopDomainByIdIdx(CFAstAuthorization Authorization, CFAstDomainBasePKey argKey) { CFAstTopDomainBuff cur; LinkedList<CFAstTopDomainBuff> matchSet = new LinkedList<CFAstTopDomainBuff>(); Iterator<CFAstTopDomainBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAstTopDomainBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteTopDomain(Authorization, cur); } } public void deleteTopDomainByTenantIdx(CFAstAuthorization Authorization, long argTenantId) { CFAstDomainBaseByTenantIdxKey key = schema.getFactoryDomainBase().newTenantIdxKey(); key.setRequiredTenantId(argTenantId); deleteTopDomainByTenantIdx(Authorization, key); } public void deleteTopDomainByTenantIdx(CFAstAuthorization Authorization, CFAstDomainBaseByTenantIdxKey argKey) { CFAstTopDomainBuff cur; LinkedList<CFAstTopDomainBuff> matchSet = new LinkedList<CFAstTopDomainBuff>(); Iterator<CFAstTopDomainBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAstTopDomainBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteTopDomain(Authorization, cur); } } public CFAstCursor openTopDomainCursorAll(CFAstAuthorization Authorization) { CFAstCursor cursor = new CFAstRamTopDomainCursor(Authorization, schema, dictByPKey.values()); return (cursor); } public CFAstCursor openTopDomainCursorByTldIdx(CFAstAuthorization Authorization, long TenantId, long TldId) { CFAstCursor cursor; CFAstTopDomainByTldIdxKey key = schema.getFactoryTopDomain().newTldIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredTldId(TldId); if (dictByTldIdx.containsKey(key)) { Map<CFAstDomainBasePKey, CFAstTopDomainBuff> subdictTldIdx = dictByTldIdx.get(key); cursor = new CFAstRamTopDomainCursor(Authorization, schema, subdictTldIdx.values()); } else { cursor = new CFAstRamTopDomainCursor(Authorization, schema, new ArrayList<CFAstTopDomainBuff>()); } return (cursor); } public void closeTopDomainCursor(CFAstCursor Cursor) { // Cursor.DataReader.Close(); } public CFAstTopDomainBuff nextTopDomainCursor(CFAstCursor Cursor) { CFAstRamTopDomainCursor cursor = (CFAstRamTopDomainCursor) Cursor; CFAstTopDomainBuff rec = cursor.getCursor().next(); cursor.setRowIdx(cursor.getRowIdx() + 1); return (rec); } public CFAstTopDomainBuff prevTopDomainCursor(CFAstCursor Cursor) { int targetRowIdx = (Cursor.getRowIdx() > 1) ? Cursor.getRowIdx() - 1 : 1; CFAstTopDomainBuff rec = null; if (Cursor.getRowIdx() >= targetRowIdx) { Cursor.reset(); } while (Cursor.getRowIdx() < targetRowIdx) { rec = nextTopDomainCursor(Cursor); } return (rec); } public CFAstTopDomainBuff firstTopDomainCursor(CFAstCursor Cursor) { int targetRowIdx = 1; CFAstTopDomainBuff rec = null; Cursor.reset(); while (Cursor.getRowIdx() < targetRowIdx) { rec = nextTopDomainCursor(Cursor); } return (rec); } public CFAstTopDomainBuff lastTopDomainCursor(CFAstCursor Cursor) { throw CFLib.getDefaultExceptionFactory().newNotImplementedYetException(getClass(), "lastTopDomainCursor"); } public CFAstTopDomainBuff nthTopDomainCursor(CFAstCursor Cursor, int Idx) { int targetRowIdx = Idx; CFAstTopDomainBuff rec = null; if (Cursor.getRowIdx() >= targetRowIdx) { Cursor.reset(); } while (Cursor.getRowIdx() < targetRowIdx) { rec = nextTopDomainCursor(Cursor); } return (rec); } public void releasePreparedStatements() { } }