Java tutorial
// Description: Java7 in-memory RAM DbIO implementation for TopDomain. /* * CF FreeSwitch 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.cffreeswitch.v2_0.CFFswRam; 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.cffreeswitch.v2_0.CFFsw.*; import net.sourceforge.msscodefactory.cffreeswitch.v2_0.CFFswRam.*; /* * CFFswRamTopDomainTable in-memory RAM DbIO implementation * for TopDomain. */ public class CFFswRamTopDomainTable implements ICFFswTopDomainTable { private CFFswRamSchema schema; private Map<CFFswDomainBasePKey, CFFswTopDomainBuff> dictByPKey = new HashMap<CFFswDomainBasePKey, CFFswTopDomainBuff>(); private SortedMap<CFFswTopDomainByTLDIdxKey, SortedMap<CFFswDomainBasePKey, CFFswTopDomainBuff>> dictByTLDIdx = new TreeMap<CFFswTopDomainByTLDIdxKey, SortedMap<CFFswDomainBasePKey, CFFswTopDomainBuff>>(); private SortedMap<CFFswTopDomainByNameIdxKey, CFFswTopDomainBuff> dictByNameIdx = new TreeMap<CFFswTopDomainByNameIdxKey, CFFswTopDomainBuff>(); public CFFswRamTopDomainTable(CFFswRamSchema argSchema) { schema = argSchema; } public void createTopDomain(CFFswAuthorization Authorization, CFFswTopDomainBuff Buff) { schema.getTableDomainBase().createDomainBase(Authorization, Buff); CFFswDomainBasePKey pkey = schema.getFactoryDomainBase().newPKey(); pkey.setClassCode(Buff.getClassCode()); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredId(Buff.getRequiredId()); CFFswTopDomainByTLDIdxKey keyTLDIdx = schema.getFactoryTopDomain().newTLDIdxKey(); keyTLDIdx.setRequiredTenantId(Buff.getRequiredTenantId()); keyTLDIdx.setRequiredTLDId(Buff.getRequiredTLDId()); CFFswTopDomainByNameIdxKey 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(), "createTopDomain", pkey); } if (dictByNameIdx.containsKey(keyNameIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "createTopDomain", "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(), "createTopDomain", "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(), "createTopDomain", "Container", "TLD", "Tld", null); } } } // Proceed with adding the new record dictByPKey.put(pkey, Buff); SortedMap<CFFswDomainBasePKey, CFFswTopDomainBuff> subdictTLDIdx; if (dictByTLDIdx.containsKey(keyTLDIdx)) { subdictTLDIdx = dictByTLDIdx.get(keyTLDIdx); } else { subdictTLDIdx = new TreeMap<CFFswDomainBasePKey, CFFswTopDomainBuff>(); dictByTLDIdx.put(keyTLDIdx, subdictTLDIdx); } subdictTLDIdx.put(pkey, Buff); dictByNameIdx.put(keyNameIdx, Buff); } public CFFswTopDomainBuff readDerived(CFFswAuthorization Authorization, CFFswDomainBasePKey PKey) { final String S_ProcName = "CFFswRamTopDomain.readDerived() "; CFFswDomainBasePKey key = schema.getFactoryDomainBase().newPKey(); key.setRequiredTenantId(PKey.getRequiredTenantId()); key.setRequiredId(PKey.getRequiredId()); CFFswTopDomainBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public CFFswTopDomainBuff lockDerived(CFFswAuthorization Authorization, CFFswDomainBasePKey PKey) { final String S_ProcName = "CFFswRamTopDomain.readDerived() "; CFFswDomainBasePKey key = schema.getFactoryDomainBase().newPKey(); key.setRequiredTenantId(PKey.getRequiredTenantId()); key.setRequiredId(PKey.getRequiredId()); CFFswTopDomainBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public CFFswTopDomainBuff[] readAllDerived(CFFswAuthorization Authorization) { final String S_ProcName = "CFFswRamTopDomain.readAllDerived() "; CFFswTopDomainBuff[] retList = new CFFswTopDomainBuff[dictByPKey.values().size()]; Iterator<CFFswTopDomainBuff> iter = dictByPKey.values().iterator(); int idx = 0; while (iter.hasNext()) { retList[idx++] = iter.next(); } return (retList); } public CFFswTopDomainBuff[] readDerivedByTenantIdx(CFFswAuthorization Authorization, long TenantId) { final String S_ProcName = "CFFswRamDomainBase.readDerivedByTenantIdx() "; CFFswDomainBaseBuff buffList[] = schema.getTableDomainBase().readDerivedByTenantIdx(Authorization, TenantId); if (buffList == null) { return (null); } else { CFFswDomainBaseBuff buff; ArrayList<CFFswTopDomainBuff> filteredList = new ArrayList<CFFswTopDomainBuff>(); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && (buff instanceof CFFswTopDomainBuff)) { filteredList.add((CFFswTopDomainBuff) buff); } } return (filteredList.toArray(new CFFswTopDomainBuff[0])); } } public CFFswTopDomainBuff[] readDerivedByTLDIdx(CFFswAuthorization Authorization, long TenantId, long TLDId) { final String S_ProcName = "CFFswRamTopDomain.readDerivedByTLDIdx() "; CFFswTopDomainByTLDIdxKey key = schema.getFactoryTopDomain().newTLDIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredTLDId(TLDId); CFFswTopDomainBuff[] recArray; if (dictByTLDIdx.containsKey(key)) { SortedMap<CFFswDomainBasePKey, CFFswTopDomainBuff> subdictTLDIdx = dictByTLDIdx.get(key); recArray = new CFFswTopDomainBuff[subdictTLDIdx.size()]; Iterator<CFFswTopDomainBuff> iter = subdictTLDIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new CFFswTopDomainBuff[0]; } return (recArray); } public CFFswTopDomainBuff readDerivedByNameIdx(CFFswAuthorization Authorization, long TenantId, long TLDId, String Name) { final String S_ProcName = "CFFswRamTopDomain.readDerivedByNameIdx() "; CFFswTopDomainByNameIdxKey key = schema.getFactoryTopDomain().newNameIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredTLDId(TLDId); key.setRequiredName(Name); CFFswTopDomainBuff buff; if (dictByNameIdx.containsKey(key)) { buff = dictByNameIdx.get(key); } else { buff = null; } return (buff); } public CFFswTopDomainBuff readDerivedByIdIdx(CFFswAuthorization Authorization, long TenantId, long Id) { final String S_ProcName = "CFFswRamDomainBase.readDerivedByIdIdx() "; CFFswDomainBasePKey key = schema.getFactoryDomainBase().newPKey(); key.setRequiredTenantId(TenantId); key.setRequiredId(Id); CFFswTopDomainBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public CFFswTopDomainBuff readBuff(CFFswAuthorization Authorization, CFFswDomainBasePKey PKey) { final String S_ProcName = "CFFswRamTopDomain.readBuff() "; CFFswTopDomainBuff buff = readDerived(Authorization, PKey); if ((buff != null) && (!buff.getClassCode().equals("TDOM"))) { buff = null; } return (buff); } public CFFswTopDomainBuff lockBuff(CFFswAuthorization Authorization, CFFswDomainBasePKey PKey) { final String S_ProcName = "CFFswRamTopDomain.readBuff() "; CFFswTopDomainBuff buff = readDerived(Authorization, PKey); if ((buff != null) && (!buff.getClassCode().equals("TDOM"))) { buff = null; } return (buff); } public CFFswTopDomainBuff[] readAllBuff(CFFswAuthorization Authorization) { final String S_ProcName = "CFFswRamTopDomain.readAllBuff() "; CFFswTopDomainBuff buff; ArrayList<CFFswTopDomainBuff> filteredList = new ArrayList<CFFswTopDomainBuff>(); CFFswTopDomainBuff[] 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 CFFswTopDomainBuff[0])); } public CFFswTopDomainBuff readBuffByIdIdx(CFFswAuthorization Authorization, long TenantId, long Id) { final String S_ProcName = "CFFswRamDomainBase.readBuffByIdIdx() "; CFFswDomainBaseBuff buff = readDerivedByIdIdx(Authorization, TenantId, Id); if ((buff != null) && buff.getClassCode().equals("BDOM")) { return ((CFFswTopDomainBuff) buff); } else { return (null); } } public CFFswTopDomainBuff[] readBuffByTenantIdx(CFFswAuthorization Authorization, long TenantId) { final String S_ProcName = "CFFswRamDomainBase.readBuffByTenantIdx() "; CFFswDomainBaseBuff buff; ArrayList<CFFswTopDomainBuff> filteredList = new ArrayList<CFFswTopDomainBuff>(); CFFswDomainBaseBuff[] buffList = readDerivedByTenantIdx(Authorization, TenantId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("BDOM")) { filteredList.add((CFFswTopDomainBuff) buff); } } return (filteredList.toArray(new CFFswTopDomainBuff[0])); } public CFFswTopDomainBuff[] readBuffByTLDIdx(CFFswAuthorization Authorization, long TenantId, long TLDId) { final String S_ProcName = "CFFswRamTopDomain.readBuffByTLDIdx() "; CFFswTopDomainBuff buff; ArrayList<CFFswTopDomainBuff> filteredList = new ArrayList<CFFswTopDomainBuff>(); CFFswTopDomainBuff[] 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((CFFswTopDomainBuff) buff); } } return (filteredList.toArray(new CFFswTopDomainBuff[0])); } public CFFswTopDomainBuff readBuffByNameIdx(CFFswAuthorization Authorization, long TenantId, long TLDId, String Name) { final String S_ProcName = "CFFswRamTopDomain.readBuffByNameIdx() "; CFFswTopDomainBuff buff = readDerivedByNameIdx(Authorization, TenantId, TLDId, Name); if ((buff != null) && buff.getClassCode().equals("TDOM")) { return ((CFFswTopDomainBuff) buff); } else { return (null); } } public void updateTopDomain(CFFswAuthorization Authorization, CFFswTopDomainBuff Buff) { schema.getTableDomainBase().updateDomainBase(Authorization, Buff); CFFswDomainBasePKey pkey = schema.getFactoryDomainBase().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredId(Buff.getRequiredId()); CFFswTopDomainBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateTopDomain", "Existing record not found", "TopDomain", pkey); } CFFswTopDomainByTLDIdxKey existingKeyTLDIdx = schema.getFactoryTopDomain().newTLDIdxKey(); existingKeyTLDIdx.setRequiredTenantId(existing.getRequiredTenantId()); existingKeyTLDIdx.setRequiredTLDId(existing.getRequiredTLDId()); CFFswTopDomainByTLDIdxKey newKeyTLDIdx = schema.getFactoryTopDomain().newTLDIdxKey(); newKeyTLDIdx.setRequiredTenantId(Buff.getRequiredTenantId()); newKeyTLDIdx.setRequiredTLDId(Buff.getRequiredTLDId()); CFFswTopDomainByNameIdxKey existingKeyNameIdx = schema.getFactoryTopDomain().newNameIdxKey(); existingKeyNameIdx.setRequiredTenantId(existing.getRequiredTenantId()); existingKeyNameIdx.setRequiredTLDId(existing.getRequiredTLDId()); existingKeyNameIdx.setRequiredName(existing.getRequiredName()); CFFswTopDomainByNameIdxKey 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 SortedMap<CFFswDomainBasePKey, CFFswTopDomainBuff> 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 TreeMap<CFFswDomainBasePKey, CFFswTopDomainBuff>(); dictByTLDIdx.put(newKeyTLDIdx, subdict); } subdict.put(pkey, Buff); dictByNameIdx.remove(existingKeyNameIdx); dictByNameIdx.put(newKeyNameIdx, Buff); } public void deleteTopDomain(CFFswAuthorization Authorization, CFFswTopDomainBuff Buff) { final String S_ProcName = "CFFswRamTopDomainTable.deleteTopDomain() "; CFFswDomainBasePKey pkey = schema.getFactoryDomainBase().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredId(Buff.getRequiredId()); CFFswTopDomainBuff existing = dictByPKey.get(pkey); if (existing == null) { return; } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteTopDomain", pkey); } CFFswTopDomainByTLDIdxKey keyTLDIdx = schema.getFactoryTopDomain().newTLDIdxKey(); keyTLDIdx.setRequiredTenantId(existing.getRequiredTenantId()); keyTLDIdx.setRequiredTLDId(existing.getRequiredTLDId()); CFFswTopDomainByNameIdxKey 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()); SortedMap<CFFswDomainBasePKey, CFFswTopDomainBuff> subdict; dictByPKey.remove(pkey); subdict = dictByTLDIdx.get(keyTLDIdx); subdict.remove(pkey); dictByNameIdx.remove(keyNameIdx); schema.getTableDomainBase().deleteDomainBase(Authorization, Buff); } public void deleteTopDomainByTLDIdx(CFFswAuthorization Authorization, long argTenantId, long argTLDId) { CFFswTopDomainByTLDIdxKey key = schema.getFactoryTopDomain().newTLDIdxKey(); key.setRequiredTenantId(argTenantId); key.setRequiredTLDId(argTLDId); deleteTopDomainByTLDIdx(Authorization, key); } public void deleteTopDomainByTLDIdx(CFFswAuthorization Authorization, CFFswTopDomainByTLDIdxKey argKey) { CFFswTopDomainBuff cur; LinkedList<CFFswTopDomainBuff> matchSet = new LinkedList<CFFswTopDomainBuff>(); Iterator<CFFswTopDomainBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFFswTopDomainBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteTopDomain(Authorization, cur); } } public void deleteTopDomainByNameIdx(CFFswAuthorization Authorization, long argTenantId, long argTLDId, String argName) { CFFswTopDomainByNameIdxKey key = schema.getFactoryTopDomain().newNameIdxKey(); key.setRequiredTenantId(argTenantId); key.setRequiredTLDId(argTLDId); key.setRequiredName(argName); deleteTopDomainByNameIdx(Authorization, key); } public void deleteTopDomainByNameIdx(CFFswAuthorization Authorization, CFFswTopDomainByNameIdxKey argKey) { CFFswTopDomainBuff cur; LinkedList<CFFswTopDomainBuff> matchSet = new LinkedList<CFFswTopDomainBuff>(); Iterator<CFFswTopDomainBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFFswTopDomainBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteTopDomain(Authorization, cur); } } public void deleteTopDomainByIdIdx(CFFswAuthorization Authorization, long argTenantId, long argId) { CFFswDomainBasePKey key = schema.getFactoryDomainBase().newPKey(); key.setRequiredTenantId(argTenantId); key.setRequiredId(argId); deleteTopDomainByIdIdx(Authorization, key); } public void deleteTopDomainByIdIdx(CFFswAuthorization Authorization, CFFswDomainBasePKey argKey) { CFFswTopDomainBuff cur; LinkedList<CFFswTopDomainBuff> matchSet = new LinkedList<CFFswTopDomainBuff>(); Iterator<CFFswTopDomainBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFFswTopDomainBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteTopDomain(Authorization, cur); } } public void deleteTopDomainByTenantIdx(CFFswAuthorization Authorization, long argTenantId) { CFFswDomainBaseByTenantIdxKey key = schema.getFactoryDomainBase().newTenantIdxKey(); key.setRequiredTenantId(argTenantId); deleteTopDomainByTenantIdx(Authorization, key); } public void deleteTopDomainByTenantIdx(CFFswAuthorization Authorization, CFFswDomainBaseByTenantIdxKey argKey) { CFFswTopDomainBuff cur; LinkedList<CFFswTopDomainBuff> matchSet = new LinkedList<CFFswTopDomainBuff>(); Iterator<CFFswTopDomainBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFFswTopDomainBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteTopDomain(Authorization, cur); } } public CFFswCursor openTopDomainCursorAll(CFFswAuthorization Authorization) { CFFswCursor cursor = new CFFswRamTopDomainCursor(Authorization, schema, dictByPKey.values()); return (cursor); } public CFFswCursor openTopDomainCursorByTLDIdx(CFFswAuthorization Authorization, long TenantId, long TLDId) { CFFswCursor cursor; CFFswTopDomainByTLDIdxKey key = schema.getFactoryTopDomain().newTLDIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredTLDId(TLDId); if (dictByTLDIdx.containsKey(key)) { SortedMap<CFFswDomainBasePKey, CFFswTopDomainBuff> subdictTLDIdx = dictByTLDIdx.get(key); cursor = new CFFswRamTopDomainCursor(Authorization, schema, subdictTLDIdx.values()); } else { cursor = new CFFswRamTopDomainCursor(Authorization, schema, new ArrayList<CFFswTopDomainBuff>()); } return (cursor); } public void closeTopDomainCursor(CFFswCursor Cursor) { // Cursor.DataReader.Close(); } public CFFswTopDomainBuff nextTopDomainCursor(CFFswCursor Cursor) { CFFswRamTopDomainCursor cursor = (CFFswRamTopDomainCursor) Cursor; CFFswTopDomainBuff rec = cursor.getCursor().next(); cursor.setRowIdx(cursor.getRowIdx() + 1); return (rec); } public CFFswTopDomainBuff prevTopDomainCursor(CFFswCursor Cursor) { int targetRowIdx = (Cursor.getRowIdx() > 1) ? Cursor.getRowIdx() - 1 : 1; CFFswTopDomainBuff rec = null; if (Cursor.getRowIdx() >= targetRowIdx) { Cursor.reset(); } while (Cursor.getRowIdx() < targetRowIdx) { rec = nextTopDomainCursor(Cursor); } return (rec); } public CFFswTopDomainBuff firstTopDomainCursor(CFFswCursor Cursor) { int targetRowIdx = 1; CFFswTopDomainBuff rec = null; Cursor.reset(); while (Cursor.getRowIdx() < targetRowIdx) { rec = nextTopDomainCursor(Cursor); } return (rec); } public CFFswTopDomainBuff lastTopDomainCursor(CFFswCursor Cursor) { throw CFLib.getDefaultExceptionFactory().newNotImplementedYetException(getClass(), "lastTopDomainCursor"); } public CFFswTopDomainBuff nthTopDomainCursor(CFFswCursor Cursor, int Idx) { int targetRowIdx = Idx; CFFswTopDomainBuff rec = null; if (Cursor.getRowIdx() >= targetRowIdx) { Cursor.reset(); } while (Cursor.getRowIdx() < targetRowIdx) { rec = nextTopDomainCursor(Cursor); } return (rec); } public void releasePreparedStatements() { } }