Java tutorial
// Description: Java 8 in-memory RAM DbIO implementation for MinorVersion. /* * 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.*; /* * CFAsteriskRamMinorVersionTable in-memory RAM DbIO implementation * for MinorVersion. */ public class CFAsteriskRamMinorVersionTable implements ICFAsteriskMinorVersionTable { private ICFAsteriskSchema schema; private Map<CFInternetDomainBasePKey, CFInternetMinorVersionBuff> dictByPKey = new HashMap<CFInternetDomainBasePKey, CFInternetMinorVersionBuff>(); private Map<CFInternetMinorVersionByMajorIdxKey, Map<CFInternetDomainBasePKey, CFInternetMinorVersionBuff>> dictByMajorIdx = new HashMap<CFInternetMinorVersionByMajorIdxKey, Map<CFInternetDomainBasePKey, CFInternetMinorVersionBuff>>(); private Map<CFInternetMinorVersionByNameIdxKey, CFInternetMinorVersionBuff> dictByNameIdx = new HashMap<CFInternetMinorVersionByNameIdxKey, CFInternetMinorVersionBuff>(); public CFAsteriskRamMinorVersionTable(ICFAsteriskSchema argSchema) { schema = argSchema; } public void createMinorVersion(CFSecurityAuthorization Authorization, CFInternetMinorVersionBuff Buff) { final String S_ProcName = "createMinorVersion"; schema.getTableVersion().createVersion(Authorization, Buff); CFInternetDomainBasePKey pkey = schema.getFactoryDomainBase().newPKey(); pkey.setClassCode(Buff.getClassCode()); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredId(Buff.getRequiredId()); CFInternetMinorVersionByMajorIdxKey keyMajorIdx = schema.getFactoryMinorVersion().newMajorIdxKey(); keyMajorIdx.setRequiredTenantId(Buff.getRequiredTenantId()); keyMajorIdx.setRequiredMajorId(Buff.getRequiredMajorId()); CFInternetMinorVersionByNameIdxKey keyNameIdx = schema.getFactoryMinorVersion().newNameIdxKey(); keyNameIdx.setRequiredTenantId(Buff.getRequiredTenantId()); keyNameIdx.setRequiredMajorId(Buff.getRequiredMajorId()); 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, "MinorVersionNameIdx", keyNameIdx); } // Validate foreign keys { boolean allNull = true; allNull = false; allNull = false; if (!allNull) { if (null == schema.getTableVersion().readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId(), Buff.getRequiredId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), S_ProcName, "Superclass", "SuperClass", "Version", null); } } } { boolean allNull = true; allNull = false; allNull = false; if (!allNull) { if (null == schema.getTableMajorVersion().readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId(), Buff.getRequiredMajorId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), S_ProcName, "Container", "MajorVersion", "MajorVersion", null); } } } // Proceed with adding the new record dictByPKey.put(pkey, Buff); Map<CFInternetDomainBasePKey, CFInternetMinorVersionBuff> subdictMajorIdx; if (dictByMajorIdx.containsKey(keyMajorIdx)) { subdictMajorIdx = dictByMajorIdx.get(keyMajorIdx); } else { subdictMajorIdx = new HashMap<CFInternetDomainBasePKey, CFInternetMinorVersionBuff>(); dictByMajorIdx.put(keyMajorIdx, subdictMajorIdx); } subdictMajorIdx.put(pkey, Buff); dictByNameIdx.put(keyNameIdx, Buff); } public CFInternetMinorVersionBuff readDerived(CFSecurityAuthorization Authorization, CFInternetDomainBasePKey PKey) { final String S_ProcName = "CFAsteriskRamMinorVersion.readDerived"; CFInternetDomainBasePKey key = schema.getFactoryDomainBase().newPKey(); key.setRequiredTenantId(PKey.getRequiredTenantId()); key.setRequiredId(PKey.getRequiredId()); CFInternetMinorVersionBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public CFInternetMinorVersionBuff lockDerived(CFSecurityAuthorization Authorization, CFInternetDomainBasePKey PKey) { final String S_ProcName = "CFAsteriskRamMinorVersion.readDerived"; CFInternetDomainBasePKey key = schema.getFactoryDomainBase().newPKey(); key.setRequiredTenantId(PKey.getRequiredTenantId()); key.setRequiredId(PKey.getRequiredId()); CFInternetMinorVersionBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public CFInternetMinorVersionBuff[] readAllDerived(CFSecurityAuthorization Authorization) { final String S_ProcName = "CFAsteriskRamMinorVersion.readAllDerived"; CFInternetMinorVersionBuff[] retList = new CFInternetMinorVersionBuff[dictByPKey.values().size()]; Iterator<CFInternetMinorVersionBuff> iter = dictByPKey.values().iterator(); int idx = 0; while (iter.hasNext()) { retList[idx++] = iter.next(); } return (retList); } public CFInternetMinorVersionBuff[] 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<CFInternetMinorVersionBuff> filteredList = new ArrayList<CFInternetMinorVersionBuff>(); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && (buff instanceof CFInternetMinorVersionBuff)) { filteredList.add((CFInternetMinorVersionBuff) buff); } } return (filteredList.toArray(new CFInternetMinorVersionBuff[0])); } } public CFInternetMinorVersionBuff[] readDerivedByMajorIdx(CFSecurityAuthorization Authorization, long TenantId, long MajorId) { final String S_ProcName = "CFAsteriskRamMinorVersion.readDerivedByMajorIdx"; CFInternetMinorVersionByMajorIdxKey key = schema.getFactoryMinorVersion().newMajorIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredMajorId(MajorId); CFInternetMinorVersionBuff[] recArray; if (dictByMajorIdx.containsKey(key)) { Map<CFInternetDomainBasePKey, CFInternetMinorVersionBuff> subdictMajorIdx = dictByMajorIdx.get(key); recArray = new CFInternetMinorVersionBuff[subdictMajorIdx.size()]; Iterator<CFInternetMinorVersionBuff> iter = subdictMajorIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { Map<CFInternetDomainBasePKey, CFInternetMinorVersionBuff> subdictMajorIdx = new HashMap<CFInternetDomainBasePKey, CFInternetMinorVersionBuff>(); dictByMajorIdx.put(key, subdictMajorIdx); recArray = new CFInternetMinorVersionBuff[0]; } return (recArray); } public CFInternetMinorVersionBuff readDerivedByNameIdx(CFSecurityAuthorization Authorization, long TenantId, long MajorId, String Name) { final String S_ProcName = "CFAsteriskRamMinorVersion.readDerivedByNameIdx"; CFInternetMinorVersionByNameIdxKey key = schema.getFactoryMinorVersion().newNameIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredMajorId(MajorId); key.setRequiredName(Name); CFInternetMinorVersionBuff buff; if (dictByNameIdx.containsKey(key)) { buff = dictByNameIdx.get(key); } else { buff = null; } return (buff); } public CFInternetMinorVersionBuff readDerivedByIdIdx(CFSecurityAuthorization Authorization, long TenantId, long Id) { final String S_ProcName = "CFAsteriskRamDomainBase.readDerivedByIdIdx() "; CFInternetDomainBasePKey key = schema.getFactoryDomainBase().newPKey(); key.setRequiredTenantId(TenantId); key.setRequiredId(Id); CFInternetMinorVersionBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public CFInternetMinorVersionBuff readBuff(CFSecurityAuthorization Authorization, CFInternetDomainBasePKey PKey) { final String S_ProcName = "CFAsteriskRamMinorVersion.readBuff"; CFInternetMinorVersionBuff buff = readDerived(Authorization, PKey); if ((buff != null) && (!buff.getClassCode().equals("MNVR"))) { buff = null; } return (buff); } public CFInternetMinorVersionBuff lockBuff(CFSecurityAuthorization Authorization, CFInternetDomainBasePKey PKey) { final String S_ProcName = "lockBuff"; CFInternetMinorVersionBuff buff = readDerived(Authorization, PKey); if ((buff != null) && (!buff.getClassCode().equals("MNVR"))) { buff = null; } return (buff); } public CFInternetMinorVersionBuff[] readAllBuff(CFSecurityAuthorization Authorization) { final String S_ProcName = "CFAsteriskRamMinorVersion.readAllBuff"; CFInternetMinorVersionBuff buff; ArrayList<CFInternetMinorVersionBuff> filteredList = new ArrayList<CFInternetMinorVersionBuff>(); CFInternetMinorVersionBuff[] buffList = readAllDerived(Authorization); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("MNVR")) { filteredList.add(buff); } } return (filteredList.toArray(new CFInternetMinorVersionBuff[0])); } public CFInternetMinorVersionBuff readBuffByIdIdx(CFSecurityAuthorization Authorization, long TenantId, long Id) { final String S_ProcName = "CFAsteriskRamDomainBase.readBuffByIdIdx() "; CFInternetMinorVersionBuff buff = readDerivedByIdIdx(Authorization, TenantId, Id); if ((buff != null) && buff.getClassCode().equals("BDOM")) { return ((CFInternetMinorVersionBuff) buff); } else { return (null); } } public CFInternetMinorVersionBuff[] readBuffByTenantIdx(CFSecurityAuthorization Authorization, long TenantId) { final String S_ProcName = "CFAsteriskRamDomainBase.readBuffByTenantIdx() "; CFInternetMinorVersionBuff buff; ArrayList<CFInternetMinorVersionBuff> filteredList = new ArrayList<CFInternetMinorVersionBuff>(); CFInternetMinorVersionBuff[] buffList = readDerivedByTenantIdx(Authorization, TenantId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("BDOM")) { filteredList.add((CFInternetMinorVersionBuff) buff); } } return (filteredList.toArray(new CFInternetMinorVersionBuff[0])); } public CFInternetMinorVersionBuff[] readBuffByMajorIdx(CFSecurityAuthorization Authorization, long TenantId, long MajorId) { final String S_ProcName = "CFAsteriskRamMinorVersion.readBuffByMajorIdx() "; CFInternetMinorVersionBuff buff; ArrayList<CFInternetMinorVersionBuff> filteredList = new ArrayList<CFInternetMinorVersionBuff>(); CFInternetMinorVersionBuff[] buffList = readDerivedByMajorIdx(Authorization, TenantId, MajorId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("MNVR")) { filteredList.add((CFInternetMinorVersionBuff) buff); } } return (filteredList.toArray(new CFInternetMinorVersionBuff[0])); } public CFInternetMinorVersionBuff readBuffByNameIdx(CFSecurityAuthorization Authorization, long TenantId, long MajorId, String Name) { final String S_ProcName = "CFAsteriskRamMinorVersion.readBuffByNameIdx() "; CFInternetMinorVersionBuff buff = readDerivedByNameIdx(Authorization, TenantId, MajorId, Name); if ((buff != null) && buff.getClassCode().equals("MNVR")) { return ((CFInternetMinorVersionBuff) buff); } else { return (null); } } public void updateMinorVersion(CFSecurityAuthorization Authorization, CFInternetMinorVersionBuff Buff) { schema.getTableVersion().updateVersion(Authorization, Buff); CFInternetDomainBasePKey pkey = schema.getFactoryDomainBase().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredId(Buff.getRequiredId()); CFInternetMinorVersionBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateMinorVersion", "Existing record not found", "MinorVersion", pkey); } CFInternetMinorVersionByMajorIdxKey existingKeyMajorIdx = schema.getFactoryMinorVersion().newMajorIdxKey(); existingKeyMajorIdx.setRequiredTenantId(existing.getRequiredTenantId()); existingKeyMajorIdx.setRequiredMajorId(existing.getRequiredMajorId()); CFInternetMinorVersionByMajorIdxKey newKeyMajorIdx = schema.getFactoryMinorVersion().newMajorIdxKey(); newKeyMajorIdx.setRequiredTenantId(Buff.getRequiredTenantId()); newKeyMajorIdx.setRequiredMajorId(Buff.getRequiredMajorId()); CFInternetMinorVersionByNameIdxKey existingKeyNameIdx = schema.getFactoryMinorVersion().newNameIdxKey(); existingKeyNameIdx.setRequiredTenantId(existing.getRequiredTenantId()); existingKeyNameIdx.setRequiredMajorId(existing.getRequiredMajorId()); existingKeyNameIdx.setRequiredName(existing.getRequiredName()); CFInternetMinorVersionByNameIdxKey newKeyNameIdx = schema.getFactoryMinorVersion().newNameIdxKey(); newKeyNameIdx.setRequiredTenantId(Buff.getRequiredTenantId()); newKeyNameIdx.setRequiredMajorId(Buff.getRequiredMajorId()); newKeyNameIdx.setRequiredName(Buff.getRequiredName()); // Check unique indexes if (!existingKeyNameIdx.equals(newKeyNameIdx)) { if (dictByNameIdx.containsKey(newKeyNameIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "updateMinorVersion", "MinorVersionNameIdx", newKeyNameIdx); } } // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema.getTableVersion().readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId(), Buff.getRequiredId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateMinorVersion", "Superclass", "SuperClass", "Version", null); } } } { boolean allNull = true; if (allNull) { if (null == schema.getTableMajorVersion().readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId(), Buff.getRequiredMajorId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateMinorVersion", "Container", "MajorVersion", "MajorVersion", null); } } } // Update is valid Map<CFInternetDomainBasePKey, CFInternetMinorVersionBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); subdict = dictByMajorIdx.get(existingKeyMajorIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByMajorIdx.containsKey(newKeyMajorIdx)) { subdict = dictByMajorIdx.get(newKeyMajorIdx); } else { subdict = new HashMap<CFInternetDomainBasePKey, CFInternetMinorVersionBuff>(); dictByMajorIdx.put(newKeyMajorIdx, subdict); } subdict.put(pkey, Buff); dictByNameIdx.remove(existingKeyNameIdx); dictByNameIdx.put(newKeyNameIdx, Buff); } public void deleteMinorVersion(CFSecurityAuthorization Authorization, CFInternetMinorVersionBuff Buff) { final String S_ProcName = "CFAsteriskRamMinorVersionTable.deleteMinorVersion() "; CFInternetDomainBasePKey pkey = schema.getFactoryDomainBase().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredId(Buff.getRequiredId()); CFInternetMinorVersionBuff existing = dictByPKey.get(pkey); if (existing == null) { return; } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteMinorVersion", pkey); } CFInternetMinorVersionByMajorIdxKey keyMajorIdx = schema.getFactoryMinorVersion().newMajorIdxKey(); keyMajorIdx.setRequiredTenantId(existing.getRequiredTenantId()); keyMajorIdx.setRequiredMajorId(existing.getRequiredMajorId()); CFInternetMinorVersionByNameIdxKey keyNameIdx = schema.getFactoryMinorVersion().newNameIdxKey(); keyNameIdx.setRequiredTenantId(existing.getRequiredTenantId()); keyNameIdx.setRequiredMajorId(existing.getRequiredMajorId()); keyNameIdx.setRequiredName(existing.getRequiredName()); // Validate reverse foreign keys // Delete is valid Map<CFInternetDomainBasePKey, CFInternetMinorVersionBuff> subdict; dictByPKey.remove(pkey); subdict = dictByMajorIdx.get(keyMajorIdx); subdict.remove(pkey); dictByNameIdx.remove(keyNameIdx); schema.getTableVersion().deleteVersion(Authorization, Buff); } public void deleteMinorVersionByMajorIdx(CFSecurityAuthorization Authorization, long argTenantId, long argMajorId) { CFInternetMinorVersionByMajorIdxKey key = schema.getFactoryMinorVersion().newMajorIdxKey(); key.setRequiredTenantId(argTenantId); key.setRequiredMajorId(argMajorId); deleteMinorVersionByMajorIdx(Authorization, key); } public void deleteMinorVersionByMajorIdx(CFSecurityAuthorization Authorization, CFInternetMinorVersionByMajorIdxKey argKey) { CFInternetMinorVersionBuff cur; LinkedList<CFInternetMinorVersionBuff> matchSet = new LinkedList<CFInternetMinorVersionBuff>(); Iterator<CFInternetMinorVersionBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFInternetMinorVersionBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteMinorVersion(Authorization, cur); } } public void deleteMinorVersionByNameIdx(CFSecurityAuthorization Authorization, long argTenantId, long argMajorId, String argName) { CFInternetMinorVersionByNameIdxKey key = schema.getFactoryMinorVersion().newNameIdxKey(); key.setRequiredTenantId(argTenantId); key.setRequiredMajorId(argMajorId); key.setRequiredName(argName); deleteMinorVersionByNameIdx(Authorization, key); } public void deleteMinorVersionByNameIdx(CFSecurityAuthorization Authorization, CFInternetMinorVersionByNameIdxKey argKey) { CFInternetMinorVersionBuff cur; LinkedList<CFInternetMinorVersionBuff> matchSet = new LinkedList<CFInternetMinorVersionBuff>(); Iterator<CFInternetMinorVersionBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFInternetMinorVersionBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteMinorVersion(Authorization, cur); } } public void deleteMinorVersionByIdIdx(CFSecurityAuthorization Authorization, long argTenantId, long argId) { CFInternetDomainBasePKey key = schema.getFactoryDomainBase().newPKey(); key.setRequiredTenantId(argTenantId); key.setRequiredId(argId); deleteMinorVersionByIdIdx(Authorization, key); } public void deleteMinorVersionByIdIdx(CFSecurityAuthorization Authorization, CFInternetDomainBasePKey argKey) { CFInternetMinorVersionBuff cur; LinkedList<CFInternetMinorVersionBuff> matchSet = new LinkedList<CFInternetMinorVersionBuff>(); Iterator<CFInternetMinorVersionBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFInternetMinorVersionBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteMinorVersion(Authorization, cur); } } public void deleteMinorVersionByTenantIdx(CFSecurityAuthorization Authorization, long argTenantId) { CFInternetDomainBaseByTenantIdxKey key = schema.getFactoryDomainBase().newTenantIdxKey(); key.setRequiredTenantId(argTenantId); deleteMinorVersionByTenantIdx(Authorization, key); } public void deleteMinorVersionByTenantIdx(CFSecurityAuthorization Authorization, CFInternetDomainBaseByTenantIdxKey argKey) { CFInternetMinorVersionBuff cur; LinkedList<CFInternetMinorVersionBuff> matchSet = new LinkedList<CFInternetMinorVersionBuff>(); Iterator<CFInternetMinorVersionBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFInternetMinorVersionBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteMinorVersion(Authorization, cur); } } public CFSecurityCursor openMinorVersionCursorAll(CFSecurityAuthorization Authorization) { CFSecurityCursor cursor = new CFAsteriskRamMinorVersionCursor(Authorization, schema, dictByPKey.values()); return (cursor); } public CFSecurityCursor openMinorVersionCursorByMajorIdx(CFSecurityAuthorization Authorization, long TenantId, long MajorId) { CFSecurityCursor cursor; CFInternetMinorVersionByMajorIdxKey key = schema.getFactoryMinorVersion().newMajorIdxKey(); key.setRequiredTenantId(TenantId); key.setRequiredMajorId(MajorId); if (dictByMajorIdx.containsKey(key)) { Map<CFInternetDomainBasePKey, CFInternetMinorVersionBuff> subdictMajorIdx = dictByMajorIdx.get(key); cursor = new CFAsteriskRamMinorVersionCursor(Authorization, schema, subdictMajorIdx.values()); } else { cursor = new CFAsteriskRamMinorVersionCursor(Authorization, schema, new ArrayList<CFInternetMinorVersionBuff>()); } return (cursor); } public void closeMinorVersionCursor(CFSecurityCursor Cursor) { // Cursor.DataReader.Close(); } public CFInternetMinorVersionBuff nextMinorVersionCursor(CFSecurityCursor Cursor) { CFAsteriskRamMinorVersionCursor cursor = (CFAsteriskRamMinorVersionCursor) Cursor; CFInternetMinorVersionBuff rec = cursor.getCursor().next(); cursor.setRowIdx(cursor.getRowIdx() + 1); return (rec); } public CFInternetMinorVersionBuff prevMinorVersionCursor(CFSecurityCursor Cursor) { int targetRowIdx = (Cursor.getRowIdx() > 1) ? Cursor.getRowIdx() - 1 : 1; CFInternetMinorVersionBuff rec = null; if (Cursor.getRowIdx() >= targetRowIdx) { Cursor.reset(); } while (Cursor.getRowIdx() < targetRowIdx) { rec = nextMinorVersionCursor(Cursor); } return (rec); } public CFInternetMinorVersionBuff firstMinorVersionCursor(CFSecurityCursor Cursor) { int targetRowIdx = 1; CFInternetMinorVersionBuff rec = null; Cursor.reset(); while (Cursor.getRowIdx() < targetRowIdx) { rec = nextMinorVersionCursor(Cursor); } return (rec); } public CFInternetMinorVersionBuff lastMinorVersionCursor(CFSecurityCursor Cursor) { throw CFLib.getDefaultExceptionFactory().newNotImplementedYetException(getClass(), "lastMinorVersionCursor"); } public CFInternetMinorVersionBuff nthMinorVersionCursor(CFSecurityCursor Cursor, int Idx) { int targetRowIdx = Idx; CFInternetMinorVersionBuff rec = null; if (Cursor.getRowIdx() >= targetRowIdx) { Cursor.reset(); } while (Cursor.getRowIdx() < targetRowIdx) { rec = nextMinorVersionCursor(Cursor); } return (rec); } public void releasePreparedStatements() { } }