Java tutorial
// Description: Java7 in-memory RAM DbIO implementation for ISOTimezone. /* * 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.*; /* * CFAstRamISOTimezoneTable in-memory RAM DbIO implementation * for ISOTimezone. */ public class CFAstRamISOTimezoneTable implements ICFAstISOTimezoneTable { private CFAstRamSchema schema; private Map<CFAstISOTimezonePKey, CFAstISOTimezoneBuff> dictByPKey = new HashMap<CFAstISOTimezonePKey, CFAstISOTimezoneBuff>(); private SortedMap<CFAstISOTimezoneByOffsetIdxKey, SortedMap<CFAstISOTimezonePKey, CFAstISOTimezoneBuff>> dictByOffsetIdx = new TreeMap<CFAstISOTimezoneByOffsetIdxKey, SortedMap<CFAstISOTimezonePKey, CFAstISOTimezoneBuff>>(); private SortedMap<CFAstISOTimezoneByUTZNameIdxKey, CFAstISOTimezoneBuff> dictByUTZNameIdx = new TreeMap<CFAstISOTimezoneByUTZNameIdxKey, CFAstISOTimezoneBuff>(); private SortedMap<CFAstISOTimezoneByIso8601IdxKey, SortedMap<CFAstISOTimezonePKey, CFAstISOTimezoneBuff>> dictByIso8601Idx = new TreeMap<CFAstISOTimezoneByIso8601IdxKey, SortedMap<CFAstISOTimezonePKey, CFAstISOTimezoneBuff>>(); public CFAstRamISOTimezoneTable(CFAstRamSchema argSchema) { schema = argSchema; } public void createISOTimezone(CFAstAuthorization Authorization, CFAstISOTimezoneBuff Buff) { CFAstISOTimezonePKey pkey = schema.getFactoryISOTimezone().newPKey(); pkey.setRequiredISOTimezoneId(Buff.getRequiredISOTimezoneId()); Buff.setRequiredISOTimezoneId(pkey.getRequiredISOTimezoneId()); CFAstISOTimezoneByOffsetIdxKey keyOffsetIdx = schema.getFactoryISOTimezone().newOffsetIdxKey(); keyOffsetIdx.setRequiredTZHourOffset(Buff.getRequiredTZHourOffset()); keyOffsetIdx.setRequiredTZMinOffset(Buff.getRequiredTZMinOffset()); CFAstISOTimezoneByUTZNameIdxKey keyUTZNameIdx = schema.getFactoryISOTimezone().newUTZNameIdxKey(); keyUTZNameIdx.setRequiredTZName(Buff.getRequiredTZName()); CFAstISOTimezoneByIso8601IdxKey keyIso8601Idx = schema.getFactoryISOTimezone().newIso8601IdxKey(); keyIso8601Idx.setRequiredIso8601(Buff.getRequiredIso8601()); // Validate unique indexes if (dictByPKey.containsKey(pkey)) { throw CFLib.getDefaultExceptionFactory().newPrimaryKeyNotNewException(getClass(), "createISOTimezone", pkey); } if (dictByUTZNameIdx.containsKey(keyUTZNameIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "createISOTimezone", "ISOTimezoneUTZNameIdx", keyUTZNameIdx); } // Validate foreign keys // Proceed with adding the new record dictByPKey.put(pkey, Buff); SortedMap<CFAstISOTimezonePKey, CFAstISOTimezoneBuff> subdictOffsetIdx; if (dictByOffsetIdx.containsKey(keyOffsetIdx)) { subdictOffsetIdx = dictByOffsetIdx.get(keyOffsetIdx); } else { subdictOffsetIdx = new TreeMap<CFAstISOTimezonePKey, CFAstISOTimezoneBuff>(); dictByOffsetIdx.put(keyOffsetIdx, subdictOffsetIdx); } subdictOffsetIdx.put(pkey, Buff); dictByUTZNameIdx.put(keyUTZNameIdx, Buff); SortedMap<CFAstISOTimezonePKey, CFAstISOTimezoneBuff> subdictIso8601Idx; if (dictByIso8601Idx.containsKey(keyIso8601Idx)) { subdictIso8601Idx = dictByIso8601Idx.get(keyIso8601Idx); } else { subdictIso8601Idx = new TreeMap<CFAstISOTimezonePKey, CFAstISOTimezoneBuff>(); dictByIso8601Idx.put(keyIso8601Idx, subdictIso8601Idx); } subdictIso8601Idx.put(pkey, Buff); } public CFAstISOTimezoneBuff readDerived(CFAstAuthorization Authorization, CFAstISOTimezonePKey PKey) { final String S_ProcName = "CFAstRamISOTimezone.readDerived() "; CFAstISOTimezonePKey key = schema.getFactoryISOTimezone().newPKey(); key.setRequiredISOTimezoneId(PKey.getRequiredISOTimezoneId()); CFAstISOTimezoneBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public CFAstISOTimezoneBuff lockDerived(CFAstAuthorization Authorization, CFAstISOTimezonePKey PKey) { final String S_ProcName = "CFAstRamISOTimezone.readDerived() "; CFAstISOTimezonePKey key = schema.getFactoryISOTimezone().newPKey(); key.setRequiredISOTimezoneId(PKey.getRequiredISOTimezoneId()); CFAstISOTimezoneBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public CFAstISOTimezoneBuff[] readAllDerived(CFAstAuthorization Authorization) { final String S_ProcName = "CFAstRamISOTimezone.readAllDerived() "; CFAstISOTimezoneBuff[] retList = new CFAstISOTimezoneBuff[dictByPKey.values().size()]; Iterator<CFAstISOTimezoneBuff> iter = dictByPKey.values().iterator(); int idx = 0; while (iter.hasNext()) { retList[idx++] = iter.next(); } return (retList); } public CFAstISOTimezoneBuff[] readDerivedByOffsetIdx(CFAstAuthorization Authorization, short TZHourOffset, short TZMinOffset) { final String S_ProcName = "CFAstRamISOTimezone.readDerivedByOffsetIdx() "; CFAstISOTimezoneByOffsetIdxKey key = schema.getFactoryISOTimezone().newOffsetIdxKey(); key.setRequiredTZHourOffset(TZHourOffset); key.setRequiredTZMinOffset(TZMinOffset); CFAstISOTimezoneBuff[] recArray; if (dictByOffsetIdx.containsKey(key)) { SortedMap<CFAstISOTimezonePKey, CFAstISOTimezoneBuff> subdictOffsetIdx = dictByOffsetIdx.get(key); recArray = new CFAstISOTimezoneBuff[subdictOffsetIdx.size()]; Iterator<CFAstISOTimezoneBuff> iter = subdictOffsetIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new CFAstISOTimezoneBuff[0]; } return (recArray); } public CFAstISOTimezoneBuff readDerivedByUTZNameIdx(CFAstAuthorization Authorization, String TZName) { final String S_ProcName = "CFAstRamISOTimezone.readDerivedByUTZNameIdx() "; CFAstISOTimezoneByUTZNameIdxKey key = schema.getFactoryISOTimezone().newUTZNameIdxKey(); key.setRequiredTZName(TZName); CFAstISOTimezoneBuff buff; if (dictByUTZNameIdx.containsKey(key)) { buff = dictByUTZNameIdx.get(key); } else { buff = null; } return (buff); } public CFAstISOTimezoneBuff[] readDerivedByIso8601Idx(CFAstAuthorization Authorization, String Iso8601) { final String S_ProcName = "CFAstRamISOTimezone.readDerivedByIso8601Idx() "; CFAstISOTimezoneByIso8601IdxKey key = schema.getFactoryISOTimezone().newIso8601IdxKey(); key.setRequiredIso8601(Iso8601); CFAstISOTimezoneBuff[] recArray; if (dictByIso8601Idx.containsKey(key)) { SortedMap<CFAstISOTimezonePKey, CFAstISOTimezoneBuff> subdictIso8601Idx = dictByIso8601Idx.get(key); recArray = new CFAstISOTimezoneBuff[subdictIso8601Idx.size()]; Iterator<CFAstISOTimezoneBuff> iter = subdictIso8601Idx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new CFAstISOTimezoneBuff[0]; } return (recArray); } public CFAstISOTimezoneBuff readDerivedByIdIdx(CFAstAuthorization Authorization, short ISOTimezoneId) { final String S_ProcName = "CFAstRamISOTimezone.readDerivedByIdIdx() "; CFAstISOTimezonePKey key = schema.getFactoryISOTimezone().newPKey(); key.setRequiredISOTimezoneId(ISOTimezoneId); CFAstISOTimezoneBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public CFAstISOTimezoneBuff readBuff(CFAstAuthorization Authorization, CFAstISOTimezonePKey PKey) { final String S_ProcName = "CFAstRamISOTimezone.readBuff() "; CFAstISOTimezoneBuff buff = readDerived(Authorization, PKey); if ((buff != null) && (!buff.getClassCode().equals("ITZN"))) { buff = null; } return (buff); } public CFAstISOTimezoneBuff lockBuff(CFAstAuthorization Authorization, CFAstISOTimezonePKey PKey) { final String S_ProcName = "CFAstRamISOTimezone.readBuff() "; CFAstISOTimezoneBuff buff = readDerived(Authorization, PKey); if ((buff != null) && (!buff.getClassCode().equals("ITZN"))) { buff = null; } return (buff); } public CFAstISOTimezoneBuff[] readAllBuff(CFAstAuthorization Authorization) { final String S_ProcName = "CFAstRamISOTimezone.readAllBuff() "; CFAstISOTimezoneBuff buff; ArrayList<CFAstISOTimezoneBuff> filteredList = new ArrayList<CFAstISOTimezoneBuff>(); CFAstISOTimezoneBuff[] buffList = readAllDerived(Authorization); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("ITZN")) { filteredList.add(buff); } } return (filteredList.toArray(new CFAstISOTimezoneBuff[0])); } public CFAstISOTimezoneBuff readBuffByIdIdx(CFAstAuthorization Authorization, short ISOTimezoneId) { final String S_ProcName = "CFAstRamISOTimezone.readBuffByIdIdx() "; CFAstISOTimezoneBuff buff = readDerivedByIdIdx(Authorization, ISOTimezoneId); if ((buff != null) && buff.getClassCode().equals("ITZN")) { return ((CFAstISOTimezoneBuff) buff); } else { return (null); } } public CFAstISOTimezoneBuff[] readBuffByOffsetIdx(CFAstAuthorization Authorization, short TZHourOffset, short TZMinOffset) { final String S_ProcName = "CFAstRamISOTimezone.readBuffByOffsetIdx() "; CFAstISOTimezoneBuff buff; ArrayList<CFAstISOTimezoneBuff> filteredList = new ArrayList<CFAstISOTimezoneBuff>(); CFAstISOTimezoneBuff[] buffList = readDerivedByOffsetIdx(Authorization, TZHourOffset, TZMinOffset); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("ITZN")) { filteredList.add((CFAstISOTimezoneBuff) buff); } } return (filteredList.toArray(new CFAstISOTimezoneBuff[0])); } public CFAstISOTimezoneBuff readBuffByUTZNameIdx(CFAstAuthorization Authorization, String TZName) { final String S_ProcName = "CFAstRamISOTimezone.readBuffByUTZNameIdx() "; CFAstISOTimezoneBuff buff = readDerivedByUTZNameIdx(Authorization, TZName); if ((buff != null) && buff.getClassCode().equals("ITZN")) { return ((CFAstISOTimezoneBuff) buff); } else { return (null); } } public CFAstISOTimezoneBuff[] readBuffByIso8601Idx(CFAstAuthorization Authorization, String Iso8601) { final String S_ProcName = "CFAstRamISOTimezone.readBuffByIso8601Idx() "; CFAstISOTimezoneBuff buff; ArrayList<CFAstISOTimezoneBuff> filteredList = new ArrayList<CFAstISOTimezoneBuff>(); CFAstISOTimezoneBuff[] buffList = readDerivedByIso8601Idx(Authorization, Iso8601); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("ITZN")) { filteredList.add((CFAstISOTimezoneBuff) buff); } } return (filteredList.toArray(new CFAstISOTimezoneBuff[0])); } public void updateISOTimezone(CFAstAuthorization Authorization, CFAstISOTimezoneBuff Buff) { CFAstISOTimezonePKey pkey = schema.getFactoryISOTimezone().newPKey(); pkey.setRequiredISOTimezoneId(Buff.getRequiredISOTimezoneId()); CFAstISOTimezoneBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateISOTimezone", "Existing record not found", "ISOTimezone", pkey); } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateISOTimezone", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); CFAstISOTimezoneByOffsetIdxKey existingKeyOffsetIdx = schema.getFactoryISOTimezone().newOffsetIdxKey(); existingKeyOffsetIdx.setRequiredTZHourOffset(existing.getRequiredTZHourOffset()); existingKeyOffsetIdx.setRequiredTZMinOffset(existing.getRequiredTZMinOffset()); CFAstISOTimezoneByOffsetIdxKey newKeyOffsetIdx = schema.getFactoryISOTimezone().newOffsetIdxKey(); newKeyOffsetIdx.setRequiredTZHourOffset(Buff.getRequiredTZHourOffset()); newKeyOffsetIdx.setRequiredTZMinOffset(Buff.getRequiredTZMinOffset()); CFAstISOTimezoneByUTZNameIdxKey existingKeyUTZNameIdx = schema.getFactoryISOTimezone().newUTZNameIdxKey(); existingKeyUTZNameIdx.setRequiredTZName(existing.getRequiredTZName()); CFAstISOTimezoneByUTZNameIdxKey newKeyUTZNameIdx = schema.getFactoryISOTimezone().newUTZNameIdxKey(); newKeyUTZNameIdx.setRequiredTZName(Buff.getRequiredTZName()); CFAstISOTimezoneByIso8601IdxKey existingKeyIso8601Idx = schema.getFactoryISOTimezone().newIso8601IdxKey(); existingKeyIso8601Idx.setRequiredIso8601(existing.getRequiredIso8601()); CFAstISOTimezoneByIso8601IdxKey newKeyIso8601Idx = schema.getFactoryISOTimezone().newIso8601IdxKey(); newKeyIso8601Idx.setRequiredIso8601(Buff.getRequiredIso8601()); // Check unique indexes if (!existingKeyUTZNameIdx.equals(newKeyUTZNameIdx)) { if (dictByUTZNameIdx.containsKey(newKeyUTZNameIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "updateISOTimezone", "ISOTimezoneUTZNameIdx", newKeyUTZNameIdx); } } // Validate foreign keys // Update is valid SortedMap<CFAstISOTimezonePKey, CFAstISOTimezoneBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); subdict = dictByOffsetIdx.get(existingKeyOffsetIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByOffsetIdx.containsKey(newKeyOffsetIdx)) { subdict = dictByOffsetIdx.get(newKeyOffsetIdx); } else { subdict = new TreeMap<CFAstISOTimezonePKey, CFAstISOTimezoneBuff>(); dictByOffsetIdx.put(newKeyOffsetIdx, subdict); } subdict.put(pkey, Buff); dictByUTZNameIdx.remove(existingKeyUTZNameIdx); dictByUTZNameIdx.put(newKeyUTZNameIdx, Buff); subdict = dictByIso8601Idx.get(existingKeyIso8601Idx); if (subdict != null) { subdict.remove(pkey); } if (dictByIso8601Idx.containsKey(newKeyIso8601Idx)) { subdict = dictByIso8601Idx.get(newKeyIso8601Idx); } else { subdict = new TreeMap<CFAstISOTimezonePKey, CFAstISOTimezoneBuff>(); dictByIso8601Idx.put(newKeyIso8601Idx, subdict); } subdict.put(pkey, Buff); } public void deleteISOTimezone(CFAstAuthorization Authorization, CFAstISOTimezoneBuff Buff) { final String S_ProcName = "CFAstRamISOTimezoneTable.deleteISOTimezone() "; CFAstISOTimezonePKey pkey = schema.getFactoryISOTimezone().newPKey(); pkey.setRequiredISOTimezoneId(Buff.getRequiredISOTimezoneId()); CFAstISOTimezoneBuff existing = dictByPKey.get(pkey); if (existing == null) { return; } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteISOTimezone", pkey); } CFAstISOTimezoneByOffsetIdxKey keyOffsetIdx = schema.getFactoryISOTimezone().newOffsetIdxKey(); keyOffsetIdx.setRequiredTZHourOffset(existing.getRequiredTZHourOffset()); keyOffsetIdx.setRequiredTZMinOffset(existing.getRequiredTZMinOffset()); CFAstISOTimezoneByUTZNameIdxKey keyUTZNameIdx = schema.getFactoryISOTimezone().newUTZNameIdxKey(); keyUTZNameIdx.setRequiredTZName(existing.getRequiredTZName()); CFAstISOTimezoneByIso8601IdxKey keyIso8601Idx = schema.getFactoryISOTimezone().newIso8601IdxKey(); keyIso8601Idx.setRequiredIso8601(existing.getRequiredIso8601()); // Validate reverse foreign keys // Delete is valid SortedMap<CFAstISOTimezonePKey, CFAstISOTimezoneBuff> subdict; dictByPKey.remove(pkey); subdict = dictByOffsetIdx.get(keyOffsetIdx); subdict.remove(pkey); dictByUTZNameIdx.remove(keyUTZNameIdx); subdict = dictByIso8601Idx.get(keyIso8601Idx); subdict.remove(pkey); } public void deleteISOTimezoneByIdIdx(CFAstAuthorization Authorization, short argISOTimezoneId) { CFAstISOTimezonePKey key = schema.getFactoryISOTimezone().newPKey(); key.setRequiredISOTimezoneId(argISOTimezoneId); deleteISOTimezoneByIdIdx(Authorization, key); } public void deleteISOTimezoneByIdIdx(CFAstAuthorization Authorization, CFAstISOTimezonePKey argKey) { CFAstISOTimezoneBuff cur; LinkedList<CFAstISOTimezoneBuff> matchSet = new LinkedList<CFAstISOTimezoneBuff>(); Iterator<CFAstISOTimezoneBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAstISOTimezoneBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteISOTimezone(Authorization, cur); } } public void deleteISOTimezoneByOffsetIdx(CFAstAuthorization Authorization, short argTZHourOffset, short argTZMinOffset) { CFAstISOTimezoneByOffsetIdxKey key = schema.getFactoryISOTimezone().newOffsetIdxKey(); key.setRequiredTZHourOffset(argTZHourOffset); key.setRequiredTZMinOffset(argTZMinOffset); deleteISOTimezoneByOffsetIdx(Authorization, key); } public void deleteISOTimezoneByOffsetIdx(CFAstAuthorization Authorization, CFAstISOTimezoneByOffsetIdxKey argKey) { CFAstISOTimezoneBuff cur; LinkedList<CFAstISOTimezoneBuff> matchSet = new LinkedList<CFAstISOTimezoneBuff>(); Iterator<CFAstISOTimezoneBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAstISOTimezoneBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteISOTimezone(Authorization, cur); } } public void deleteISOTimezoneByUTZNameIdx(CFAstAuthorization Authorization, String argTZName) { CFAstISOTimezoneByUTZNameIdxKey key = schema.getFactoryISOTimezone().newUTZNameIdxKey(); key.setRequiredTZName(argTZName); deleteISOTimezoneByUTZNameIdx(Authorization, key); } public void deleteISOTimezoneByUTZNameIdx(CFAstAuthorization Authorization, CFAstISOTimezoneByUTZNameIdxKey argKey) { CFAstISOTimezoneBuff cur; LinkedList<CFAstISOTimezoneBuff> matchSet = new LinkedList<CFAstISOTimezoneBuff>(); Iterator<CFAstISOTimezoneBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAstISOTimezoneBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteISOTimezone(Authorization, cur); } } public void deleteISOTimezoneByIso8601Idx(CFAstAuthorization Authorization, String argIso8601) { CFAstISOTimezoneByIso8601IdxKey key = schema.getFactoryISOTimezone().newIso8601IdxKey(); key.setRequiredIso8601(argIso8601); deleteISOTimezoneByIso8601Idx(Authorization, key); } public void deleteISOTimezoneByIso8601Idx(CFAstAuthorization Authorization, CFAstISOTimezoneByIso8601IdxKey argKey) { CFAstISOTimezoneBuff cur; LinkedList<CFAstISOTimezoneBuff> matchSet = new LinkedList<CFAstISOTimezoneBuff>(); Iterator<CFAstISOTimezoneBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAstISOTimezoneBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteISOTimezone(Authorization, cur); } } public CFAstCursor openISOTimezoneCursorAll(CFAstAuthorization Authorization) { CFAstCursor cursor = new CFAstRamISOTimezoneCursor(Authorization, schema, dictByPKey.values()); return (cursor); } public CFAstCursor openISOTimezoneCursorByOffsetIdx(CFAstAuthorization Authorization, short TZHourOffset, short TZMinOffset) { CFAstCursor cursor; CFAstISOTimezoneByOffsetIdxKey key = schema.getFactoryISOTimezone().newOffsetIdxKey(); key.setRequiredTZHourOffset(TZHourOffset); key.setRequiredTZMinOffset(TZMinOffset); if (dictByOffsetIdx.containsKey(key)) { SortedMap<CFAstISOTimezonePKey, CFAstISOTimezoneBuff> subdictOffsetIdx = dictByOffsetIdx.get(key); cursor = new CFAstRamISOTimezoneCursor(Authorization, schema, subdictOffsetIdx.values()); } else { cursor = new CFAstRamISOTimezoneCursor(Authorization, schema, new ArrayList<CFAstISOTimezoneBuff>()); } return (cursor); } public CFAstCursor openISOTimezoneCursorByIso8601Idx(CFAstAuthorization Authorization, String Iso8601) { CFAstCursor cursor; CFAstISOTimezoneByIso8601IdxKey key = schema.getFactoryISOTimezone().newIso8601IdxKey(); key.setRequiredIso8601(Iso8601); if (dictByIso8601Idx.containsKey(key)) { SortedMap<CFAstISOTimezonePKey, CFAstISOTimezoneBuff> subdictIso8601Idx = dictByIso8601Idx.get(key); cursor = new CFAstRamISOTimezoneCursor(Authorization, schema, subdictIso8601Idx.values()); } else { cursor = new CFAstRamISOTimezoneCursor(Authorization, schema, new ArrayList<CFAstISOTimezoneBuff>()); } return (cursor); } public void closeISOTimezoneCursor(CFAstCursor Cursor) { // Cursor.DataReader.Close(); } public CFAstISOTimezoneBuff nextISOTimezoneCursor(CFAstCursor Cursor) { CFAstRamISOTimezoneCursor cursor = (CFAstRamISOTimezoneCursor) Cursor; CFAstISOTimezoneBuff rec = cursor.getCursor().next(); cursor.setRowIdx(cursor.getRowIdx() + 1); return (rec); } public CFAstISOTimezoneBuff prevISOTimezoneCursor(CFAstCursor Cursor) { int targetRowIdx = (Cursor.getRowIdx() > 1) ? Cursor.getRowIdx() - 1 : 1; CFAstISOTimezoneBuff rec = null; if (Cursor.getRowIdx() >= targetRowIdx) { Cursor.reset(); } while (Cursor.getRowIdx() < targetRowIdx) { rec = nextISOTimezoneCursor(Cursor); } return (rec); } public CFAstISOTimezoneBuff firstISOTimezoneCursor(CFAstCursor Cursor) { int targetRowIdx = 1; CFAstISOTimezoneBuff rec = null; Cursor.reset(); while (Cursor.getRowIdx() < targetRowIdx) { rec = nextISOTimezoneCursor(Cursor); } return (rec); } public CFAstISOTimezoneBuff lastISOTimezoneCursor(CFAstCursor Cursor) { throw CFLib.getDefaultExceptionFactory().newNotImplementedYetException(getClass(), "lastISOTimezoneCursor"); } public CFAstISOTimezoneBuff nthISOTimezoneCursor(CFAstCursor Cursor, int Idx) { int targetRowIdx = Idx; CFAstISOTimezoneBuff rec = null; if (Cursor.getRowIdx() >= targetRowIdx) { Cursor.reset(); } while (Cursor.getRowIdx() < targetRowIdx) { rec = nextISOTimezoneCursor(Cursor); } return (rec); } public void releasePreparedStatements() { } }