Java tutorial
// Description: Java7 in-memory RAM DbIO implementation for ISOLanguage. /* * MSS Code Factory Accounting Business Application Model * * Copyright (c) 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.cfacc.v2_0.CFAccRam; 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.cfacc.v2_0.CFAcc.*; import net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam.*; /* * CFAccRamISOLanguageTable in-memory RAM DbIO implementation * for ISOLanguage. */ public class CFAccRamISOLanguageTable implements ICFAccISOLanguageTable { private CFAccRamSchema schema; private Map<CFAccISOLanguagePKey, CFAccISOLanguageBuff> dictByPKey = new HashMap<CFAccISOLanguagePKey, CFAccISOLanguageBuff>(); private SortedMap<CFAccISOLanguageByBaseIdxKey, SortedMap<CFAccISOLanguagePKey, CFAccISOLanguageBuff>> dictByBaseIdx = new TreeMap<CFAccISOLanguageByBaseIdxKey, SortedMap<CFAccISOLanguagePKey, CFAccISOLanguageBuff>>(); private SortedMap<CFAccISOLanguageByCountryIdxKey, SortedMap<CFAccISOLanguagePKey, CFAccISOLanguageBuff>> dictByCountryIdx = new TreeMap<CFAccISOLanguageByCountryIdxKey, SortedMap<CFAccISOLanguagePKey, CFAccISOLanguageBuff>>(); private SortedMap<CFAccISOLanguageByCodeIdxKey, CFAccISOLanguageBuff> dictByCodeIdx = new TreeMap<CFAccISOLanguageByCodeIdxKey, CFAccISOLanguageBuff>(); public CFAccRamISOLanguageTable(CFAccRamSchema argSchema) { schema = argSchema; } public void createISOLanguage(CFAccAuthorization Authorization, CFAccISOLanguageBuff Buff) { CFAccISOLanguagePKey pkey = schema.getFactoryISOLanguage().newPKey(); pkey.setRequiredId(Buff.getRequiredId()); Buff.setRequiredId(pkey.getRequiredId()); CFAccISOLanguageByBaseIdxKey keyBaseIdx = schema.getFactoryISOLanguage().newBaseIdxKey(); keyBaseIdx.setRequiredBaseLanguageCode(Buff.getRequiredBaseLanguageCode()); CFAccISOLanguageByCountryIdxKey keyCountryIdx = schema.getFactoryISOLanguage().newCountryIdxKey(); keyCountryIdx.setOptionalISOCountryId(Buff.getOptionalISOCountryId()); CFAccISOLanguageByCodeIdxKey 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<CFAccISOLanguagePKey, CFAccISOLanguageBuff> subdictBaseIdx; if (dictByBaseIdx.containsKey(keyBaseIdx)) { subdictBaseIdx = dictByBaseIdx.get(keyBaseIdx); } else { subdictBaseIdx = new TreeMap<CFAccISOLanguagePKey, CFAccISOLanguageBuff>(); dictByBaseIdx.put(keyBaseIdx, subdictBaseIdx); } subdictBaseIdx.put(pkey, Buff); SortedMap<CFAccISOLanguagePKey, CFAccISOLanguageBuff> subdictCountryIdx; if (dictByCountryIdx.containsKey(keyCountryIdx)) { subdictCountryIdx = dictByCountryIdx.get(keyCountryIdx); } else { subdictCountryIdx = new TreeMap<CFAccISOLanguagePKey, CFAccISOLanguageBuff>(); dictByCountryIdx.put(keyCountryIdx, subdictCountryIdx); } subdictCountryIdx.put(pkey, Buff); dictByCodeIdx.put(keyCodeIdx, Buff); } public CFAccISOLanguageBuff readDerived(CFAccAuthorization Authorization, CFAccISOLanguagePKey PKey) { final String S_ProcName = "CFAccRamISOLanguage.readDerived() "; CFAccISOLanguagePKey key = schema.getFactoryISOLanguage().newPKey(); key.setRequiredId(PKey.getRequiredId()); CFAccISOLanguageBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public CFAccISOLanguageBuff lockDerived(CFAccAuthorization Authorization, CFAccISOLanguagePKey PKey) { final String S_ProcName = "CFAccRamISOLanguage.readDerived() "; CFAccISOLanguagePKey key = schema.getFactoryISOLanguage().newPKey(); key.setRequiredId(PKey.getRequiredId()); CFAccISOLanguageBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public CFAccISOLanguageBuff[] readAllDerived(CFAccAuthorization Authorization) { final String S_ProcName = "CFAccRamISOLanguage.readAllDerived() "; CFAccISOLanguageBuff[] retList = new CFAccISOLanguageBuff[dictByPKey.values().size()]; Iterator<CFAccISOLanguageBuff> iter = dictByPKey.values().iterator(); int idx = 0; while (iter.hasNext()) { retList[idx++] = iter.next(); } return (retList); } public CFAccISOLanguageBuff[] readDerivedByBaseIdx(CFAccAuthorization Authorization, String BaseLanguageCode) { final String S_ProcName = "CFAccRamISOLanguage.readDerivedByBaseIdx() "; CFAccISOLanguageByBaseIdxKey key = schema.getFactoryISOLanguage().newBaseIdxKey(); key.setRequiredBaseLanguageCode(BaseLanguageCode); CFAccISOLanguageBuff[] recArray; if (dictByBaseIdx.containsKey(key)) { SortedMap<CFAccISOLanguagePKey, CFAccISOLanguageBuff> subdictBaseIdx = dictByBaseIdx.get(key); recArray = new CFAccISOLanguageBuff[subdictBaseIdx.size()]; Iterator<CFAccISOLanguageBuff> iter = subdictBaseIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new CFAccISOLanguageBuff[0]; } return (recArray); } public CFAccISOLanguageBuff[] readDerivedByCountryIdx(CFAccAuthorization Authorization, Short ISOCountryId) { final String S_ProcName = "CFAccRamISOLanguage.readDerivedByCountryIdx() "; CFAccISOLanguageByCountryIdxKey key = schema.getFactoryISOLanguage().newCountryIdxKey(); key.setOptionalISOCountryId(ISOCountryId); CFAccISOLanguageBuff[] recArray; if (dictByCountryIdx.containsKey(key)) { SortedMap<CFAccISOLanguagePKey, CFAccISOLanguageBuff> subdictCountryIdx = dictByCountryIdx.get(key); recArray = new CFAccISOLanguageBuff[subdictCountryIdx.size()]; Iterator<CFAccISOLanguageBuff> iter = subdictCountryIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new CFAccISOLanguageBuff[0]; } return (recArray); } public CFAccISOLanguageBuff readDerivedByCodeIdx(CFAccAuthorization Authorization, String ISOCode) { final String S_ProcName = "CFAccRamISOLanguage.readDerivedByCodeIdx() "; CFAccISOLanguageByCodeIdxKey key = schema.getFactoryISOLanguage().newCodeIdxKey(); key.setRequiredISOCode(ISOCode); CFAccISOLanguageBuff buff; if (dictByCodeIdx.containsKey(key)) { buff = dictByCodeIdx.get(key); } else { buff = null; } return (buff); } public CFAccISOLanguageBuff readDerivedByIdIdx(CFAccAuthorization Authorization, short Id) { final String S_ProcName = "CFAccRamISOLanguage.readDerivedByIdIdx() "; CFAccISOLanguagePKey key = schema.getFactoryISOLanguage().newPKey(); key.setRequiredId(Id); CFAccISOLanguageBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public CFAccISOLanguageBuff readBuff(CFAccAuthorization Authorization, CFAccISOLanguagePKey PKey) { final String S_ProcName = "CFAccRamISOLanguage.readBuff() "; CFAccISOLanguageBuff buff = readDerived(Authorization, PKey); if ((buff != null) && (!buff.getClassCode().equals("ISLN"))) { buff = null; } return (buff); } public CFAccISOLanguageBuff lockBuff(CFAccAuthorization Authorization, CFAccISOLanguagePKey PKey) { final String S_ProcName = "CFAccRamISOLanguage.readBuff() "; CFAccISOLanguageBuff buff = readDerived(Authorization, PKey); if ((buff != null) && (!buff.getClassCode().equals("ISLN"))) { buff = null; } return (buff); } public CFAccISOLanguageBuff[] readAllBuff(CFAccAuthorization Authorization) { final String S_ProcName = "CFAccRamISOLanguage.readAllBuff() "; CFAccISOLanguageBuff buff; ArrayList<CFAccISOLanguageBuff> filteredList = new ArrayList<CFAccISOLanguageBuff>(); CFAccISOLanguageBuff[] 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 CFAccISOLanguageBuff[0])); } public CFAccISOLanguageBuff readBuffByIdIdx(CFAccAuthorization Authorization, short Id) { final String S_ProcName = "CFAccRamISOLanguage.readBuffByIdIdx() "; CFAccISOLanguageBuff buff = readDerivedByIdIdx(Authorization, Id); if ((buff != null) && buff.getClassCode().equals("ISLN")) { return ((CFAccISOLanguageBuff) buff); } else { return (null); } } public CFAccISOLanguageBuff[] readBuffByBaseIdx(CFAccAuthorization Authorization, String BaseLanguageCode) { final String S_ProcName = "CFAccRamISOLanguage.readBuffByBaseIdx() "; CFAccISOLanguageBuff buff; ArrayList<CFAccISOLanguageBuff> filteredList = new ArrayList<CFAccISOLanguageBuff>(); CFAccISOLanguageBuff[] buffList = readDerivedByBaseIdx(Authorization, BaseLanguageCode); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("ISLN")) { filteredList.add((CFAccISOLanguageBuff) buff); } } return (filteredList.toArray(new CFAccISOLanguageBuff[0])); } public CFAccISOLanguageBuff[] readBuffByCountryIdx(CFAccAuthorization Authorization, Short ISOCountryId) { final String S_ProcName = "CFAccRamISOLanguage.readBuffByCountryIdx() "; CFAccISOLanguageBuff buff; ArrayList<CFAccISOLanguageBuff> filteredList = new ArrayList<CFAccISOLanguageBuff>(); CFAccISOLanguageBuff[] buffList = readDerivedByCountryIdx(Authorization, ISOCountryId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("ISLN")) { filteredList.add((CFAccISOLanguageBuff) buff); } } return (filteredList.toArray(new CFAccISOLanguageBuff[0])); } public CFAccISOLanguageBuff readBuffByCodeIdx(CFAccAuthorization Authorization, String ISOCode) { final String S_ProcName = "CFAccRamISOLanguage.readBuffByCodeIdx() "; CFAccISOLanguageBuff buff = readDerivedByCodeIdx(Authorization, ISOCode); if ((buff != null) && buff.getClassCode().equals("ISLN")) { return ((CFAccISOLanguageBuff) buff); } else { return (null); } } public void updateISOLanguage(CFAccAuthorization Authorization, CFAccISOLanguageBuff Buff) { CFAccISOLanguagePKey pkey = schema.getFactoryISOLanguage().newPKey(); pkey.setRequiredId(Buff.getRequiredId()); CFAccISOLanguageBuff 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); CFAccISOLanguageByBaseIdxKey existingKeyBaseIdx = schema.getFactoryISOLanguage().newBaseIdxKey(); existingKeyBaseIdx.setRequiredBaseLanguageCode(existing.getRequiredBaseLanguageCode()); CFAccISOLanguageByBaseIdxKey newKeyBaseIdx = schema.getFactoryISOLanguage().newBaseIdxKey(); newKeyBaseIdx.setRequiredBaseLanguageCode(Buff.getRequiredBaseLanguageCode()); CFAccISOLanguageByCountryIdxKey existingKeyCountryIdx = schema.getFactoryISOLanguage().newCountryIdxKey(); existingKeyCountryIdx.setOptionalISOCountryId(existing.getOptionalISOCountryId()); CFAccISOLanguageByCountryIdxKey newKeyCountryIdx = schema.getFactoryISOLanguage().newCountryIdxKey(); newKeyCountryIdx.setOptionalISOCountryId(Buff.getOptionalISOCountryId()); CFAccISOLanguageByCodeIdxKey existingKeyCodeIdx = schema.getFactoryISOLanguage().newCodeIdxKey(); existingKeyCodeIdx.setRequiredISOCode(existing.getRequiredISOCode()); CFAccISOLanguageByCodeIdxKey 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<CFAccISOLanguagePKey, CFAccISOLanguageBuff> 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<CFAccISOLanguagePKey, CFAccISOLanguageBuff>(); 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<CFAccISOLanguagePKey, CFAccISOLanguageBuff>(); dictByCountryIdx.put(newKeyCountryIdx, subdict); } subdict.put(pkey, Buff); dictByCodeIdx.remove(existingKeyCodeIdx); dictByCodeIdx.put(newKeyCodeIdx, Buff); } public void deleteISOLanguage(CFAccAuthorization Authorization, CFAccISOLanguageBuff Buff) { final String S_ProcName = "CFAccRamISOLanguageTable.deleteISOLanguage() "; CFAccISOLanguagePKey pkey = schema.getFactoryISOLanguage().newPKey(); pkey.setRequiredId(Buff.getRequiredId()); CFAccISOLanguageBuff existing = dictByPKey.get(pkey); if (existing == null) { return; } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteISOLanguage", pkey); } CFAccISOLanguageByBaseIdxKey keyBaseIdx = schema.getFactoryISOLanguage().newBaseIdxKey(); keyBaseIdx.setRequiredBaseLanguageCode(existing.getRequiredBaseLanguageCode()); CFAccISOLanguageByCountryIdxKey keyCountryIdx = schema.getFactoryISOLanguage().newCountryIdxKey(); keyCountryIdx.setOptionalISOCountryId(existing.getOptionalISOCountryId()); CFAccISOLanguageByCodeIdxKey keyCodeIdx = schema.getFactoryISOLanguage().newCodeIdxKey(); keyCodeIdx.setRequiredISOCode(existing.getRequiredISOCode()); // Validate reverse foreign keys // Delete is valid schema.getTableISOCountryLanguage().deleteISOCountryLanguageByLanguageIdx(Authorization, Buff.getRequiredId()); SortedMap<CFAccISOLanguagePKey, CFAccISOLanguageBuff> subdict; dictByPKey.remove(pkey); subdict = dictByBaseIdx.get(keyBaseIdx); subdict.remove(pkey); subdict = dictByCountryIdx.get(keyCountryIdx); subdict.remove(pkey); dictByCodeIdx.remove(keyCodeIdx); } public void deleteISOLanguageByIdIdx(CFAccAuthorization Authorization, short argId) { CFAccISOLanguagePKey key = schema.getFactoryISOLanguage().newPKey(); key.setRequiredId(argId); deleteISOLanguageByIdIdx(Authorization, key); } public void deleteISOLanguageByIdIdx(CFAccAuthorization Authorization, CFAccISOLanguagePKey argKey) { CFAccISOLanguageBuff cur; LinkedList<CFAccISOLanguageBuff> matchSet = new LinkedList<CFAccISOLanguageBuff>(); Iterator<CFAccISOLanguageBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAccISOLanguageBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteISOLanguage(Authorization, cur); } } public void deleteISOLanguageByBaseIdx(CFAccAuthorization Authorization, String argBaseLanguageCode) { CFAccISOLanguageByBaseIdxKey key = schema.getFactoryISOLanguage().newBaseIdxKey(); key.setRequiredBaseLanguageCode(argBaseLanguageCode); deleteISOLanguageByBaseIdx(Authorization, key); } public void deleteISOLanguageByBaseIdx(CFAccAuthorization Authorization, CFAccISOLanguageByBaseIdxKey argKey) { CFAccISOLanguageBuff cur; LinkedList<CFAccISOLanguageBuff> matchSet = new LinkedList<CFAccISOLanguageBuff>(); Iterator<CFAccISOLanguageBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAccISOLanguageBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteISOLanguage(Authorization, cur); } } public void deleteISOLanguageByCountryIdx(CFAccAuthorization Authorization, Short argISOCountryId) { CFAccISOLanguageByCountryIdxKey key = schema.getFactoryISOLanguage().newCountryIdxKey(); key.setOptionalISOCountryId(argISOCountryId); deleteISOLanguageByCountryIdx(Authorization, key); } public void deleteISOLanguageByCountryIdx(CFAccAuthorization Authorization, CFAccISOLanguageByCountryIdxKey argKey) { CFAccISOLanguageBuff cur; LinkedList<CFAccISOLanguageBuff> matchSet = new LinkedList<CFAccISOLanguageBuff>(); Iterator<CFAccISOLanguageBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAccISOLanguageBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteISOLanguage(Authorization, cur); } } public void deleteISOLanguageByCodeIdx(CFAccAuthorization Authorization, String argISOCode) { CFAccISOLanguageByCodeIdxKey key = schema.getFactoryISOLanguage().newCodeIdxKey(); key.setRequiredISOCode(argISOCode); deleteISOLanguageByCodeIdx(Authorization, key); } public void deleteISOLanguageByCodeIdx(CFAccAuthorization Authorization, CFAccISOLanguageByCodeIdxKey argKey) { CFAccISOLanguageBuff cur; LinkedList<CFAccISOLanguageBuff> matchSet = new LinkedList<CFAccISOLanguageBuff>(); Iterator<CFAccISOLanguageBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAccISOLanguageBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteISOLanguage(Authorization, cur); } } public CFAccCursor openISOLanguageCursorAll(CFAccAuthorization Authorization) { CFAccCursor cursor = new CFAccRamISOLanguageCursor(Authorization, schema, dictByPKey.values()); return (cursor); } public CFAccCursor openISOLanguageCursorByBaseIdx(CFAccAuthorization Authorization, String BaseLanguageCode) { CFAccCursor cursor; CFAccISOLanguageByBaseIdxKey key = schema.getFactoryISOLanguage().newBaseIdxKey(); key.setRequiredBaseLanguageCode(BaseLanguageCode); if (dictByBaseIdx.containsKey(key)) { SortedMap<CFAccISOLanguagePKey, CFAccISOLanguageBuff> subdictBaseIdx = dictByBaseIdx.get(key); cursor = new CFAccRamISOLanguageCursor(Authorization, schema, subdictBaseIdx.values()); } else { cursor = new CFAccRamISOLanguageCursor(Authorization, schema, new ArrayList<CFAccISOLanguageBuff>()); } return (cursor); } public CFAccCursor openISOLanguageCursorByCountryIdx(CFAccAuthorization Authorization, Short ISOCountryId) { CFAccCursor cursor; CFAccISOLanguageByCountryIdxKey key = schema.getFactoryISOLanguage().newCountryIdxKey(); key.setOptionalISOCountryId(ISOCountryId); if (dictByCountryIdx.containsKey(key)) { SortedMap<CFAccISOLanguagePKey, CFAccISOLanguageBuff> subdictCountryIdx = dictByCountryIdx.get(key); cursor = new CFAccRamISOLanguageCursor(Authorization, schema, subdictCountryIdx.values()); } else { cursor = new CFAccRamISOLanguageCursor(Authorization, schema, new ArrayList<CFAccISOLanguageBuff>()); } return (cursor); } public void closeISOLanguageCursor(CFAccCursor Cursor) { // Cursor.DataReader.Close(); } public CFAccISOLanguageBuff nextISOLanguageCursor(CFAccCursor Cursor) { CFAccRamISOLanguageCursor cursor = (CFAccRamISOLanguageCursor) Cursor; CFAccISOLanguageBuff rec = cursor.getCursor().next(); cursor.setRowIdx(cursor.getRowIdx() + 1); return (rec); } public CFAccISOLanguageBuff prevISOLanguageCursor(CFAccCursor Cursor) { int targetRowIdx = (Cursor.getRowIdx() > 1) ? Cursor.getRowIdx() - 1 : 1; CFAccISOLanguageBuff rec = null; if (Cursor.getRowIdx() >= targetRowIdx) { Cursor.reset(); } while (Cursor.getRowIdx() < targetRowIdx) { rec = nextISOLanguageCursor(Cursor); } return (rec); } public CFAccISOLanguageBuff firstISOLanguageCursor(CFAccCursor Cursor) { int targetRowIdx = 1; CFAccISOLanguageBuff rec = null; Cursor.reset(); while (Cursor.getRowIdx() < targetRowIdx) { rec = nextISOLanguageCursor(Cursor); } return (rec); } public CFAccISOLanguageBuff lastISOLanguageCursor(CFAccCursor Cursor) { throw CFLib.getDefaultExceptionFactory().newNotImplementedYetException(getClass(), "lastISOLanguageCursor"); } public CFAccISOLanguageBuff nthISOLanguageCursor(CFAccCursor Cursor, int Idx) { int targetRowIdx = Idx; CFAccISOLanguageBuff rec = null; if (Cursor.getRowIdx() >= targetRowIdx) { Cursor.reset(); } while (Cursor.getRowIdx() < targetRowIdx) { rec = nextISOLanguageCursor(Cursor); } return (rec); } public void releasePreparedStatements() { } }