Java tutorial
// Description: Java7 in-memory RAM DbIO implementation for ISOLanguage. /* * CF Asterisk 11 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.cfasterisk.v2_0.CFAstRam; 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.cfasterisk.v2_0.CFAst.*; import net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstRam.*; /* * CFAstRamISOLanguageTable in-memory RAM DbIO implementation * for ISOLanguage. */ public class CFAstRamISOLanguageTable implements ICFAstISOLanguageTable { private CFAstRamSchema schema; private Map<CFAstISOLanguagePKey, CFAstISOLanguageBuff> dictByPKey = new HashMap<CFAstISOLanguagePKey, CFAstISOLanguageBuff>(); private SortedMap<CFAstISOLanguageByBaseIdxKey, SortedMap<CFAstISOLanguagePKey, CFAstISOLanguageBuff>> dictByBaseIdx = new TreeMap<CFAstISOLanguageByBaseIdxKey, SortedMap<CFAstISOLanguagePKey, CFAstISOLanguageBuff>>(); private SortedMap<CFAstISOLanguageByCountryIdxKey, SortedMap<CFAstISOLanguagePKey, CFAstISOLanguageBuff>> dictByCountryIdx = new TreeMap<CFAstISOLanguageByCountryIdxKey, SortedMap<CFAstISOLanguagePKey, CFAstISOLanguageBuff>>(); private SortedMap<CFAstISOLanguageByCodeIdxKey, CFAstISOLanguageBuff> dictByCodeIdx = new TreeMap<CFAstISOLanguageByCodeIdxKey, CFAstISOLanguageBuff>(); public CFAstRamISOLanguageTable(CFAstRamSchema argSchema) { schema = argSchema; } public void createISOLanguage(CFAstAuthorization Authorization, CFAstISOLanguageBuff Buff) { CFAstISOLanguagePKey pkey = schema.getFactoryISOLanguage().newPKey(); pkey.setRequiredId(Buff.getRequiredId()); Buff.setRequiredId(pkey.getRequiredId()); CFAstISOLanguageByBaseIdxKey keyBaseIdx = schema.getFactoryISOLanguage().newBaseIdxKey(); keyBaseIdx.setRequiredBaseLanguageCode(Buff.getRequiredBaseLanguageCode()); CFAstISOLanguageByCountryIdxKey keyCountryIdx = schema.getFactoryISOLanguage().newCountryIdxKey(); keyCountryIdx.setOptionalISOCountryId(Buff.getOptionalISOCountryId()); CFAstISOLanguageByCodeIdxKey keyCodeIdx = schema.getFactoryISOLanguage().newCodeIdxKey(); keyCodeIdx.setRequiredISOCode(Buff.getRequiredISOCode()); // Validate unique indexes if (dictByPKey.containsKey(pkey)) { throw CFLib.getDefaultExceptionFactory().newPrimaryKeyNotNewException(getClass(), "createISOLanguage", pkey); } if (dictByCodeIdx.containsKey(keyCodeIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "createISOLanguage", "ISOLanguageCodeIdx", keyCodeIdx); } // Validate foreign keys // Proceed with adding the new record dictByPKey.put(pkey, Buff); SortedMap<CFAstISOLanguagePKey, CFAstISOLanguageBuff> subdictBaseIdx; if (dictByBaseIdx.containsKey(keyBaseIdx)) { subdictBaseIdx = dictByBaseIdx.get(keyBaseIdx); } else { subdictBaseIdx = new TreeMap<CFAstISOLanguagePKey, CFAstISOLanguageBuff>(); dictByBaseIdx.put(keyBaseIdx, subdictBaseIdx); } subdictBaseIdx.put(pkey, Buff); SortedMap<CFAstISOLanguagePKey, CFAstISOLanguageBuff> subdictCountryIdx; if (dictByCountryIdx.containsKey(keyCountryIdx)) { subdictCountryIdx = dictByCountryIdx.get(keyCountryIdx); } else { subdictCountryIdx = new TreeMap<CFAstISOLanguagePKey, CFAstISOLanguageBuff>(); dictByCountryIdx.put(keyCountryIdx, subdictCountryIdx); } subdictCountryIdx.put(pkey, Buff); dictByCodeIdx.put(keyCodeIdx, Buff); } public CFAstISOLanguageBuff readDerived(CFAstAuthorization Authorization, CFAstISOLanguagePKey PKey) { final String S_ProcName = "CFAstRamISOLanguage.readDerived() "; CFAstISOLanguagePKey key = schema.getFactoryISOLanguage().newPKey(); key.setRequiredId(PKey.getRequiredId()); CFAstISOLanguageBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public CFAstISOLanguageBuff lockDerived(CFAstAuthorization Authorization, CFAstISOLanguagePKey PKey) { final String S_ProcName = "CFAstRamISOLanguage.readDerived() "; CFAstISOLanguagePKey key = schema.getFactoryISOLanguage().newPKey(); key.setRequiredId(PKey.getRequiredId()); CFAstISOLanguageBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public CFAstISOLanguageBuff[] readAllDerived(CFAstAuthorization Authorization) { final String S_ProcName = "CFAstRamISOLanguage.readAllDerived() "; CFAstISOLanguageBuff[] retList = new CFAstISOLanguageBuff[dictByPKey.values().size()]; Iterator<CFAstISOLanguageBuff> iter = dictByPKey.values().iterator(); int idx = 0; while (iter.hasNext()) { retList[idx++] = iter.next(); } return (retList); } public CFAstISOLanguageBuff[] readDerivedByBaseIdx(CFAstAuthorization Authorization, String BaseLanguageCode) { final String S_ProcName = "CFAstRamISOLanguage.readDerivedByBaseIdx() "; CFAstISOLanguageByBaseIdxKey key = schema.getFactoryISOLanguage().newBaseIdxKey(); key.setRequiredBaseLanguageCode(BaseLanguageCode); CFAstISOLanguageBuff[] recArray; if (dictByBaseIdx.containsKey(key)) { SortedMap<CFAstISOLanguagePKey, CFAstISOLanguageBuff> subdictBaseIdx = dictByBaseIdx.get(key); recArray = new CFAstISOLanguageBuff[subdictBaseIdx.size()]; Iterator<CFAstISOLanguageBuff> iter = subdictBaseIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new CFAstISOLanguageBuff[0]; } return (recArray); } public CFAstISOLanguageBuff[] readDerivedByCountryIdx(CFAstAuthorization Authorization, Short ISOCountryId) { final String S_ProcName = "CFAstRamISOLanguage.readDerivedByCountryIdx() "; CFAstISOLanguageByCountryIdxKey key = schema.getFactoryISOLanguage().newCountryIdxKey(); key.setOptionalISOCountryId(ISOCountryId); CFAstISOLanguageBuff[] recArray; if (dictByCountryIdx.containsKey(key)) { SortedMap<CFAstISOLanguagePKey, CFAstISOLanguageBuff> subdictCountryIdx = dictByCountryIdx.get(key); recArray = new CFAstISOLanguageBuff[subdictCountryIdx.size()]; Iterator<CFAstISOLanguageBuff> iter = subdictCountryIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new CFAstISOLanguageBuff[0]; } return (recArray); } public CFAstISOLanguageBuff readDerivedByCodeIdx(CFAstAuthorization Authorization, String ISOCode) { final String S_ProcName = "CFAstRamISOLanguage.readDerivedByCodeIdx() "; CFAstISOLanguageByCodeIdxKey key = schema.getFactoryISOLanguage().newCodeIdxKey(); key.setRequiredISOCode(ISOCode); CFAstISOLanguageBuff buff; if (dictByCodeIdx.containsKey(key)) { buff = dictByCodeIdx.get(key); } else { buff = null; } return (buff); } public CFAstISOLanguageBuff readDerivedByIdIdx(CFAstAuthorization Authorization, short Id) { final String S_ProcName = "CFAstRamISOLanguage.readDerivedByIdIdx() "; CFAstISOLanguagePKey key = schema.getFactoryISOLanguage().newPKey(); key.setRequiredId(Id); CFAstISOLanguageBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public CFAstISOLanguageBuff readBuff(CFAstAuthorization Authorization, CFAstISOLanguagePKey PKey) { final String S_ProcName = "CFAstRamISOLanguage.readBuff() "; CFAstISOLanguageBuff buff = readDerived(Authorization, PKey); if ((buff != null) && (!buff.getClassCode().equals("ISLN"))) { buff = null; } return (buff); } public CFAstISOLanguageBuff lockBuff(CFAstAuthorization Authorization, CFAstISOLanguagePKey PKey) { final String S_ProcName = "CFAstRamISOLanguage.readBuff() "; CFAstISOLanguageBuff buff = readDerived(Authorization, PKey); if ((buff != null) && (!buff.getClassCode().equals("ISLN"))) { buff = null; } return (buff); } public CFAstISOLanguageBuff[] readAllBuff(CFAstAuthorization Authorization) { final String S_ProcName = "CFAstRamISOLanguage.readAllBuff() "; CFAstISOLanguageBuff buff; ArrayList<CFAstISOLanguageBuff> filteredList = new ArrayList<CFAstISOLanguageBuff>(); CFAstISOLanguageBuff[] buffList = readAllDerived(Authorization); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("ISLN")) { filteredList.add(buff); } } return (filteredList.toArray(new CFAstISOLanguageBuff[0])); } public CFAstISOLanguageBuff readBuffByIdIdx(CFAstAuthorization Authorization, short Id) { final String S_ProcName = "CFAstRamISOLanguage.readBuffByIdIdx() "; CFAstISOLanguageBuff buff = readDerivedByIdIdx(Authorization, Id); if ((buff != null) && buff.getClassCode().equals("ISLN")) { return ((CFAstISOLanguageBuff) buff); } else { return (null); } } public CFAstISOLanguageBuff[] readBuffByBaseIdx(CFAstAuthorization Authorization, String BaseLanguageCode) { final String S_ProcName = "CFAstRamISOLanguage.readBuffByBaseIdx() "; CFAstISOLanguageBuff buff; ArrayList<CFAstISOLanguageBuff> filteredList = new ArrayList<CFAstISOLanguageBuff>(); CFAstISOLanguageBuff[] buffList = readDerivedByBaseIdx(Authorization, BaseLanguageCode); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("ISLN")) { filteredList.add((CFAstISOLanguageBuff) buff); } } return (filteredList.toArray(new CFAstISOLanguageBuff[0])); } public CFAstISOLanguageBuff[] readBuffByCountryIdx(CFAstAuthorization Authorization, Short ISOCountryId) { final String S_ProcName = "CFAstRamISOLanguage.readBuffByCountryIdx() "; CFAstISOLanguageBuff buff; ArrayList<CFAstISOLanguageBuff> filteredList = new ArrayList<CFAstISOLanguageBuff>(); CFAstISOLanguageBuff[] buffList = readDerivedByCountryIdx(Authorization, ISOCountryId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("ISLN")) { filteredList.add((CFAstISOLanguageBuff) buff); } } return (filteredList.toArray(new CFAstISOLanguageBuff[0])); } public CFAstISOLanguageBuff readBuffByCodeIdx(CFAstAuthorization Authorization, String ISOCode) { final String S_ProcName = "CFAstRamISOLanguage.readBuffByCodeIdx() "; CFAstISOLanguageBuff buff = readDerivedByCodeIdx(Authorization, ISOCode); if ((buff != null) && buff.getClassCode().equals("ISLN")) { return ((CFAstISOLanguageBuff) buff); } else { return (null); } } public void updateISOLanguage(CFAstAuthorization Authorization, CFAstISOLanguageBuff Buff) { CFAstISOLanguagePKey pkey = schema.getFactoryISOLanguage().newPKey(); pkey.setRequiredId(Buff.getRequiredId()); CFAstISOLanguageBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateISOLanguage", "Existing record not found", "ISOLanguage", pkey); } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateISOLanguage", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); CFAstISOLanguageByBaseIdxKey existingKeyBaseIdx = schema.getFactoryISOLanguage().newBaseIdxKey(); existingKeyBaseIdx.setRequiredBaseLanguageCode(existing.getRequiredBaseLanguageCode()); CFAstISOLanguageByBaseIdxKey newKeyBaseIdx = schema.getFactoryISOLanguage().newBaseIdxKey(); newKeyBaseIdx.setRequiredBaseLanguageCode(Buff.getRequiredBaseLanguageCode()); CFAstISOLanguageByCountryIdxKey existingKeyCountryIdx = schema.getFactoryISOLanguage().newCountryIdxKey(); existingKeyCountryIdx.setOptionalISOCountryId(existing.getOptionalISOCountryId()); CFAstISOLanguageByCountryIdxKey newKeyCountryIdx = schema.getFactoryISOLanguage().newCountryIdxKey(); newKeyCountryIdx.setOptionalISOCountryId(Buff.getOptionalISOCountryId()); CFAstISOLanguageByCodeIdxKey existingKeyCodeIdx = schema.getFactoryISOLanguage().newCodeIdxKey(); existingKeyCodeIdx.setRequiredISOCode(existing.getRequiredISOCode()); CFAstISOLanguageByCodeIdxKey newKeyCodeIdx = schema.getFactoryISOLanguage().newCodeIdxKey(); newKeyCodeIdx.setRequiredISOCode(Buff.getRequiredISOCode()); // Check unique indexes if (!existingKeyCodeIdx.equals(newKeyCodeIdx)) { if (dictByCodeIdx.containsKey(newKeyCodeIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "updateISOLanguage", "ISOLanguageCodeIdx", newKeyCodeIdx); } } // Validate foreign keys // Update is valid SortedMap<CFAstISOLanguagePKey, CFAstISOLanguageBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); subdict = dictByBaseIdx.get(existingKeyBaseIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByBaseIdx.containsKey(newKeyBaseIdx)) { subdict = dictByBaseIdx.get(newKeyBaseIdx); } else { subdict = new TreeMap<CFAstISOLanguagePKey, CFAstISOLanguageBuff>(); dictByBaseIdx.put(newKeyBaseIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByCountryIdx.get(existingKeyCountryIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByCountryIdx.containsKey(newKeyCountryIdx)) { subdict = dictByCountryIdx.get(newKeyCountryIdx); } else { subdict = new TreeMap<CFAstISOLanguagePKey, CFAstISOLanguageBuff>(); dictByCountryIdx.put(newKeyCountryIdx, subdict); } subdict.put(pkey, Buff); dictByCodeIdx.remove(existingKeyCodeIdx); dictByCodeIdx.put(newKeyCodeIdx, Buff); } public void deleteISOLanguage(CFAstAuthorization Authorization, CFAstISOLanguageBuff Buff) { final String S_ProcName = "CFAstRamISOLanguageTable.deleteISOLanguage() "; CFAstISOLanguagePKey pkey = schema.getFactoryISOLanguage().newPKey(); pkey.setRequiredId(Buff.getRequiredId()); CFAstISOLanguageBuff existing = dictByPKey.get(pkey); if (existing == null) { return; } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteISOLanguage", pkey); } CFAstISOLanguageByBaseIdxKey keyBaseIdx = schema.getFactoryISOLanguage().newBaseIdxKey(); keyBaseIdx.setRequiredBaseLanguageCode(existing.getRequiredBaseLanguageCode()); CFAstISOLanguageByCountryIdxKey keyCountryIdx = schema.getFactoryISOLanguage().newCountryIdxKey(); keyCountryIdx.setOptionalISOCountryId(existing.getOptionalISOCountryId()); CFAstISOLanguageByCodeIdxKey keyCodeIdx = schema.getFactoryISOLanguage().newCodeIdxKey(); keyCodeIdx.setRequiredISOCode(existing.getRequiredISOCode()); // Validate reverse foreign keys // Delete is valid schema.getTableISOCountryLanguage().deleteISOCountryLanguageByLanguageIdx(Authorization, Buff.getRequiredId()); SortedMap<CFAstISOLanguagePKey, CFAstISOLanguageBuff> subdict; dictByPKey.remove(pkey); subdict = dictByBaseIdx.get(keyBaseIdx); subdict.remove(pkey); subdict = dictByCountryIdx.get(keyCountryIdx); subdict.remove(pkey); dictByCodeIdx.remove(keyCodeIdx); } public void deleteISOLanguageByIdIdx(CFAstAuthorization Authorization, short argId) { CFAstISOLanguagePKey key = schema.getFactoryISOLanguage().newPKey(); key.setRequiredId(argId); deleteISOLanguageByIdIdx(Authorization, key); } public void deleteISOLanguageByIdIdx(CFAstAuthorization Authorization, CFAstISOLanguagePKey argKey) { CFAstISOLanguageBuff cur; LinkedList<CFAstISOLanguageBuff> matchSet = new LinkedList<CFAstISOLanguageBuff>(); Iterator<CFAstISOLanguageBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAstISOLanguageBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteISOLanguage(Authorization, cur); } } public void deleteISOLanguageByBaseIdx(CFAstAuthorization Authorization, String argBaseLanguageCode) { CFAstISOLanguageByBaseIdxKey key = schema.getFactoryISOLanguage().newBaseIdxKey(); key.setRequiredBaseLanguageCode(argBaseLanguageCode); deleteISOLanguageByBaseIdx(Authorization, key); } public void deleteISOLanguageByBaseIdx(CFAstAuthorization Authorization, CFAstISOLanguageByBaseIdxKey argKey) { CFAstISOLanguageBuff cur; LinkedList<CFAstISOLanguageBuff> matchSet = new LinkedList<CFAstISOLanguageBuff>(); Iterator<CFAstISOLanguageBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAstISOLanguageBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteISOLanguage(Authorization, cur); } } public void deleteISOLanguageByCountryIdx(CFAstAuthorization Authorization, Short argISOCountryId) { CFAstISOLanguageByCountryIdxKey key = schema.getFactoryISOLanguage().newCountryIdxKey(); key.setOptionalISOCountryId(argISOCountryId); deleteISOLanguageByCountryIdx(Authorization, key); } public void deleteISOLanguageByCountryIdx(CFAstAuthorization Authorization, CFAstISOLanguageByCountryIdxKey argKey) { CFAstISOLanguageBuff cur; LinkedList<CFAstISOLanguageBuff> matchSet = new LinkedList<CFAstISOLanguageBuff>(); Iterator<CFAstISOLanguageBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAstISOLanguageBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteISOLanguage(Authorization, cur); } } public void deleteISOLanguageByCodeIdx(CFAstAuthorization Authorization, String argISOCode) { CFAstISOLanguageByCodeIdxKey key = schema.getFactoryISOLanguage().newCodeIdxKey(); key.setRequiredISOCode(argISOCode); deleteISOLanguageByCodeIdx(Authorization, key); } public void deleteISOLanguageByCodeIdx(CFAstAuthorization Authorization, CFAstISOLanguageByCodeIdxKey argKey) { CFAstISOLanguageBuff cur; LinkedList<CFAstISOLanguageBuff> matchSet = new LinkedList<CFAstISOLanguageBuff>(); Iterator<CFAstISOLanguageBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAstISOLanguageBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteISOLanguage(Authorization, cur); } } public CFAstCursor openISOLanguageCursorAll(CFAstAuthorization Authorization) { CFAstCursor cursor = new CFAstRamISOLanguageCursor(Authorization, schema, dictByPKey.values()); return (cursor); } public CFAstCursor openISOLanguageCursorByBaseIdx(CFAstAuthorization Authorization, String BaseLanguageCode) { CFAstCursor cursor; CFAstISOLanguageByBaseIdxKey key = schema.getFactoryISOLanguage().newBaseIdxKey(); key.setRequiredBaseLanguageCode(BaseLanguageCode); if (dictByBaseIdx.containsKey(key)) { SortedMap<CFAstISOLanguagePKey, CFAstISOLanguageBuff> subdictBaseIdx = dictByBaseIdx.get(key); cursor = new CFAstRamISOLanguageCursor(Authorization, schema, subdictBaseIdx.values()); } else { cursor = new CFAstRamISOLanguageCursor(Authorization, schema, new ArrayList<CFAstISOLanguageBuff>()); } return (cursor); } public CFAstCursor openISOLanguageCursorByCountryIdx(CFAstAuthorization Authorization, Short ISOCountryId) { CFAstCursor cursor; CFAstISOLanguageByCountryIdxKey key = schema.getFactoryISOLanguage().newCountryIdxKey(); key.setOptionalISOCountryId(ISOCountryId); if (dictByCountryIdx.containsKey(key)) { SortedMap<CFAstISOLanguagePKey, CFAstISOLanguageBuff> subdictCountryIdx = dictByCountryIdx.get(key); cursor = new CFAstRamISOLanguageCursor(Authorization, schema, subdictCountryIdx.values()); } else { cursor = new CFAstRamISOLanguageCursor(Authorization, schema, new ArrayList<CFAstISOLanguageBuff>()); } return (cursor); } public void closeISOLanguageCursor(CFAstCursor Cursor) { // Cursor.DataReader.Close(); } public CFAstISOLanguageBuff nextISOLanguageCursor(CFAstCursor Cursor) { CFAstRamISOLanguageCursor cursor = (CFAstRamISOLanguageCursor) Cursor; CFAstISOLanguageBuff rec = cursor.getCursor().next(); cursor.setRowIdx(cursor.getRowIdx() + 1); return (rec); } public CFAstISOLanguageBuff prevISOLanguageCursor(CFAstCursor Cursor) { int targetRowIdx = (Cursor.getRowIdx() > 1) ? Cursor.getRowIdx() - 1 : 1; CFAstISOLanguageBuff rec = null; if (Cursor.getRowIdx() >= targetRowIdx) { Cursor.reset(); } while (Cursor.getRowIdx() < targetRowIdx) { rec = nextISOLanguageCursor(Cursor); } return (rec); } public CFAstISOLanguageBuff firstISOLanguageCursor(CFAstCursor Cursor) { int targetRowIdx = 1; CFAstISOLanguageBuff rec = null; Cursor.reset(); while (Cursor.getRowIdx() < targetRowIdx) { rec = nextISOLanguageCursor(Cursor); } return (rec); } public CFAstISOLanguageBuff lastISOLanguageCursor(CFAstCursor Cursor) { throw CFLib.getDefaultExceptionFactory().newNotImplementedYetException(getClass(), "lastISOLanguageCursor"); } public CFAstISOLanguageBuff nthISOLanguageCursor(CFAstCursor Cursor, int Idx) { int targetRowIdx = Idx; CFAstISOLanguageBuff rec = null; if (Cursor.getRowIdx() >= targetRowIdx) { Cursor.reset(); } while (Cursor.getRowIdx() < targetRowIdx) { rec = nextISOLanguageCursor(Cursor); } return (rec); } public void releasePreparedStatements() { } }