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