Java tutorial
// Description: Java7 in-memory RAM DbIO implementation for VoicemailConf. /* * 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.*; /* * CFAstRamVoicemailConfTable in-memory RAM DbIO implementation * for VoicemailConf. */ public class CFAstRamVoicemailConfTable implements ICFAstVoicemailConfTable { private CFAstRamSchema schema; private Map<CFAstConfigurationFilePKey, CFAstVoicemailConfBuff> dictByPKey = new HashMap<CFAstConfigurationFilePKey, CFAstVoicemailConfBuff>(); private SortedMap<CFAstVoicemailConfByVMClusterIdxKey, SortedMap<CFAstConfigurationFilePKey, CFAstVoicemailConfBuff>> dictByVMClusterIdx = new TreeMap<CFAstVoicemailConfByVMClusterIdxKey, SortedMap<CFAstConfigurationFilePKey, CFAstVoicemailConfBuff>>(); public CFAstRamVoicemailConfTable(CFAstRamSchema argSchema) { schema = argSchema; } public void createVoicemailConf(CFAstAuthorization Authorization, CFAstVoicemailConfBuff Buff) { schema.getTableConfigurationFile().createConfigurationFile(Authorization, Buff); CFAstConfigurationFilePKey pkey = schema.getFactoryConfigurationFile().newPKey(); pkey.setClassCode(Buff.getClassCode()); pkey.setRequiredClusterId(Buff.getRequiredClusterId()); pkey.setRequiredId(Buff.getRequiredId()); CFAstVoicemailConfByVMClusterIdxKey keyVMClusterIdx = schema.getFactoryVoicemailConf().newVMClusterIdxKey(); keyVMClusterIdx.setRequiredClusterId(Buff.getRequiredClusterId()); // Validate unique indexes if (dictByPKey.containsKey(pkey)) { throw CFLib.getDefaultExceptionFactory().newPrimaryKeyNotNewException(getClass(), "createVoicemailConf", pkey); } // Validate foreign keys { boolean allNull = true; allNull = false; allNull = false; if (!allNull) { if (null == schema.getTableConfigurationFile().readDerivedByIdIdx(Authorization, Buff.getRequiredClusterId(), Buff.getRequiredId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "createVoicemailConf", "Superclass", "SuperClass", "ConfigurationFile", null); } } } // Proceed with adding the new record dictByPKey.put(pkey, Buff); SortedMap<CFAstConfigurationFilePKey, CFAstVoicemailConfBuff> subdictVMClusterIdx; if (dictByVMClusterIdx.containsKey(keyVMClusterIdx)) { subdictVMClusterIdx = dictByVMClusterIdx.get(keyVMClusterIdx); } else { subdictVMClusterIdx = new TreeMap<CFAstConfigurationFilePKey, CFAstVoicemailConfBuff>(); dictByVMClusterIdx.put(keyVMClusterIdx, subdictVMClusterIdx); } subdictVMClusterIdx.put(pkey, Buff); } public CFAstVoicemailConfBuff readDerived(CFAstAuthorization Authorization, CFAstConfigurationFilePKey PKey) { final String S_ProcName = "CFAstRamVoicemailConf.readDerived() "; CFAstConfigurationFilePKey key = schema.getFactoryConfigurationFile().newPKey(); key.setRequiredClusterId(PKey.getRequiredClusterId()); key.setRequiredId(PKey.getRequiredId()); CFAstVoicemailConfBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public CFAstVoicemailConfBuff lockDerived(CFAstAuthorization Authorization, CFAstConfigurationFilePKey PKey) { final String S_ProcName = "CFAstRamVoicemailConf.readDerived() "; CFAstConfigurationFilePKey key = schema.getFactoryConfigurationFile().newPKey(); key.setRequiredClusterId(PKey.getRequiredClusterId()); key.setRequiredId(PKey.getRequiredId()); CFAstVoicemailConfBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public CFAstVoicemailConfBuff[] readAllDerived(CFAstAuthorization Authorization) { final String S_ProcName = "CFAstRamVoicemailConf.readAllDerived() "; CFAstVoicemailConfBuff[] retList = new CFAstVoicemailConfBuff[dictByPKey.values().size()]; Iterator<CFAstVoicemailConfBuff> iter = dictByPKey.values().iterator(); int idx = 0; while (iter.hasNext()) { retList[idx++] = iter.next(); } return (retList); } public CFAstVoicemailConfBuff[] readDerivedByClusterIdx(CFAstAuthorization Authorization, long ClusterId) { final String S_ProcName = "CFAstRamConfigurationFile.readDerivedByClusterIdx() "; CFAstConfigurationFileBuff buffList[] = schema.getTableConfigurationFile() .readDerivedByClusterIdx(Authorization, ClusterId); if (buffList == null) { return (null); } else { CFAstConfigurationFileBuff buff; ArrayList<CFAstVoicemailConfBuff> filteredList = new ArrayList<CFAstVoicemailConfBuff>(); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && (buff instanceof CFAstVoicemailConfBuff)) { filteredList.add((CFAstVoicemailConfBuff) buff); } } return (filteredList.toArray(new CFAstVoicemailConfBuff[0])); } } public CFAstVoicemailConfBuff[] readDerivedByHostIdx(CFAstAuthorization Authorization, long ClusterId, long HostNodeId) { final String S_ProcName = "CFAstRamConfigurationFile.readDerivedByHostIdx() "; CFAstConfigurationFileBuff buffList[] = schema.getTableConfigurationFile() .readDerivedByHostIdx(Authorization, ClusterId, HostNodeId); if (buffList == null) { return (null); } else { CFAstConfigurationFileBuff buff; ArrayList<CFAstVoicemailConfBuff> filteredList = new ArrayList<CFAstVoicemailConfBuff>(); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && (buff instanceof CFAstVoicemailConfBuff)) { filteredList.add((CFAstVoicemailConfBuff) buff); } } return (filteredList.toArray(new CFAstVoicemailConfBuff[0])); } } public CFAstVoicemailConfBuff readDerivedByUNameIdx(CFAstAuthorization Authorization, long ClusterId, long HostNodeId, String FileFullName) { final String S_ProcName = "CFAstRamConfigurationFile.readDerivedByUNameIdx() "; CFAstConfigurationFileBuff buff = schema.getTableConfigurationFile().readDerivedByUNameIdx(Authorization, ClusterId, HostNodeId, FileFullName); if (buff == null) { return (null); } else if (buff instanceof CFAstVoicemailConfBuff) { return ((CFAstVoicemailConfBuff) buff); } else { return (null); } } public CFAstVoicemailConfBuff[] readDerivedByVMClusterIdx(CFAstAuthorization Authorization, long ClusterId) { final String S_ProcName = "CFAstRamVoicemailConf.readDerivedByVMClusterIdx() "; CFAstVoicemailConfByVMClusterIdxKey key = schema.getFactoryVoicemailConf().newVMClusterIdxKey(); key.setRequiredClusterId(ClusterId); CFAstVoicemailConfBuff[] recArray; if (dictByVMClusterIdx.containsKey(key)) { SortedMap<CFAstConfigurationFilePKey, CFAstVoicemailConfBuff> subdictVMClusterIdx = dictByVMClusterIdx .get(key); recArray = new CFAstVoicemailConfBuff[subdictVMClusterIdx.size()]; Iterator<CFAstVoicemailConfBuff> iter = subdictVMClusterIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new CFAstVoicemailConfBuff[0]; } return (recArray); } public CFAstVoicemailConfBuff readDerivedByIdIdx(CFAstAuthorization Authorization, long ClusterId, long Id) { final String S_ProcName = "CFAstRamConfigurationFile.readDerivedByIdIdx() "; CFAstConfigurationFilePKey key = schema.getFactoryConfigurationFile().newPKey(); key.setRequiredClusterId(ClusterId); key.setRequiredId(Id); CFAstVoicemailConfBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public CFAstVoicemailConfBuff readBuff(CFAstAuthorization Authorization, CFAstConfigurationFilePKey PKey) { final String S_ProcName = "CFAstRamVoicemailConf.readBuff() "; CFAstVoicemailConfBuff buff = readDerived(Authorization, PKey); if ((buff != null) && (!buff.getClassCode().equals("CVOM"))) { buff = null; } return (buff); } public CFAstVoicemailConfBuff lockBuff(CFAstAuthorization Authorization, CFAstConfigurationFilePKey PKey) { final String S_ProcName = "CFAstRamVoicemailConf.readBuff() "; CFAstVoicemailConfBuff buff = readDerived(Authorization, PKey); if ((buff != null) && (!buff.getClassCode().equals("CVOM"))) { buff = null; } return (buff); } public CFAstVoicemailConfBuff[] readAllBuff(CFAstAuthorization Authorization) { final String S_ProcName = "CFAstRamVoicemailConf.readAllBuff() "; CFAstVoicemailConfBuff buff; ArrayList<CFAstVoicemailConfBuff> filteredList = new ArrayList<CFAstVoicemailConfBuff>(); CFAstVoicemailConfBuff[] buffList = readAllDerived(Authorization); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("CVOM")) { filteredList.add(buff); } } return (filteredList.toArray(new CFAstVoicemailConfBuff[0])); } public CFAstVoicemailConfBuff readBuffByIdIdx(CFAstAuthorization Authorization, long ClusterId, long Id) { final String S_ProcName = "CFAstRamConfigurationFile.readBuffByIdIdx() "; CFAstConfigurationFileBuff buff = readDerivedByIdIdx(Authorization, ClusterId, Id); if ((buff != null) && buff.getClassCode().equals("CONF")) { return ((CFAstVoicemailConfBuff) buff); } else { return (null); } } public CFAstVoicemailConfBuff[] readBuffByClusterIdx(CFAstAuthorization Authorization, long ClusterId) { final String S_ProcName = "CFAstRamConfigurationFile.readBuffByClusterIdx() "; CFAstConfigurationFileBuff buff; ArrayList<CFAstVoicemailConfBuff> filteredList = new ArrayList<CFAstVoicemailConfBuff>(); CFAstConfigurationFileBuff[] buffList = readDerivedByClusterIdx(Authorization, ClusterId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("CONF")) { filteredList.add((CFAstVoicemailConfBuff) buff); } } return (filteredList.toArray(new CFAstVoicemailConfBuff[0])); } public CFAstVoicemailConfBuff[] readBuffByHostIdx(CFAstAuthorization Authorization, long ClusterId, long HostNodeId) { final String S_ProcName = "CFAstRamConfigurationFile.readBuffByHostIdx() "; CFAstConfigurationFileBuff buff; ArrayList<CFAstVoicemailConfBuff> filteredList = new ArrayList<CFAstVoicemailConfBuff>(); CFAstConfigurationFileBuff[] buffList = readDerivedByHostIdx(Authorization, ClusterId, HostNodeId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("CONF")) { filteredList.add((CFAstVoicemailConfBuff) buff); } } return (filteredList.toArray(new CFAstVoicemailConfBuff[0])); } public CFAstVoicemailConfBuff readBuffByUNameIdx(CFAstAuthorization Authorization, long ClusterId, long HostNodeId, String FileFullName) { final String S_ProcName = "CFAstRamConfigurationFile.readBuffByUNameIdx() "; CFAstConfigurationFileBuff buff = readDerivedByUNameIdx(Authorization, ClusterId, HostNodeId, FileFullName); if ((buff != null) && buff.getClassCode().equals("CONF")) { return ((CFAstVoicemailConfBuff) buff); } else { return (null); } } public CFAstVoicemailConfBuff[] readBuffByVMClusterIdx(CFAstAuthorization Authorization, long ClusterId) { final String S_ProcName = "CFAstRamVoicemailConf.readBuffByVMClusterIdx() "; CFAstVoicemailConfBuff buff; ArrayList<CFAstVoicemailConfBuff> filteredList = new ArrayList<CFAstVoicemailConfBuff>(); CFAstVoicemailConfBuff[] buffList = readDerivedByVMClusterIdx(Authorization, ClusterId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("CVOM")) { filteredList.add((CFAstVoicemailConfBuff) buff); } } return (filteredList.toArray(new CFAstVoicemailConfBuff[0])); } public void updateVoicemailConf(CFAstAuthorization Authorization, CFAstVoicemailConfBuff Buff) { schema.getTableConfigurationFile().updateConfigurationFile(Authorization, Buff); CFAstConfigurationFilePKey pkey = schema.getFactoryConfigurationFile().newPKey(); pkey.setRequiredClusterId(Buff.getRequiredClusterId()); pkey.setRequiredId(Buff.getRequiredId()); CFAstVoicemailConfBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateVoicemailConf", "Existing record not found", "VoicemailConf", pkey); } CFAstVoicemailConfByVMClusterIdxKey existingKeyVMClusterIdx = schema.getFactoryVoicemailConf() .newVMClusterIdxKey(); existingKeyVMClusterIdx.setRequiredClusterId(existing.getRequiredClusterId()); CFAstVoicemailConfByVMClusterIdxKey newKeyVMClusterIdx = schema.getFactoryVoicemailConf() .newVMClusterIdxKey(); newKeyVMClusterIdx.setRequiredClusterId(Buff.getRequiredClusterId()); // Check unique indexes // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema.getTableConfigurationFile().readDerivedByIdIdx(Authorization, Buff.getRequiredClusterId(), Buff.getRequiredId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateVoicemailConf", "Superclass", "SuperClass", "ConfigurationFile", null); } } } // Update is valid SortedMap<CFAstConfigurationFilePKey, CFAstVoicemailConfBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); subdict = dictByVMClusterIdx.get(existingKeyVMClusterIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByVMClusterIdx.containsKey(newKeyVMClusterIdx)) { subdict = dictByVMClusterIdx.get(newKeyVMClusterIdx); } else { subdict = new TreeMap<CFAstConfigurationFilePKey, CFAstVoicemailConfBuff>(); dictByVMClusterIdx.put(newKeyVMClusterIdx, subdict); } subdict.put(pkey, Buff); } public void deleteVoicemailConf(CFAstAuthorization Authorization, CFAstVoicemailConfBuff Buff) { final String S_ProcName = "CFAstRamVoicemailConfTable.deleteVoicemailConf() "; CFAstConfigurationFilePKey pkey = schema.getFactoryConfigurationFile().newPKey(); pkey.setRequiredClusterId(Buff.getRequiredClusterId()); pkey.setRequiredId(Buff.getRequiredId()); CFAstVoicemailConfBuff existing = dictByPKey.get(pkey); if (existing == null) { return; } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteVoicemailConf", pkey); } CFAstVoicemailConfByVMClusterIdxKey keyVMClusterIdx = schema.getFactoryVoicemailConf().newVMClusterIdxKey(); keyVMClusterIdx.setRequiredClusterId(existing.getRequiredClusterId()); // Validate reverse foreign keys // Delete is valid SortedMap<CFAstConfigurationFilePKey, CFAstVoicemailConfBuff> subdict; dictByPKey.remove(pkey); subdict = dictByVMClusterIdx.get(keyVMClusterIdx); subdict.remove(pkey); schema.getTableConfigurationFile().deleteConfigurationFile(Authorization, Buff); } public void deleteVoicemailConfByVMClusterIdx(CFAstAuthorization Authorization, long argClusterId) { CFAstVoicemailConfByVMClusterIdxKey key = schema.getFactoryVoicemailConf().newVMClusterIdxKey(); key.setRequiredClusterId(argClusterId); deleteVoicemailConfByVMClusterIdx(Authorization, key); } public void deleteVoicemailConfByVMClusterIdx(CFAstAuthorization Authorization, CFAstVoicemailConfByVMClusterIdxKey argKey) { CFAstVoicemailConfBuff cur; LinkedList<CFAstVoicemailConfBuff> matchSet = new LinkedList<CFAstVoicemailConfBuff>(); Iterator<CFAstVoicemailConfBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAstVoicemailConfBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteVoicemailConf(Authorization, cur); } } public void deleteVoicemailConfByIdIdx(CFAstAuthorization Authorization, long argClusterId, long argId) { CFAstConfigurationFilePKey key = schema.getFactoryConfigurationFile().newPKey(); key.setRequiredClusterId(argClusterId); key.setRequiredId(argId); deleteVoicemailConfByIdIdx(Authorization, key); } public void deleteVoicemailConfByIdIdx(CFAstAuthorization Authorization, CFAstConfigurationFilePKey argKey) { CFAstVoicemailConfBuff cur; LinkedList<CFAstVoicemailConfBuff> matchSet = new LinkedList<CFAstVoicemailConfBuff>(); Iterator<CFAstVoicemailConfBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAstVoicemailConfBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteVoicemailConf(Authorization, cur); } } public void deleteVoicemailConfByClusterIdx(CFAstAuthorization Authorization, long argClusterId) { CFAstConfigurationFileByClusterIdxKey key = schema.getFactoryConfigurationFile().newClusterIdxKey(); key.setRequiredClusterId(argClusterId); deleteVoicemailConfByClusterIdx(Authorization, key); } public void deleteVoicemailConfByClusterIdx(CFAstAuthorization Authorization, CFAstConfigurationFileByClusterIdxKey argKey) { CFAstVoicemailConfBuff cur; LinkedList<CFAstVoicemailConfBuff> matchSet = new LinkedList<CFAstVoicemailConfBuff>(); Iterator<CFAstVoicemailConfBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAstVoicemailConfBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteVoicemailConf(Authorization, cur); } } public void deleteVoicemailConfByHostIdx(CFAstAuthorization Authorization, long argClusterId, long argHostNodeId) { CFAstConfigurationFileByHostIdxKey key = schema.getFactoryConfigurationFile().newHostIdxKey(); key.setRequiredClusterId(argClusterId); key.setRequiredHostNodeId(argHostNodeId); deleteVoicemailConfByHostIdx(Authorization, key); } public void deleteVoicemailConfByHostIdx(CFAstAuthorization Authorization, CFAstConfigurationFileByHostIdxKey argKey) { CFAstVoicemailConfBuff cur; LinkedList<CFAstVoicemailConfBuff> matchSet = new LinkedList<CFAstVoicemailConfBuff>(); Iterator<CFAstVoicemailConfBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAstVoicemailConfBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteVoicemailConf(Authorization, cur); } } public void deleteVoicemailConfByUNameIdx(CFAstAuthorization Authorization, long argClusterId, long argHostNodeId, String argFileFullName) { CFAstConfigurationFileByUNameIdxKey key = schema.getFactoryConfigurationFile().newUNameIdxKey(); key.setRequiredClusterId(argClusterId); key.setRequiredHostNodeId(argHostNodeId); key.setRequiredFileFullName(argFileFullName); deleteVoicemailConfByUNameIdx(Authorization, key); } public void deleteVoicemailConfByUNameIdx(CFAstAuthorization Authorization, CFAstConfigurationFileByUNameIdxKey argKey) { CFAstVoicemailConfBuff cur; LinkedList<CFAstVoicemailConfBuff> matchSet = new LinkedList<CFAstVoicemailConfBuff>(); Iterator<CFAstVoicemailConfBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAstVoicemailConfBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteVoicemailConf(Authorization, cur); } } public CFAstCursor openVoicemailConfCursorAll(CFAstAuthorization Authorization) { CFAstCursor cursor = new CFAstRamVoicemailConfCursor(Authorization, schema, dictByPKey.values()); return (cursor); } public CFAstCursor openVoicemailConfCursorByVMClusterIdx(CFAstAuthorization Authorization, long ClusterId) { CFAstCursor cursor; CFAstVoicemailConfByVMClusterIdxKey key = schema.getFactoryVoicemailConf().newVMClusterIdxKey(); key.setRequiredClusterId(ClusterId); if (dictByVMClusterIdx.containsKey(key)) { SortedMap<CFAstConfigurationFilePKey, CFAstVoicemailConfBuff> subdictVMClusterIdx = dictByVMClusterIdx .get(key); cursor = new CFAstRamVoicemailConfCursor(Authorization, schema, subdictVMClusterIdx.values()); } else { cursor = new CFAstRamVoicemailConfCursor(Authorization, schema, new ArrayList<CFAstVoicemailConfBuff>()); } return (cursor); } public void closeVoicemailConfCursor(CFAstCursor Cursor) { // Cursor.DataReader.Close(); } public CFAstVoicemailConfBuff nextVoicemailConfCursor(CFAstCursor Cursor) { CFAstRamVoicemailConfCursor cursor = (CFAstRamVoicemailConfCursor) Cursor; CFAstVoicemailConfBuff rec = cursor.getCursor().next(); cursor.setRowIdx(cursor.getRowIdx() + 1); return (rec); } public CFAstVoicemailConfBuff prevVoicemailConfCursor(CFAstCursor Cursor) { int targetRowIdx = (Cursor.getRowIdx() > 1) ? Cursor.getRowIdx() - 1 : 1; CFAstVoicemailConfBuff rec = null; if (Cursor.getRowIdx() >= targetRowIdx) { Cursor.reset(); } while (Cursor.getRowIdx() < targetRowIdx) { rec = nextVoicemailConfCursor(Cursor); } return (rec); } public CFAstVoicemailConfBuff firstVoicemailConfCursor(CFAstCursor Cursor) { int targetRowIdx = 1; CFAstVoicemailConfBuff rec = null; Cursor.reset(); while (Cursor.getRowIdx() < targetRowIdx) { rec = nextVoicemailConfCursor(Cursor); } return (rec); } public CFAstVoicemailConfBuff lastVoicemailConfCursor(CFAstCursor Cursor) { throw CFLib.getDefaultExceptionFactory().newNotImplementedYetException(getClass(), "lastVoicemailConfCursor"); } public CFAstVoicemailConfBuff nthVoicemailConfCursor(CFAstCursor Cursor, int Idx) { int targetRowIdx = Idx; CFAstVoicemailConfBuff rec = null; if (Cursor.getRowIdx() >= targetRowIdx) { Cursor.reset(); } while (Cursor.getRowIdx() < targetRowIdx) { rec = nextVoicemailConfCursor(Cursor); } return (rec); } public void releasePreparedStatements() { } }