Java tutorial
// Description: Java 8 in-memory RAM DbIO implementation for TopProject. /* * 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.*; /* * CFAsteriskRamTopProjectTable in-memory RAM DbIO implementation * for TopProject. */ public class CFAsteriskRamTopProjectTable implements ICFAsteriskTopProjectTable { private ICFAsteriskSchema schema; private Map<CFInternetDomainBasePKey, CFInternetTopProjectBuff> dictByPKey = new HashMap<CFInternetDomainBasePKey, CFInternetTopProjectBuff>(); private Map<CFInternetTopProjectByDomainIdxKey, Map<CFInternetDomainBasePKey, CFInternetTopProjectBuff>> dictByDomainIdx = new HashMap<CFInternetTopProjectByDomainIdxKey, Map<CFInternetDomainBasePKey, CFInternetTopProjectBuff>>(); private Map<CFInternetTopProjectByNameIdxKey, CFInternetTopProjectBuff> dictByNameIdx = new HashMap<CFInternetTopProjectByNameIdxKey, CFInternetTopProjectBuff>(); public CFAsteriskRamTopProjectTable(ICFAsteriskSchema argSchema) { schema = argSchema; } public void createTopProject(CFSecurityAuthorization Authorization, CFInternetTopProjectBuff Buff) { final String S_ProcName = "createTopProject"; schema.getTableRealProject().createRealProject(Authorization, Buff); CFInternetDomainBasePKey pkey = schema.getFactoryDomainBase().newPKey(); pkey.setClassCode(Buff.getClassCode()); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredId(Buff.getRequiredId()); CFInternetTopProjectByDomainIdxKey keyDomainIdx = schema.getFactoryTopProject().newDomainIdxKey(); keyDomainIdx.setRequiredTenantId(Buff.getRequiredTenantId()); keyDomainIdx.setRequiredDomainId(Buff.getRequiredDomainId()); CFInternetTopProjectByNameIdxKey keyNameIdx = schema.getFactoryTopProject().newNameIdxKey(); keyNameIdx.setRequiredTenantId(Buff.getRequiredTenantId()); keyNameIdx.setRequiredDomainId(Buff.getRequiredDomainId()); 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, "TopProjectNameIdx", keyNameIdx); } // Validate foreign keys { boolean allNull = true; allNull = false; allNull = false; if (!allNull) { if (null == schema.getTableRealProject().readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId(), Buff.getRequiredId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), S_ProcName, "Superclass", "SuperClass", "RealProject", null); } } } { boolean allNull = true; allNull = false; allNull = false; if (!allNull) { if (null == schema.getTableDomainBase().readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId(), Buff.getRequiredDomainId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), S_ProcName, "Container", "Domain", "DomainBase", null); } } } // Proceed with adding the new record dictByPKey.put(pkey, Buff); Map<CFInternetDomainBasePKey, CFInternetTopProjectBuff> subdictDomainIdx; if (dictByDomainIdx.containsKey(keyDomainIdx)) { subdictDomainIdx = dictByDomainIdx.get(keyDomainIdx); } else { subdictDomainIdx = new HashMap<CFInternetDomainBasePKey, CFInternetTopProjectBuff>(); dictByDomainIdx.put(keyDomainIdx, subdictDomainIdx); } subdictDomainIdx.put(pkey, Buff); dictByNameIdx.put(keyNameIdx, Buff); } public CFInternetTopProjectBuff readDerived(CFSecurityAuthorization Authorization, CFInternetDomainBasePKey PKey) { final String S_ProcName = "CFAsteriskRamTopProject.readDerived"; CFInternetDomainBasePKey key = schema.getFactoryDomainBase().newPKey(); key.setRequiredTenantId(PKey.getRequiredTenantId()); key.setRequiredId(PKey.getRequiredId()); CFInternetTopProjectBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public CFInternetTopProjectBuff lockDerived(CFSecurityAuthorization Authorization, CFInternetDomainBasePKey PKey) { final String S_ProcName = "CFAsteriskRamTopProject.readDerived"; CFInternetDomainBasePKey key = schema.getFactoryDomainBase().newPKey(); key.setRequiredTenantId(PKey.getRequiredTenantId()); key.setRequiredId(PKey.getRequiredId()); CFInternetTopProjectBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public CFInternetTopProjectBuff[] readAllDerived(CFSecurityAuthorization Authorization) { final String S_ProcName = "CFAsteriskRamTopProject.readAllDerived"; CFInternetTopProjectBuff[] retList = new CFInternetTopProjectBuff[dictByPKey.values().size()]; Iterator<CFInternetTopProjectBuff> iter = dictByPKey.values().iterator(); int idx = 0; while (iter.hasNext()) { retList[idx++] = iter.next(); } return (retList); } public CFInternetTopProjectBuff[] 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<CFInternetTopProjectBuff> filteredList = new ArrayList<CFInternetTopProjectBuff>(); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && (buff instanceof CFInternetTopProjectBuff)) { filteredList.add((CFInternetTopProjectBuff) buff); } } return (filteredList.toArray(new CFInternetTopProjectBuff[0])); } } public CFInternetTopProjectBuff[] readDerivedByDomainIdx(CFSecurityAuthorization Authorization, long TenantId, long DomainId) { final String S_ProcName = "CFAsteriskRamTopProject.readDerivedByDomainIdx"; CFInternetTopProjectByDomainIdxKey key = schema.getFactoryTopProject().newDomainIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredDomainId(DomainId); CFInternetTopProjectBuff[] recArray; if (dictByDomainIdx.containsKey(key)) { Map<CFInternetDomainBasePKey, CFInternetTopProjectBuff> subdictDomainIdx = dictByDomainIdx.get(key); recArray = new CFInternetTopProjectBuff[subdictDomainIdx.size()]; Iterator<CFInternetTopProjectBuff> iter = subdictDomainIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { Map<CFInternetDomainBasePKey, CFInternetTopProjectBuff> subdictDomainIdx = new HashMap<CFInternetDomainBasePKey, CFInternetTopProjectBuff>(); dictByDomainIdx.put(key, subdictDomainIdx); recArray = new CFInternetTopProjectBuff[0]; } return (recArray); } public CFInternetTopProjectBuff readDerivedByNameIdx(CFSecurityAuthorization Authorization, long TenantId, long DomainId, String Name) { final String S_ProcName = "CFAsteriskRamTopProject.readDerivedByNameIdx"; CFInternetTopProjectByNameIdxKey key = schema.getFactoryTopProject().newNameIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredDomainId(DomainId); key.setRequiredName(Name); CFInternetTopProjectBuff buff; if (dictByNameIdx.containsKey(key)) { buff = dictByNameIdx.get(key); } else { buff = null; } return (buff); } public CFInternetTopProjectBuff readDerivedByIdIdx(CFSecurityAuthorization Authorization, long TenantId, long Id) { final String S_ProcName = "CFAsteriskRamDomainBase.readDerivedByIdIdx() "; CFInternetDomainBasePKey key = schema.getFactoryDomainBase().newPKey(); key.setRequiredTenantId(TenantId); key.setRequiredId(Id); CFInternetTopProjectBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public CFInternetTopProjectBuff readBuff(CFSecurityAuthorization Authorization, CFInternetDomainBasePKey PKey) { final String S_ProcName = "CFAsteriskRamTopProject.readBuff"; CFInternetTopProjectBuff buff = readDerived(Authorization, PKey); if ((buff != null) && (!buff.getClassCode().equals("TPRJ"))) { buff = null; } return (buff); } public CFInternetTopProjectBuff lockBuff(CFSecurityAuthorization Authorization, CFInternetDomainBasePKey PKey) { final String S_ProcName = "lockBuff"; CFInternetTopProjectBuff buff = readDerived(Authorization, PKey); if ((buff != null) && (!buff.getClassCode().equals("TPRJ"))) { buff = null; } return (buff); } public CFInternetTopProjectBuff[] readAllBuff(CFSecurityAuthorization Authorization) { final String S_ProcName = "CFAsteriskRamTopProject.readAllBuff"; CFInternetTopProjectBuff buff; ArrayList<CFInternetTopProjectBuff> filteredList = new ArrayList<CFInternetTopProjectBuff>(); CFInternetTopProjectBuff[] buffList = readAllDerived(Authorization); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("TPRJ")) { filteredList.add(buff); } } return (filteredList.toArray(new CFInternetTopProjectBuff[0])); } public CFInternetTopProjectBuff readBuffByIdIdx(CFSecurityAuthorization Authorization, long TenantId, long Id) { final String S_ProcName = "CFAsteriskRamDomainBase.readBuffByIdIdx() "; CFInternetTopProjectBuff buff = readDerivedByIdIdx(Authorization, TenantId, Id); if ((buff != null) && buff.getClassCode().equals("BDOM")) { return ((CFInternetTopProjectBuff) buff); } else { return (null); } } public CFInternetTopProjectBuff[] readBuffByTenantIdx(CFSecurityAuthorization Authorization, long TenantId) { final String S_ProcName = "CFAsteriskRamDomainBase.readBuffByTenantIdx() "; CFInternetTopProjectBuff buff; ArrayList<CFInternetTopProjectBuff> filteredList = new ArrayList<CFInternetTopProjectBuff>(); CFInternetTopProjectBuff[] buffList = readDerivedByTenantIdx(Authorization, TenantId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("BDOM")) { filteredList.add((CFInternetTopProjectBuff) buff); } } return (filteredList.toArray(new CFInternetTopProjectBuff[0])); } public CFInternetTopProjectBuff[] readBuffByDomainIdx(CFSecurityAuthorization Authorization, long TenantId, long DomainId) { final String S_ProcName = "CFAsteriskRamTopProject.readBuffByDomainIdx() "; CFInternetTopProjectBuff buff; ArrayList<CFInternetTopProjectBuff> filteredList = new ArrayList<CFInternetTopProjectBuff>(); CFInternetTopProjectBuff[] buffList = readDerivedByDomainIdx(Authorization, TenantId, DomainId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("TPRJ")) { filteredList.add((CFInternetTopProjectBuff) buff); } } return (filteredList.toArray(new CFInternetTopProjectBuff[0])); } public CFInternetTopProjectBuff readBuffByNameIdx(CFSecurityAuthorization Authorization, long TenantId, long DomainId, String Name) { final String S_ProcName = "CFAsteriskRamTopProject.readBuffByNameIdx() "; CFInternetTopProjectBuff buff = readDerivedByNameIdx(Authorization, TenantId, DomainId, Name); if ((buff != null) && buff.getClassCode().equals("TPRJ")) { return ((CFInternetTopProjectBuff) buff); } else { return (null); } } public void updateTopProject(CFSecurityAuthorization Authorization, CFInternetTopProjectBuff Buff) { schema.getTableRealProject().updateRealProject(Authorization, Buff); CFInternetDomainBasePKey pkey = schema.getFactoryDomainBase().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredId(Buff.getRequiredId()); CFInternetTopProjectBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateTopProject", "Existing record not found", "TopProject", pkey); } CFInternetTopProjectByDomainIdxKey existingKeyDomainIdx = schema.getFactoryTopProject().newDomainIdxKey(); existingKeyDomainIdx.setRequiredTenantId(existing.getRequiredTenantId()); existingKeyDomainIdx.setRequiredDomainId(existing.getRequiredDomainId()); CFInternetTopProjectByDomainIdxKey newKeyDomainIdx = schema.getFactoryTopProject().newDomainIdxKey(); newKeyDomainIdx.setRequiredTenantId(Buff.getRequiredTenantId()); newKeyDomainIdx.setRequiredDomainId(Buff.getRequiredDomainId()); CFInternetTopProjectByNameIdxKey existingKeyNameIdx = schema.getFactoryTopProject().newNameIdxKey(); existingKeyNameIdx.setRequiredTenantId(existing.getRequiredTenantId()); existingKeyNameIdx.setRequiredDomainId(existing.getRequiredDomainId()); existingKeyNameIdx.setRequiredName(existing.getRequiredName()); CFInternetTopProjectByNameIdxKey newKeyNameIdx = schema.getFactoryTopProject().newNameIdxKey(); newKeyNameIdx.setRequiredTenantId(Buff.getRequiredTenantId()); newKeyNameIdx.setRequiredDomainId(Buff.getRequiredDomainId()); newKeyNameIdx.setRequiredName(Buff.getRequiredName()); // Check unique indexes if (!existingKeyNameIdx.equals(newKeyNameIdx)) { if (dictByNameIdx.containsKey(newKeyNameIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "updateTopProject", "TopProjectNameIdx", newKeyNameIdx); } } // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema.getTableRealProject().readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId(), Buff.getRequiredId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateTopProject", "Superclass", "SuperClass", "RealProject", null); } } } { boolean allNull = true; if (allNull) { if (null == schema.getTableDomainBase().readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId(), Buff.getRequiredDomainId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateTopProject", "Container", "Domain", "DomainBase", null); } } } // Update is valid Map<CFInternetDomainBasePKey, CFInternetTopProjectBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); subdict = dictByDomainIdx.get(existingKeyDomainIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByDomainIdx.containsKey(newKeyDomainIdx)) { subdict = dictByDomainIdx.get(newKeyDomainIdx); } else { subdict = new HashMap<CFInternetDomainBasePKey, CFInternetTopProjectBuff>(); dictByDomainIdx.put(newKeyDomainIdx, subdict); } subdict.put(pkey, Buff); dictByNameIdx.remove(existingKeyNameIdx); dictByNameIdx.put(newKeyNameIdx, Buff); } public void deleteTopProject(CFSecurityAuthorization Authorization, CFInternetTopProjectBuff Buff) { final String S_ProcName = "CFAsteriskRamTopProjectTable.deleteTopProject() "; CFInternetDomainBasePKey pkey = schema.getFactoryDomainBase().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredId(Buff.getRequiredId()); CFInternetTopProjectBuff existing = dictByPKey.get(pkey); if (existing == null) { return; } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteTopProject", pkey); } CFInternetTopProjectByDomainIdxKey keyDomainIdx = schema.getFactoryTopProject().newDomainIdxKey(); keyDomainIdx.setRequiredTenantId(existing.getRequiredTenantId()); keyDomainIdx.setRequiredDomainId(existing.getRequiredDomainId()); CFInternetTopProjectByNameIdxKey keyNameIdx = schema.getFactoryTopProject().newNameIdxKey(); keyNameIdx.setRequiredTenantId(existing.getRequiredTenantId()); keyNameIdx.setRequiredDomainId(existing.getRequiredDomainId()); keyNameIdx.setRequiredName(existing.getRequiredName()); // Validate reverse foreign keys // Delete is valid schema.getTableSubProject().deleteSubProjectByParentIdx(Authorization, Buff.getRequiredTenantId(), Buff.getRequiredId()); schema.getTableMajorVersion().deleteMajorVersionByPPrjIdx(Authorization, Buff.getRequiredTenantId(), Buff.getRequiredId()); Map<CFInternetDomainBasePKey, CFInternetTopProjectBuff> subdict; dictByPKey.remove(pkey); subdict = dictByDomainIdx.get(keyDomainIdx); subdict.remove(pkey); dictByNameIdx.remove(keyNameIdx); schema.getTableRealProject().deleteRealProject(Authorization, Buff); } public void deleteTopProjectByDomainIdx(CFSecurityAuthorization Authorization, long argTenantId, long argDomainId) { CFInternetTopProjectByDomainIdxKey key = schema.getFactoryTopProject().newDomainIdxKey(); key.setRequiredTenantId(argTenantId); key.setRequiredDomainId(argDomainId); deleteTopProjectByDomainIdx(Authorization, key); } public void deleteTopProjectByDomainIdx(CFSecurityAuthorization Authorization, CFInternetTopProjectByDomainIdxKey argKey) { CFInternetTopProjectBuff cur; LinkedList<CFInternetTopProjectBuff> matchSet = new LinkedList<CFInternetTopProjectBuff>(); Iterator<CFInternetTopProjectBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFInternetTopProjectBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteTopProject(Authorization, cur); } } public void deleteTopProjectByNameIdx(CFSecurityAuthorization Authorization, long argTenantId, long argDomainId, String argName) { CFInternetTopProjectByNameIdxKey key = schema.getFactoryTopProject().newNameIdxKey(); key.setRequiredTenantId(argTenantId); key.setRequiredDomainId(argDomainId); key.setRequiredName(argName); deleteTopProjectByNameIdx(Authorization, key); } public void deleteTopProjectByNameIdx(CFSecurityAuthorization Authorization, CFInternetTopProjectByNameIdxKey argKey) { CFInternetTopProjectBuff cur; LinkedList<CFInternetTopProjectBuff> matchSet = new LinkedList<CFInternetTopProjectBuff>(); Iterator<CFInternetTopProjectBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFInternetTopProjectBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteTopProject(Authorization, cur); } } public void deleteTopProjectByIdIdx(CFSecurityAuthorization Authorization, long argTenantId, long argId) { CFInternetDomainBasePKey key = schema.getFactoryDomainBase().newPKey(); key.setRequiredTenantId(argTenantId); key.setRequiredId(argId); deleteTopProjectByIdIdx(Authorization, key); } public void deleteTopProjectByIdIdx(CFSecurityAuthorization Authorization, CFInternetDomainBasePKey argKey) { CFInternetTopProjectBuff cur; LinkedList<CFInternetTopProjectBuff> matchSet = new LinkedList<CFInternetTopProjectBuff>(); Iterator<CFInternetTopProjectBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFInternetTopProjectBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteTopProject(Authorization, cur); } } public void deleteTopProjectByTenantIdx(CFSecurityAuthorization Authorization, long argTenantId) { CFInternetDomainBaseByTenantIdxKey key = schema.getFactoryDomainBase().newTenantIdxKey(); key.setRequiredTenantId(argTenantId); deleteTopProjectByTenantIdx(Authorization, key); } public void deleteTopProjectByTenantIdx(CFSecurityAuthorization Authorization, CFInternetDomainBaseByTenantIdxKey argKey) { CFInternetTopProjectBuff cur; LinkedList<CFInternetTopProjectBuff> matchSet = new LinkedList<CFInternetTopProjectBuff>(); Iterator<CFInternetTopProjectBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFInternetTopProjectBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteTopProject(Authorization, cur); } } public CFSecurityCursor openTopProjectCursorAll(CFSecurityAuthorization Authorization) { CFSecurityCursor cursor = new CFAsteriskRamTopProjectCursor(Authorization, schema, dictByPKey.values()); return (cursor); } public CFSecurityCursor openTopProjectCursorByDomainIdx(CFSecurityAuthorization Authorization, long TenantId, long DomainId) { CFSecurityCursor cursor; CFInternetTopProjectByDomainIdxKey key = schema.getFactoryTopProject().newDomainIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredDomainId(DomainId); if (dictByDomainIdx.containsKey(key)) { Map<CFInternetDomainBasePKey, CFInternetTopProjectBuff> subdictDomainIdx = dictByDomainIdx.get(key); cursor = new CFAsteriskRamTopProjectCursor(Authorization, schema, subdictDomainIdx.values()); } else { cursor = new CFAsteriskRamTopProjectCursor(Authorization, schema, new ArrayList<CFInternetTopProjectBuff>()); } return (cursor); } public void closeTopProjectCursor(CFSecurityCursor Cursor) { // Cursor.DataReader.Close(); } public CFInternetTopProjectBuff nextTopProjectCursor(CFSecurityCursor Cursor) { CFAsteriskRamTopProjectCursor cursor = (CFAsteriskRamTopProjectCursor) Cursor; CFInternetTopProjectBuff rec = cursor.getCursor().next(); cursor.setRowIdx(cursor.getRowIdx() + 1); return (rec); } public CFInternetTopProjectBuff prevTopProjectCursor(CFSecurityCursor Cursor) { int targetRowIdx = (Cursor.getRowIdx() > 1) ? Cursor.getRowIdx() - 1 : 1; CFInternetTopProjectBuff rec = null; if (Cursor.getRowIdx() >= targetRowIdx) { Cursor.reset(); } while (Cursor.getRowIdx() < targetRowIdx) { rec = nextTopProjectCursor(Cursor); } return (rec); } public CFInternetTopProjectBuff firstTopProjectCursor(CFSecurityCursor Cursor) { int targetRowIdx = 1; CFInternetTopProjectBuff rec = null; Cursor.reset(); while (Cursor.getRowIdx() < targetRowIdx) { rec = nextTopProjectCursor(Cursor); } return (rec); } public CFInternetTopProjectBuff lastTopProjectCursor(CFSecurityCursor Cursor) { throw CFLib.getDefaultExceptionFactory().newNotImplementedYetException(getClass(), "lastTopProjectCursor"); } public CFInternetTopProjectBuff nthTopProjectCursor(CFSecurityCursor Cursor, int Idx) { int targetRowIdx = Idx; CFInternetTopProjectBuff rec = null; if (Cursor.getRowIdx() >= targetRowIdx) { Cursor.reset(); } while (Cursor.getRowIdx() < targetRowIdx) { rec = nextTopProjectCursor(Cursor); } return (rec); } public void releasePreparedStatements() { } }