Java tutorial
// Description: Java 8 in-memory RAM DbIO implementation for TopDomain. /* * Code Factory Asterisk 11 Configuration Model * * Copyright (c) 2014-2015 Mark Sobkow * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskRam; import java.sql.*; import java.util.*; import org.apache.commons.codec.binary.Base64; import net.sourceforge.msscodefactory.cflib.v2_3.CFLib.*; import net.sourceforge.msscodefactory.cfsecurity.v2_4.CFSecurity.*; import net.sourceforge.msscodefactory.cfinternet.v2_4.CFInternet.*; import net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsterisk.*; import net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskObj.*; import net.sourceforge.msscodefactory.cfsecurity.v2_4.CFSecurityObj.*; import net.sourceforge.msscodefactory.cfinternet.v2_4.CFInternetObj.*; import net.sourceforge.msscodefactory.cfasterisk.v2_4.CFAsteriskObj.*; /* * CFAsteriskRamTopDomainTable in-memory RAM DbIO implementation * for TopDomain. */ public class CFAsteriskRamTopDomainTable implements ICFAsteriskTopDomainTable { private ICFAsteriskSchema schema; private Map<CFInternetDomainBasePKey, CFInternetTopDomainBuff> dictByPKey = new HashMap<CFInternetDomainBasePKey, CFInternetTopDomainBuff>(); private Map<CFInternetTopDomainByTldIdxKey, Map<CFInternetDomainBasePKey, CFInternetTopDomainBuff>> dictByTldIdx = new HashMap<CFInternetTopDomainByTldIdxKey, Map<CFInternetDomainBasePKey, CFInternetTopDomainBuff>>(); private Map<CFInternetTopDomainByNameIdxKey, CFInternetTopDomainBuff> dictByNameIdx = new HashMap<CFInternetTopDomainByNameIdxKey, CFInternetTopDomainBuff>(); public CFAsteriskRamTopDomainTable(ICFAsteriskSchema argSchema) { schema = argSchema; } public void createTopDomain(CFSecurityAuthorization Authorization, CFInternetTopDomainBuff Buff) { final String S_ProcName = "createTopDomain"; schema.getTableDomainBase().createDomainBase(Authorization, Buff); CFInternetDomainBasePKey pkey = schema.getFactoryDomainBase().newPKey(); pkey.setClassCode(Buff.getClassCode()); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredId(Buff.getRequiredId()); CFInternetTopDomainByTldIdxKey keyTldIdx = schema.getFactoryTopDomain().newTldIdxKey(); keyTldIdx.setRequiredTenantId(Buff.getRequiredTenantId()); keyTldIdx.setRequiredTldId(Buff.getRequiredTldId()); CFInternetTopDomainByNameIdxKey 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<CFInternetDomainBasePKey, CFInternetTopDomainBuff> subdictTldIdx; if (dictByTldIdx.containsKey(keyTldIdx)) { subdictTldIdx = dictByTldIdx.get(keyTldIdx); } else { subdictTldIdx = new HashMap<CFInternetDomainBasePKey, CFInternetTopDomainBuff>(); dictByTldIdx.put(keyTldIdx, subdictTldIdx); } subdictTldIdx.put(pkey, Buff); dictByNameIdx.put(keyNameIdx, Buff); } public CFInternetTopDomainBuff readDerived(CFSecurityAuthorization Authorization, CFInternetDomainBasePKey PKey) { final String S_ProcName = "CFAsteriskRamTopDomain.readDerived"; CFInternetDomainBasePKey key = schema.getFactoryDomainBase().newPKey(); key.setRequiredTenantId(PKey.getRequiredTenantId()); key.setRequiredId(PKey.getRequiredId()); CFInternetTopDomainBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public CFInternetTopDomainBuff lockDerived(CFSecurityAuthorization Authorization, CFInternetDomainBasePKey PKey) { final String S_ProcName = "CFAsteriskRamTopDomain.readDerived"; CFInternetDomainBasePKey key = schema.getFactoryDomainBase().newPKey(); key.setRequiredTenantId(PKey.getRequiredTenantId()); key.setRequiredId(PKey.getRequiredId()); CFInternetTopDomainBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public CFInternetTopDomainBuff[] readAllDerived(CFSecurityAuthorization Authorization) { final String S_ProcName = "CFAsteriskRamTopDomain.readAllDerived"; CFInternetTopDomainBuff[] retList = new CFInternetTopDomainBuff[dictByPKey.values().size()]; Iterator<CFInternetTopDomainBuff> iter = dictByPKey.values().iterator(); int idx = 0; while (iter.hasNext()) { retList[idx++] = iter.next(); } return (retList); } public CFInternetTopDomainBuff[] readDerivedByTenantIdx(CFSecurityAuthorization Authorization, long TenantId) { final String S_ProcName = "CFAsteriskRamDomainBase.readDerivedByTenantIdx"; CFInternetDomainBaseBuff buffList[] = schema.getTableDomainBase().readDerivedByTenantIdx(Authorization, TenantId); if (buffList == null) { return (null); } else { CFInternetDomainBaseBuff buff; ArrayList<CFInternetTopDomainBuff> filteredList = new ArrayList<CFInternetTopDomainBuff>(); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && (buff instanceof CFInternetTopDomainBuff)) { filteredList.add((CFInternetTopDomainBuff) buff); } } return (filteredList.toArray(new CFInternetTopDomainBuff[0])); } } public CFInternetTopDomainBuff[] readDerivedByTldIdx(CFSecurityAuthorization Authorization, long TenantId, long TldId) { final String S_ProcName = "CFAsteriskRamTopDomain.readDerivedByTldIdx"; CFInternetTopDomainByTldIdxKey key = schema.getFactoryTopDomain().newTldIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredTldId(TldId); CFInternetTopDomainBuff[] recArray; if (dictByTldIdx.containsKey(key)) { Map<CFInternetDomainBasePKey, CFInternetTopDomainBuff> subdictTldIdx = dictByTldIdx.get(key); recArray = new CFInternetTopDomainBuff[subdictTldIdx.size()]; Iterator<CFInternetTopDomainBuff> iter = subdictTldIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { Map<CFInternetDomainBasePKey, CFInternetTopDomainBuff> subdictTldIdx = new HashMap<CFInternetDomainBasePKey, CFInternetTopDomainBuff>(); dictByTldIdx.put(key, subdictTldIdx); recArray = new CFInternetTopDomainBuff[0]; } return (recArray); } public CFInternetTopDomainBuff readDerivedByNameIdx(CFSecurityAuthorization Authorization, long TenantId, long TldId, String Name) { final String S_ProcName = "CFAsteriskRamTopDomain.readDerivedByNameIdx"; CFInternetTopDomainByNameIdxKey key = schema.getFactoryTopDomain().newNameIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredTldId(TldId); key.setRequiredName(Name); CFInternetTopDomainBuff buff; if (dictByNameIdx.containsKey(key)) { buff = dictByNameIdx.get(key); } else { buff = null; } return (buff); } public CFInternetTopDomainBuff readDerivedByIdIdx(CFSecurityAuthorization Authorization, long TenantId, long Id) { final String S_ProcName = "CFAsteriskRamDomainBase.readDerivedByIdIdx() "; CFInternetDomainBasePKey key = schema.getFactoryDomainBase().newPKey(); key.setRequiredTenantId(TenantId); key.setRequiredId(Id); CFInternetTopDomainBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public CFInternetTopDomainBuff readBuff(CFSecurityAuthorization Authorization, CFInternetDomainBasePKey PKey) { final String S_ProcName = "CFAsteriskRamTopDomain.readBuff"; CFInternetTopDomainBuff buff = readDerived(Authorization, PKey); if ((buff != null) && (!buff.getClassCode().equals("TDOM"))) { buff = null; } return (buff); } public CFInternetTopDomainBuff lockBuff(CFSecurityAuthorization Authorization, CFInternetDomainBasePKey PKey) { final String S_ProcName = "lockBuff"; CFInternetTopDomainBuff buff = readDerived(Authorization, PKey); if ((buff != null) && (!buff.getClassCode().equals("TDOM"))) { buff = null; } return (buff); } public CFInternetTopDomainBuff[] readAllBuff(CFSecurityAuthorization Authorization) { final String S_ProcName = "CFAsteriskRamTopDomain.readAllBuff"; CFInternetTopDomainBuff buff; ArrayList<CFInternetTopDomainBuff> filteredList = new ArrayList<CFInternetTopDomainBuff>(); CFInternetTopDomainBuff[] 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 CFInternetTopDomainBuff[0])); } public CFInternetTopDomainBuff readBuffByIdIdx(CFSecurityAuthorization Authorization, long TenantId, long Id) { final String S_ProcName = "CFAsteriskRamDomainBase.readBuffByIdIdx() "; CFInternetTopDomainBuff buff = readDerivedByIdIdx(Authorization, TenantId, Id); if ((buff != null) && buff.getClassCode().equals("BDOM")) { return ((CFInternetTopDomainBuff) buff); } else { return (null); } } public CFInternetTopDomainBuff[] readBuffByTenantIdx(CFSecurityAuthorization Authorization, long TenantId) { final String S_ProcName = "CFAsteriskRamDomainBase.readBuffByTenantIdx() "; CFInternetTopDomainBuff buff; ArrayList<CFInternetTopDomainBuff> filteredList = new ArrayList<CFInternetTopDomainBuff>(); CFInternetTopDomainBuff[] buffList = readDerivedByTenantIdx(Authorization, TenantId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("BDOM")) { filteredList.add((CFInternetTopDomainBuff) buff); } } return (filteredList.toArray(new CFInternetTopDomainBuff[0])); } public CFInternetTopDomainBuff[] readBuffByTldIdx(CFSecurityAuthorization Authorization, long TenantId, long TldId) { final String S_ProcName = "CFAsteriskRamTopDomain.readBuffByTldIdx() "; CFInternetTopDomainBuff buff; ArrayList<CFInternetTopDomainBuff> filteredList = new ArrayList<CFInternetTopDomainBuff>(); CFInternetTopDomainBuff[] 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((CFInternetTopDomainBuff) buff); } } return (filteredList.toArray(new CFInternetTopDomainBuff[0])); } public CFInternetTopDomainBuff readBuffByNameIdx(CFSecurityAuthorization Authorization, long TenantId, long TldId, String Name) { final String S_ProcName = "CFAsteriskRamTopDomain.readBuffByNameIdx() "; CFInternetTopDomainBuff buff = readDerivedByNameIdx(Authorization, TenantId, TldId, Name); if ((buff != null) && buff.getClassCode().equals("TDOM")) { return ((CFInternetTopDomainBuff) buff); } else { return (null); } } public void updateTopDomain(CFSecurityAuthorization Authorization, CFInternetTopDomainBuff Buff) { schema.getTableDomainBase().updateDomainBase(Authorization, Buff); CFInternetDomainBasePKey pkey = schema.getFactoryDomainBase().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredId(Buff.getRequiredId()); CFInternetTopDomainBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateTopDomain", "Existing record not found", "TopDomain", pkey); } CFInternetTopDomainByTldIdxKey existingKeyTldIdx = schema.getFactoryTopDomain().newTldIdxKey(); existingKeyTldIdx.setRequiredTenantId(existing.getRequiredTenantId()); existingKeyTldIdx.setRequiredTldId(existing.getRequiredTldId()); CFInternetTopDomainByTldIdxKey newKeyTldIdx = schema.getFactoryTopDomain().newTldIdxKey(); newKeyTldIdx.setRequiredTenantId(Buff.getRequiredTenantId()); newKeyTldIdx.setRequiredTldId(Buff.getRequiredTldId()); CFInternetTopDomainByNameIdxKey existingKeyNameIdx = schema.getFactoryTopDomain().newNameIdxKey(); existingKeyNameIdx.setRequiredTenantId(existing.getRequiredTenantId()); existingKeyNameIdx.setRequiredTldId(existing.getRequiredTldId()); existingKeyNameIdx.setRequiredName(existing.getRequiredName()); CFInternetTopDomainByNameIdxKey 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<CFInternetDomainBasePKey, CFInternetTopDomainBuff> 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<CFInternetDomainBasePKey, CFInternetTopDomainBuff>(); dictByTldIdx.put(newKeyTldIdx, subdict); } subdict.put(pkey, Buff); dictByNameIdx.remove(existingKeyNameIdx); dictByNameIdx.put(newKeyNameIdx, Buff); } public void deleteTopDomain(CFSecurityAuthorization Authorization, CFInternetTopDomainBuff Buff) { final String S_ProcName = "CFAsteriskRamTopDomainTable.deleteTopDomain() "; CFInternetDomainBasePKey pkey = schema.getFactoryDomainBase().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredId(Buff.getRequiredId()); CFInternetTopDomainBuff existing = dictByPKey.get(pkey); if (existing == null) { return; } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteTopDomain", pkey); } CFInternetTopDomainByTldIdxKey keyTldIdx = schema.getFactoryTopDomain().newTldIdxKey(); keyTldIdx.setRequiredTenantId(existing.getRequiredTenantId()); keyTldIdx.setRequiredTldId(existing.getRequiredTldId()); CFInternetTopDomainByNameIdxKey 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<CFInternetDomainBasePKey, CFInternetTopDomainBuff> subdict; dictByPKey.remove(pkey); subdict = dictByTldIdx.get(keyTldIdx); subdict.remove(pkey); dictByNameIdx.remove(keyNameIdx); schema.getTableDomainBase().deleteDomainBase(Authorization, Buff); } public void deleteTopDomainByTldIdx(CFSecurityAuthorization Authorization, long argTenantId, long argTldId) { CFInternetTopDomainByTldIdxKey key = schema.getFactoryTopDomain().newTldIdxKey(); key.setRequiredTenantId(argTenantId); key.setRequiredTldId(argTldId); deleteTopDomainByTldIdx(Authorization, key); } public void deleteTopDomainByTldIdx(CFSecurityAuthorization Authorization, CFInternetTopDomainByTldIdxKey argKey) { CFInternetTopDomainBuff cur; LinkedList<CFInternetTopDomainBuff> matchSet = new LinkedList<CFInternetTopDomainBuff>(); Iterator<CFInternetTopDomainBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFInternetTopDomainBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteTopDomain(Authorization, cur); } } public void deleteTopDomainByNameIdx(CFSecurityAuthorization Authorization, long argTenantId, long argTldId, String argName) { CFInternetTopDomainByNameIdxKey key = schema.getFactoryTopDomain().newNameIdxKey(); key.setRequiredTenantId(argTenantId); key.setRequiredTldId(argTldId); key.setRequiredName(argName); deleteTopDomainByNameIdx(Authorization, key); } public void deleteTopDomainByNameIdx(CFSecurityAuthorization Authorization, CFInternetTopDomainByNameIdxKey argKey) { CFInternetTopDomainBuff cur; LinkedList<CFInternetTopDomainBuff> matchSet = new LinkedList<CFInternetTopDomainBuff>(); Iterator<CFInternetTopDomainBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFInternetTopDomainBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteTopDomain(Authorization, cur); } } public void deleteTopDomainByIdIdx(CFSecurityAuthorization Authorization, long argTenantId, long argId) { CFInternetDomainBasePKey key = schema.getFactoryDomainBase().newPKey(); key.setRequiredTenantId(argTenantId); key.setRequiredId(argId); deleteTopDomainByIdIdx(Authorization, key); } public void deleteTopDomainByIdIdx(CFSecurityAuthorization Authorization, CFInternetDomainBasePKey argKey) { CFInternetTopDomainBuff cur; LinkedList<CFInternetTopDomainBuff> matchSet = new LinkedList<CFInternetTopDomainBuff>(); Iterator<CFInternetTopDomainBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFInternetTopDomainBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteTopDomain(Authorization, cur); } } public void deleteTopDomainByTenantIdx(CFSecurityAuthorization Authorization, long argTenantId) { CFInternetDomainBaseByTenantIdxKey key = schema.getFactoryDomainBase().newTenantIdxKey(); key.setRequiredTenantId(argTenantId); deleteTopDomainByTenantIdx(Authorization, key); } public void deleteTopDomainByTenantIdx(CFSecurityAuthorization Authorization, CFInternetDomainBaseByTenantIdxKey argKey) { CFInternetTopDomainBuff cur; LinkedList<CFInternetTopDomainBuff> matchSet = new LinkedList<CFInternetTopDomainBuff>(); Iterator<CFInternetTopDomainBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFInternetTopDomainBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteTopDomain(Authorization, cur); } } public CFSecurityCursor openTopDomainCursorAll(CFSecurityAuthorization Authorization) { CFSecurityCursor cursor = new CFAsteriskRamTopDomainCursor(Authorization, schema, dictByPKey.values()); return (cursor); } public CFSecurityCursor openTopDomainCursorByTldIdx(CFSecurityAuthorization Authorization, long TenantId, long TldId) { CFSecurityCursor cursor; CFInternetTopDomainByTldIdxKey key = schema.getFactoryTopDomain().newTldIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredTldId(TldId); if (dictByTldIdx.containsKey(key)) { Map<CFInternetDomainBasePKey, CFInternetTopDomainBuff> subdictTldIdx = dictByTldIdx.get(key); cursor = new CFAsteriskRamTopDomainCursor(Authorization, schema, subdictTldIdx.values()); } else { cursor = new CFAsteriskRamTopDomainCursor(Authorization, schema, new ArrayList<CFInternetTopDomainBuff>()); } return (cursor); } public void closeTopDomainCursor(CFSecurityCursor Cursor) { // Cursor.DataReader.Close(); } public CFInternetTopDomainBuff nextTopDomainCursor(CFSecurityCursor Cursor) { CFAsteriskRamTopDomainCursor cursor = (CFAsteriskRamTopDomainCursor) Cursor; CFInternetTopDomainBuff rec = cursor.getCursor().next(); cursor.setRowIdx(cursor.getRowIdx() + 1); return (rec); } public CFInternetTopDomainBuff prevTopDomainCursor(CFSecurityCursor Cursor) { int targetRowIdx = (Cursor.getRowIdx() > 1) ? Cursor.getRowIdx() - 1 : 1; CFInternetTopDomainBuff rec = null; if (Cursor.getRowIdx() >= targetRowIdx) { Cursor.reset(); } while (Cursor.getRowIdx() < targetRowIdx) { rec = nextTopDomainCursor(Cursor); } return (rec); } public CFInternetTopDomainBuff firstTopDomainCursor(CFSecurityCursor Cursor) { int targetRowIdx = 1; CFInternetTopDomainBuff rec = null; Cursor.reset(); while (Cursor.getRowIdx() < targetRowIdx) { rec = nextTopDomainCursor(Cursor); } return (rec); } public CFInternetTopDomainBuff lastTopDomainCursor(CFSecurityCursor Cursor) { throw CFLib.getDefaultExceptionFactory().newNotImplementedYetException(getClass(), "lastTopDomainCursor"); } public CFInternetTopDomainBuff nthTopDomainCursor(CFSecurityCursor Cursor, int Idx) { int targetRowIdx = Idx; CFInternetTopDomainBuff rec = null; if (Cursor.getRowIdx() >= targetRowIdx) { Cursor.reset(); } while (Cursor.getRowIdx() < targetRowIdx) { rec = nextTopDomainCursor(Cursor); } return (rec); } public void releasePreparedStatements() { } }