Java tutorial
// Description: Java7 in-memory RAM DbIO implementation for SecForm. /* * 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.*; /* * CFAstRamSecFormTable in-memory RAM DbIO implementation * for SecForm. */ public class CFAstRamSecFormTable implements ICFAstSecFormTable { private CFAstRamSchema schema; private Map<CFAstSecFormPKey, CFAstSecFormBuff> dictByPKey = new HashMap<CFAstSecFormPKey, CFAstSecFormBuff>(); private SortedMap<CFAstSecFormByClusterIdxKey, SortedMap<CFAstSecFormPKey, CFAstSecFormBuff>> dictByClusterIdx = new TreeMap<CFAstSecFormByClusterIdxKey, SortedMap<CFAstSecFormPKey, CFAstSecFormBuff>>(); private SortedMap<CFAstSecFormBySecAppIdxKey, SortedMap<CFAstSecFormPKey, CFAstSecFormBuff>> dictBySecAppIdx = new TreeMap<CFAstSecFormBySecAppIdxKey, SortedMap<CFAstSecFormPKey, CFAstSecFormBuff>>(); private SortedMap<CFAstSecFormByUJEEServletIdxKey, CFAstSecFormBuff> dictByUJEEServletIdx = new TreeMap<CFAstSecFormByUJEEServletIdxKey, CFAstSecFormBuff>(); public CFAstRamSecFormTable(CFAstRamSchema argSchema) { schema = argSchema; } public void createSecForm(CFAstAuthorization Authorization, CFAstSecFormBuff Buff) { CFAstSecFormPKey pkey = schema.getFactorySecForm().newPKey(); pkey.setRequiredClusterId(Buff.getRequiredClusterId()); pkey.setRequiredSecFormId(((CFAstRamClusterTable) schema.getTableCluster()).nextSecFormIdGen(Authorization, Buff.getRequiredClusterId())); Buff.setRequiredClusterId(pkey.getRequiredClusterId()); Buff.setRequiredSecFormId(pkey.getRequiredSecFormId()); CFAstSecFormByClusterIdxKey keyClusterIdx = schema.getFactorySecForm().newClusterIdxKey(); keyClusterIdx.setRequiredClusterId(Buff.getRequiredClusterId()); CFAstSecFormBySecAppIdxKey keySecAppIdx = schema.getFactorySecForm().newSecAppIdxKey(); keySecAppIdx.setRequiredClusterId(Buff.getRequiredClusterId()); keySecAppIdx.setRequiredSecAppId(Buff.getRequiredSecAppId()); CFAstSecFormByUJEEServletIdxKey keyUJEEServletIdx = schema.getFactorySecForm().newUJEEServletIdxKey(); keyUJEEServletIdx.setRequiredClusterId(Buff.getRequiredClusterId()); keyUJEEServletIdx.setRequiredSecAppId(Buff.getRequiredSecAppId()); keyUJEEServletIdx.setRequiredJEEServletMapName(Buff.getRequiredJEEServletMapName()); // Validate unique indexes if (dictByPKey.containsKey(pkey)) { throw CFLib.getDefaultExceptionFactory().newPrimaryKeyNotNewException(getClass(), "createSecForm", pkey); } if (dictByUJEEServletIdx.containsKey(keyUJEEServletIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "createSecForm", "SecFormUJEEServletIdx", keyUJEEServletIdx); } // Validate foreign keys { boolean allNull = true; allNull = false; if (!allNull) { if (null == schema.getTableCluster().readDerivedByIdIdx(Authorization, Buff.getRequiredClusterId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "createSecForm", "Owner", "SecFormCluster", "Cluster", null); } } } { boolean allNull = true; allNull = false; allNull = false; if (!allNull) { if (null == schema.getTableSecApp().readDerivedByIdIdx(Authorization, Buff.getRequiredClusterId(), Buff.getRequiredSecAppId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "createSecForm", "Container", "SecFormApplication", "SecApp", null); } } } // Proceed with adding the new record dictByPKey.put(pkey, Buff); SortedMap<CFAstSecFormPKey, CFAstSecFormBuff> subdictClusterIdx; if (dictByClusterIdx.containsKey(keyClusterIdx)) { subdictClusterIdx = dictByClusterIdx.get(keyClusterIdx); } else { subdictClusterIdx = new TreeMap<CFAstSecFormPKey, CFAstSecFormBuff>(); dictByClusterIdx.put(keyClusterIdx, subdictClusterIdx); } subdictClusterIdx.put(pkey, Buff); SortedMap<CFAstSecFormPKey, CFAstSecFormBuff> subdictSecAppIdx; if (dictBySecAppIdx.containsKey(keySecAppIdx)) { subdictSecAppIdx = dictBySecAppIdx.get(keySecAppIdx); } else { subdictSecAppIdx = new TreeMap<CFAstSecFormPKey, CFAstSecFormBuff>(); dictBySecAppIdx.put(keySecAppIdx, subdictSecAppIdx); } subdictSecAppIdx.put(pkey, Buff); dictByUJEEServletIdx.put(keyUJEEServletIdx, Buff); } public CFAstSecFormBuff readDerived(CFAstAuthorization Authorization, CFAstSecFormPKey PKey) { final String S_ProcName = "CFAstRamSecForm.readDerived() "; CFAstSecFormPKey key = schema.getFactorySecForm().newPKey(); key.setRequiredClusterId(PKey.getRequiredClusterId()); key.setRequiredSecFormId(PKey.getRequiredSecFormId()); CFAstSecFormBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public CFAstSecFormBuff lockDerived(CFAstAuthorization Authorization, CFAstSecFormPKey PKey) { final String S_ProcName = "CFAstRamSecForm.readDerived() "; CFAstSecFormPKey key = schema.getFactorySecForm().newPKey(); key.setRequiredClusterId(PKey.getRequiredClusterId()); key.setRequiredSecFormId(PKey.getRequiredSecFormId()); CFAstSecFormBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public CFAstSecFormBuff[] readAllDerived(CFAstAuthorization Authorization) { final String S_ProcName = "CFAstRamSecForm.readAllDerived() "; CFAstSecFormBuff[] retList = new CFAstSecFormBuff[dictByPKey.values().size()]; Iterator<CFAstSecFormBuff> iter = dictByPKey.values().iterator(); int idx = 0; while (iter.hasNext()) { retList[idx++] = iter.next(); } return (retList); } public CFAstSecFormBuff[] readDerivedByClusterIdx(CFAstAuthorization Authorization, long ClusterId) { final String S_ProcName = "CFAstRamSecForm.readDerivedByClusterIdx() "; CFAstSecFormByClusterIdxKey key = schema.getFactorySecForm().newClusterIdxKey(); key.setRequiredClusterId(ClusterId); CFAstSecFormBuff[] recArray; if (dictByClusterIdx.containsKey(key)) { SortedMap<CFAstSecFormPKey, CFAstSecFormBuff> subdictClusterIdx = dictByClusterIdx.get(key); recArray = new CFAstSecFormBuff[subdictClusterIdx.size()]; Iterator<CFAstSecFormBuff> iter = subdictClusterIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new CFAstSecFormBuff[0]; } return (recArray); } public CFAstSecFormBuff[] readDerivedBySecAppIdx(CFAstAuthorization Authorization, long ClusterId, int SecAppId) { final String S_ProcName = "CFAstRamSecForm.readDerivedBySecAppIdx() "; CFAstSecFormBySecAppIdxKey key = schema.getFactorySecForm().newSecAppIdxKey(); key.setRequiredClusterId(ClusterId); key.setRequiredSecAppId(SecAppId); CFAstSecFormBuff[] recArray; if (dictBySecAppIdx.containsKey(key)) { SortedMap<CFAstSecFormPKey, CFAstSecFormBuff> subdictSecAppIdx = dictBySecAppIdx.get(key); recArray = new CFAstSecFormBuff[subdictSecAppIdx.size()]; Iterator<CFAstSecFormBuff> iter = subdictSecAppIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new CFAstSecFormBuff[0]; } return (recArray); } public CFAstSecFormBuff readDerivedByUJEEServletIdx(CFAstAuthorization Authorization, long ClusterId, int SecAppId, String JEEServletMapName) { final String S_ProcName = "CFAstRamSecForm.readDerivedByUJEEServletIdx() "; CFAstSecFormByUJEEServletIdxKey key = schema.getFactorySecForm().newUJEEServletIdxKey(); key.setRequiredClusterId(ClusterId); key.setRequiredSecAppId(SecAppId); key.setRequiredJEEServletMapName(JEEServletMapName); CFAstSecFormBuff buff; if (dictByUJEEServletIdx.containsKey(key)) { buff = dictByUJEEServletIdx.get(key); } else { buff = null; } return (buff); } public CFAstSecFormBuff readDerivedByIdIdx(CFAstAuthorization Authorization, long ClusterId, int SecFormId) { final String S_ProcName = "CFAstRamSecForm.readDerivedByIdIdx() "; CFAstSecFormPKey key = schema.getFactorySecForm().newPKey(); key.setRequiredClusterId(ClusterId); key.setRequiredSecFormId(SecFormId); CFAstSecFormBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public CFAstSecFormBuff readBuff(CFAstAuthorization Authorization, CFAstSecFormPKey PKey) { final String S_ProcName = "CFAstRamSecForm.readBuff() "; CFAstSecFormBuff buff = readDerived(Authorization, PKey); if ((buff != null) && (!buff.getClassCode().equals("SFRM"))) { buff = null; } return (buff); } public CFAstSecFormBuff lockBuff(CFAstAuthorization Authorization, CFAstSecFormPKey PKey) { final String S_ProcName = "CFAstRamSecForm.readBuff() "; CFAstSecFormBuff buff = readDerived(Authorization, PKey); if ((buff != null) && (!buff.getClassCode().equals("SFRM"))) { buff = null; } return (buff); } public CFAstSecFormBuff[] readAllBuff(CFAstAuthorization Authorization) { final String S_ProcName = "CFAstRamSecForm.readAllBuff() "; CFAstSecFormBuff buff; ArrayList<CFAstSecFormBuff> filteredList = new ArrayList<CFAstSecFormBuff>(); CFAstSecFormBuff[] buffList = readAllDerived(Authorization); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("SFRM")) { filteredList.add(buff); } } return (filteredList.toArray(new CFAstSecFormBuff[0])); } public CFAstSecFormBuff readBuffByIdIdx(CFAstAuthorization Authorization, long ClusterId, int SecFormId) { final String S_ProcName = "CFAstRamSecForm.readBuffByIdIdx() "; CFAstSecFormBuff buff = readDerivedByIdIdx(Authorization, ClusterId, SecFormId); if ((buff != null) && buff.getClassCode().equals("SFRM")) { return ((CFAstSecFormBuff) buff); } else { return (null); } } public CFAstSecFormBuff[] readBuffByClusterIdx(CFAstAuthorization Authorization, long ClusterId) { final String S_ProcName = "CFAstRamSecForm.readBuffByClusterIdx() "; CFAstSecFormBuff buff; ArrayList<CFAstSecFormBuff> filteredList = new ArrayList<CFAstSecFormBuff>(); CFAstSecFormBuff[] buffList = readDerivedByClusterIdx(Authorization, ClusterId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("SFRM")) { filteredList.add((CFAstSecFormBuff) buff); } } return (filteredList.toArray(new CFAstSecFormBuff[0])); } public CFAstSecFormBuff[] readBuffBySecAppIdx(CFAstAuthorization Authorization, long ClusterId, int SecAppId) { final String S_ProcName = "CFAstRamSecForm.readBuffBySecAppIdx() "; CFAstSecFormBuff buff; ArrayList<CFAstSecFormBuff> filteredList = new ArrayList<CFAstSecFormBuff>(); CFAstSecFormBuff[] buffList = readDerivedBySecAppIdx(Authorization, ClusterId, SecAppId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("SFRM")) { filteredList.add((CFAstSecFormBuff) buff); } } return (filteredList.toArray(new CFAstSecFormBuff[0])); } public CFAstSecFormBuff readBuffByUJEEServletIdx(CFAstAuthorization Authorization, long ClusterId, int SecAppId, String JEEServletMapName) { final String S_ProcName = "CFAstRamSecForm.readBuffByUJEEServletIdx() "; CFAstSecFormBuff buff = readDerivedByUJEEServletIdx(Authorization, ClusterId, SecAppId, JEEServletMapName); if ((buff != null) && buff.getClassCode().equals("SFRM")) { return ((CFAstSecFormBuff) buff); } else { return (null); } } public void updateSecForm(CFAstAuthorization Authorization, CFAstSecFormBuff Buff) { CFAstSecFormPKey pkey = schema.getFactorySecForm().newPKey(); pkey.setRequiredClusterId(Buff.getRequiredClusterId()); pkey.setRequiredSecFormId(Buff.getRequiredSecFormId()); CFAstSecFormBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateSecForm", "Existing record not found", "SecForm", pkey); } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateSecForm", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); CFAstSecFormByClusterIdxKey existingKeyClusterIdx = schema.getFactorySecForm().newClusterIdxKey(); existingKeyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId()); CFAstSecFormByClusterIdxKey newKeyClusterIdx = schema.getFactorySecForm().newClusterIdxKey(); newKeyClusterIdx.setRequiredClusterId(Buff.getRequiredClusterId()); CFAstSecFormBySecAppIdxKey existingKeySecAppIdx = schema.getFactorySecForm().newSecAppIdxKey(); existingKeySecAppIdx.setRequiredClusterId(existing.getRequiredClusterId()); existingKeySecAppIdx.setRequiredSecAppId(existing.getRequiredSecAppId()); CFAstSecFormBySecAppIdxKey newKeySecAppIdx = schema.getFactorySecForm().newSecAppIdxKey(); newKeySecAppIdx.setRequiredClusterId(Buff.getRequiredClusterId()); newKeySecAppIdx.setRequiredSecAppId(Buff.getRequiredSecAppId()); CFAstSecFormByUJEEServletIdxKey existingKeyUJEEServletIdx = schema.getFactorySecForm() .newUJEEServletIdxKey(); existingKeyUJEEServletIdx.setRequiredClusterId(existing.getRequiredClusterId()); existingKeyUJEEServletIdx.setRequiredSecAppId(existing.getRequiredSecAppId()); existingKeyUJEEServletIdx.setRequiredJEEServletMapName(existing.getRequiredJEEServletMapName()); CFAstSecFormByUJEEServletIdxKey newKeyUJEEServletIdx = schema.getFactorySecForm().newUJEEServletIdxKey(); newKeyUJEEServletIdx.setRequiredClusterId(Buff.getRequiredClusterId()); newKeyUJEEServletIdx.setRequiredSecAppId(Buff.getRequiredSecAppId()); newKeyUJEEServletIdx.setRequiredJEEServletMapName(Buff.getRequiredJEEServletMapName()); // Check unique indexes if (!existingKeyUJEEServletIdx.equals(newKeyUJEEServletIdx)) { if (dictByUJEEServletIdx.containsKey(newKeyUJEEServletIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "updateSecForm", "SecFormUJEEServletIdx", newKeyUJEEServletIdx); } } // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema.getTableCluster().readDerivedByIdIdx(Authorization, Buff.getRequiredClusterId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateSecForm", "Owner", "SecFormCluster", "Cluster", null); } } } { boolean allNull = true; if (allNull) { if (null == schema.getTableSecApp().readDerivedByIdIdx(Authorization, Buff.getRequiredClusterId(), Buff.getRequiredSecAppId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateSecForm", "Container", "SecFormApplication", "SecApp", null); } } } // Update is valid SortedMap<CFAstSecFormPKey, CFAstSecFormBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); subdict = dictByClusterIdx.get(existingKeyClusterIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByClusterIdx.containsKey(newKeyClusterIdx)) { subdict = dictByClusterIdx.get(newKeyClusterIdx); } else { subdict = new TreeMap<CFAstSecFormPKey, CFAstSecFormBuff>(); dictByClusterIdx.put(newKeyClusterIdx, subdict); } subdict.put(pkey, Buff); subdict = dictBySecAppIdx.get(existingKeySecAppIdx); if (subdict != null) { subdict.remove(pkey); } if (dictBySecAppIdx.containsKey(newKeySecAppIdx)) { subdict = dictBySecAppIdx.get(newKeySecAppIdx); } else { subdict = new TreeMap<CFAstSecFormPKey, CFAstSecFormBuff>(); dictBySecAppIdx.put(newKeySecAppIdx, subdict); } subdict.put(pkey, Buff); dictByUJEEServletIdx.remove(existingKeyUJEEServletIdx); dictByUJEEServletIdx.put(newKeyUJEEServletIdx, Buff); } public void deleteSecForm(CFAstAuthorization Authorization, CFAstSecFormBuff Buff) { final String S_ProcName = "CFAstRamSecFormTable.deleteSecForm() "; CFAstSecFormPKey pkey = schema.getFactorySecForm().newPKey(); pkey.setRequiredClusterId(Buff.getRequiredClusterId()); pkey.setRequiredSecFormId(Buff.getRequiredSecFormId()); CFAstSecFormBuff existing = dictByPKey.get(pkey); if (existing == null) { return; } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteSecForm", pkey); } CFAstSecFormByClusterIdxKey keyClusterIdx = schema.getFactorySecForm().newClusterIdxKey(); keyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId()); CFAstSecFormBySecAppIdxKey keySecAppIdx = schema.getFactorySecForm().newSecAppIdxKey(); keySecAppIdx.setRequiredClusterId(existing.getRequiredClusterId()); keySecAppIdx.setRequiredSecAppId(existing.getRequiredSecAppId()); CFAstSecFormByUJEEServletIdxKey keyUJEEServletIdx = schema.getFactorySecForm().newUJEEServletIdxKey(); keyUJEEServletIdx.setRequiredClusterId(existing.getRequiredClusterId()); keyUJEEServletIdx.setRequiredSecAppId(existing.getRequiredSecAppId()); keyUJEEServletIdx.setRequiredJEEServletMapName(existing.getRequiredJEEServletMapName()); // Validate reverse foreign keys // Delete is valid SortedMap<CFAstSecFormPKey, CFAstSecFormBuff> subdict; dictByPKey.remove(pkey); subdict = dictByClusterIdx.get(keyClusterIdx); subdict.remove(pkey); subdict = dictBySecAppIdx.get(keySecAppIdx); subdict.remove(pkey); dictByUJEEServletIdx.remove(keyUJEEServletIdx); } public void deleteSecFormByIdIdx(CFAstAuthorization Authorization, long argClusterId, int argSecFormId) { CFAstSecFormPKey key = schema.getFactorySecForm().newPKey(); key.setRequiredClusterId(argClusterId); key.setRequiredSecFormId(argSecFormId); deleteSecFormByIdIdx(Authorization, key); } public void deleteSecFormByIdIdx(CFAstAuthorization Authorization, CFAstSecFormPKey argKey) { CFAstSecFormBuff cur; LinkedList<CFAstSecFormBuff> matchSet = new LinkedList<CFAstSecFormBuff>(); Iterator<CFAstSecFormBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAstSecFormBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteSecForm(Authorization, cur); } } public void deleteSecFormByClusterIdx(CFAstAuthorization Authorization, long argClusterId) { CFAstSecFormByClusterIdxKey key = schema.getFactorySecForm().newClusterIdxKey(); key.setRequiredClusterId(argClusterId); deleteSecFormByClusterIdx(Authorization, key); } public void deleteSecFormByClusterIdx(CFAstAuthorization Authorization, CFAstSecFormByClusterIdxKey argKey) { CFAstSecFormBuff cur; LinkedList<CFAstSecFormBuff> matchSet = new LinkedList<CFAstSecFormBuff>(); Iterator<CFAstSecFormBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAstSecFormBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteSecForm(Authorization, cur); } } public void deleteSecFormBySecAppIdx(CFAstAuthorization Authorization, long argClusterId, int argSecAppId) { CFAstSecFormBySecAppIdxKey key = schema.getFactorySecForm().newSecAppIdxKey(); key.setRequiredClusterId(argClusterId); key.setRequiredSecAppId(argSecAppId); deleteSecFormBySecAppIdx(Authorization, key); } public void deleteSecFormBySecAppIdx(CFAstAuthorization Authorization, CFAstSecFormBySecAppIdxKey argKey) { CFAstSecFormBuff cur; LinkedList<CFAstSecFormBuff> matchSet = new LinkedList<CFAstSecFormBuff>(); Iterator<CFAstSecFormBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAstSecFormBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteSecForm(Authorization, cur); } } public void deleteSecFormByUJEEServletIdx(CFAstAuthorization Authorization, long argClusterId, int argSecAppId, String argJEEServletMapName) { CFAstSecFormByUJEEServletIdxKey key = schema.getFactorySecForm().newUJEEServletIdxKey(); key.setRequiredClusterId(argClusterId); key.setRequiredSecAppId(argSecAppId); key.setRequiredJEEServletMapName(argJEEServletMapName); deleteSecFormByUJEEServletIdx(Authorization, key); } public void deleteSecFormByUJEEServletIdx(CFAstAuthorization Authorization, CFAstSecFormByUJEEServletIdxKey argKey) { CFAstSecFormBuff cur; LinkedList<CFAstSecFormBuff> matchSet = new LinkedList<CFAstSecFormBuff>(); Iterator<CFAstSecFormBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAstSecFormBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteSecForm(Authorization, cur); } } public CFAstCursor openSecFormCursorAll(CFAstAuthorization Authorization) { CFAstCursor cursor = new CFAstRamSecFormCursor(Authorization, schema, dictByPKey.values()); return (cursor); } public CFAstCursor openSecFormCursorByClusterIdx(CFAstAuthorization Authorization, long ClusterId) { CFAstCursor cursor; CFAstSecFormByClusterIdxKey key = schema.getFactorySecForm().newClusterIdxKey(); key.setRequiredClusterId(ClusterId); if (dictByClusterIdx.containsKey(key)) { SortedMap<CFAstSecFormPKey, CFAstSecFormBuff> subdictClusterIdx = dictByClusterIdx.get(key); cursor = new CFAstRamSecFormCursor(Authorization, schema, subdictClusterIdx.values()); } else { cursor = new CFAstRamSecFormCursor(Authorization, schema, new ArrayList<CFAstSecFormBuff>()); } return (cursor); } public CFAstCursor openSecFormCursorBySecAppIdx(CFAstAuthorization Authorization, long ClusterId, int SecAppId) { CFAstCursor cursor; CFAstSecFormBySecAppIdxKey key = schema.getFactorySecForm().newSecAppIdxKey(); key.setRequiredClusterId(ClusterId); key.setRequiredSecAppId(SecAppId); if (dictBySecAppIdx.containsKey(key)) { SortedMap<CFAstSecFormPKey, CFAstSecFormBuff> subdictSecAppIdx = dictBySecAppIdx.get(key); cursor = new CFAstRamSecFormCursor(Authorization, schema, subdictSecAppIdx.values()); } else { cursor = new CFAstRamSecFormCursor(Authorization, schema, new ArrayList<CFAstSecFormBuff>()); } return (cursor); } public void closeSecFormCursor(CFAstCursor Cursor) { // Cursor.DataReader.Close(); } public CFAstSecFormBuff nextSecFormCursor(CFAstCursor Cursor) { CFAstRamSecFormCursor cursor = (CFAstRamSecFormCursor) Cursor; CFAstSecFormBuff rec = cursor.getCursor().next(); cursor.setRowIdx(cursor.getRowIdx() + 1); return (rec); } public CFAstSecFormBuff prevSecFormCursor(CFAstCursor Cursor) { int targetRowIdx = (Cursor.getRowIdx() > 1) ? Cursor.getRowIdx() - 1 : 1; CFAstSecFormBuff rec = null; if (Cursor.getRowIdx() >= targetRowIdx) { Cursor.reset(); } while (Cursor.getRowIdx() < targetRowIdx) { rec = nextSecFormCursor(Cursor); } return (rec); } public CFAstSecFormBuff firstSecFormCursor(CFAstCursor Cursor) { int targetRowIdx = 1; CFAstSecFormBuff rec = null; Cursor.reset(); while (Cursor.getRowIdx() < targetRowIdx) { rec = nextSecFormCursor(Cursor); } return (rec); } public CFAstSecFormBuff lastSecFormCursor(CFAstCursor Cursor) { throw CFLib.getDefaultExceptionFactory().newNotImplementedYetException(getClass(), "lastSecFormCursor"); } public CFAstSecFormBuff nthSecFormCursor(CFAstCursor Cursor, int Idx) { int targetRowIdx = Idx; CFAstSecFormBuff rec = null; if (Cursor.getRowIdx() >= targetRowIdx) { Cursor.reset(); } while (Cursor.getRowIdx() < targetRowIdx) { rec = nextSecFormCursor(Cursor); } return (rec); } public void releasePreparedStatements() { } }