Java tutorial
// Description: Java7 in-memory RAM DbIO implementation for SecForm. /* * MSS Code Factory Accounting Business Application Model * * Copyright (c) 2014 Mark Sobkow * * This program is available as free software under the GNU GPL v3, or * under a commercial license from Mark Sobkow. For commercial licensing * details, please contact msobkow@sasktel.net. * * Under the terms of the GPL: * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * This source code incorporates modified modules originally licensed * under the Apache 2.0 license by MSS Code Factory including CFSecurity * (net-sourceforge-msscodefactory-2.0-cfsecurity.xml), * CFInternet (net-sourceforge-msscodefactory-2.0-cfinternet.xml), and * CFCrm 2.0 (net-sourceforge-msscodefactory-2.0-cfcrm.xml), with all of the * required models being available as part of the MSS Code Factory 1.11 * distribution source and install zips. * * You can download installations of MSS Code Factory 1.11 from * http://msscodefactory.sourceforge.net/ * * *********************************************************************** * * Code manufactured by MSS Code Factory */ package net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam; import java.sql.*; import java.util.*; import net.sourceforge.msscodefactory.cflib.v1_11.CFLib.*; import org.apache.commons.codec.binary.Base64; import net.sourceforge.msscodefactory.cfacc.v2_0.CFAcc.*; import net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam.*; /* * CFAccRamSecFormTable in-memory RAM DbIO implementation * for SecForm. */ public class CFAccRamSecFormTable implements ICFAccSecFormTable { private CFAccRamSchema schema; private Map<CFAccSecFormPKey, CFAccSecFormBuff> dictByPKey = new HashMap<CFAccSecFormPKey, CFAccSecFormBuff>(); private SortedMap<CFAccSecFormByClusterIdxKey, SortedMap<CFAccSecFormPKey, CFAccSecFormBuff>> dictByClusterIdx = new TreeMap<CFAccSecFormByClusterIdxKey, SortedMap<CFAccSecFormPKey, CFAccSecFormBuff>>(); private SortedMap<CFAccSecFormBySecAppIdxKey, SortedMap<CFAccSecFormPKey, CFAccSecFormBuff>> dictBySecAppIdx = new TreeMap<CFAccSecFormBySecAppIdxKey, SortedMap<CFAccSecFormPKey, CFAccSecFormBuff>>(); private SortedMap<CFAccSecFormByUJEEServletIdxKey, CFAccSecFormBuff> dictByUJEEServletIdx = new TreeMap<CFAccSecFormByUJEEServletIdxKey, CFAccSecFormBuff>(); public CFAccRamSecFormTable(CFAccRamSchema argSchema) { schema = argSchema; } public void createSecForm(CFAccAuthorization Authorization, CFAccSecFormBuff Buff) { CFAccSecFormPKey pkey = schema.getFactorySecForm().newPKey(); pkey.setRequiredClusterId(Buff.getRequiredClusterId()); pkey.setRequiredSecFormId(((CFAccRamClusterTable) schema.getTableCluster()).nextSecFormIdGen(Authorization, Buff.getRequiredClusterId())); Buff.setRequiredClusterId(pkey.getRequiredClusterId()); Buff.setRequiredSecFormId(pkey.getRequiredSecFormId()); CFAccSecFormByClusterIdxKey keyClusterIdx = schema.getFactorySecForm().newClusterIdxKey(); keyClusterIdx.setRequiredClusterId(Buff.getRequiredClusterId()); CFAccSecFormBySecAppIdxKey keySecAppIdx = schema.getFactorySecForm().newSecAppIdxKey(); keySecAppIdx.setRequiredClusterId(Buff.getRequiredClusterId()); keySecAppIdx.setRequiredSecAppId(Buff.getRequiredSecAppId()); CFAccSecFormByUJEEServletIdxKey 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<CFAccSecFormPKey, CFAccSecFormBuff> subdictClusterIdx; if (dictByClusterIdx.containsKey(keyClusterIdx)) { subdictClusterIdx = dictByClusterIdx.get(keyClusterIdx); } else { subdictClusterIdx = new TreeMap<CFAccSecFormPKey, CFAccSecFormBuff>(); dictByClusterIdx.put(keyClusterIdx, subdictClusterIdx); } subdictClusterIdx.put(pkey, Buff); SortedMap<CFAccSecFormPKey, CFAccSecFormBuff> subdictSecAppIdx; if (dictBySecAppIdx.containsKey(keySecAppIdx)) { subdictSecAppIdx = dictBySecAppIdx.get(keySecAppIdx); } else { subdictSecAppIdx = new TreeMap<CFAccSecFormPKey, CFAccSecFormBuff>(); dictBySecAppIdx.put(keySecAppIdx, subdictSecAppIdx); } subdictSecAppIdx.put(pkey, Buff); dictByUJEEServletIdx.put(keyUJEEServletIdx, Buff); } public CFAccSecFormBuff readDerived(CFAccAuthorization Authorization, CFAccSecFormPKey PKey) { final String S_ProcName = "CFAccRamSecForm.readDerived() "; CFAccSecFormPKey key = schema.getFactorySecForm().newPKey(); key.setRequiredClusterId(PKey.getRequiredClusterId()); key.setRequiredSecFormId(PKey.getRequiredSecFormId()); CFAccSecFormBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public CFAccSecFormBuff lockDerived(CFAccAuthorization Authorization, CFAccSecFormPKey PKey) { final String S_ProcName = "CFAccRamSecForm.readDerived() "; CFAccSecFormPKey key = schema.getFactorySecForm().newPKey(); key.setRequiredClusterId(PKey.getRequiredClusterId()); key.setRequiredSecFormId(PKey.getRequiredSecFormId()); CFAccSecFormBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public CFAccSecFormBuff[] readAllDerived(CFAccAuthorization Authorization) { final String S_ProcName = "CFAccRamSecForm.readAllDerived() "; CFAccSecFormBuff[] retList = new CFAccSecFormBuff[dictByPKey.values().size()]; Iterator<CFAccSecFormBuff> iter = dictByPKey.values().iterator(); int idx = 0; while (iter.hasNext()) { retList[idx++] = iter.next(); } return (retList); } public CFAccSecFormBuff[] readDerivedByClusterIdx(CFAccAuthorization Authorization, long ClusterId) { final String S_ProcName = "CFAccRamSecForm.readDerivedByClusterIdx() "; CFAccSecFormByClusterIdxKey key = schema.getFactorySecForm().newClusterIdxKey(); key.setRequiredClusterId(ClusterId); CFAccSecFormBuff[] recArray; if (dictByClusterIdx.containsKey(key)) { SortedMap<CFAccSecFormPKey, CFAccSecFormBuff> subdictClusterIdx = dictByClusterIdx.get(key); recArray = new CFAccSecFormBuff[subdictClusterIdx.size()]; Iterator<CFAccSecFormBuff> iter = subdictClusterIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new CFAccSecFormBuff[0]; } return (recArray); } public CFAccSecFormBuff[] readDerivedBySecAppIdx(CFAccAuthorization Authorization, long ClusterId, int SecAppId) { final String S_ProcName = "CFAccRamSecForm.readDerivedBySecAppIdx() "; CFAccSecFormBySecAppIdxKey key = schema.getFactorySecForm().newSecAppIdxKey(); key.setRequiredClusterId(ClusterId); key.setRequiredSecAppId(SecAppId); CFAccSecFormBuff[] recArray; if (dictBySecAppIdx.containsKey(key)) { SortedMap<CFAccSecFormPKey, CFAccSecFormBuff> subdictSecAppIdx = dictBySecAppIdx.get(key); recArray = new CFAccSecFormBuff[subdictSecAppIdx.size()]; Iterator<CFAccSecFormBuff> iter = subdictSecAppIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new CFAccSecFormBuff[0]; } return (recArray); } public CFAccSecFormBuff readDerivedByUJEEServletIdx(CFAccAuthorization Authorization, long ClusterId, int SecAppId, String JEEServletMapName) { final String S_ProcName = "CFAccRamSecForm.readDerivedByUJEEServletIdx() "; CFAccSecFormByUJEEServletIdxKey key = schema.getFactorySecForm().newUJEEServletIdxKey(); key.setRequiredClusterId(ClusterId); key.setRequiredSecAppId(SecAppId); key.setRequiredJEEServletMapName(JEEServletMapName); CFAccSecFormBuff buff; if (dictByUJEEServletIdx.containsKey(key)) { buff = dictByUJEEServletIdx.get(key); } else { buff = null; } return (buff); } public CFAccSecFormBuff readDerivedByIdIdx(CFAccAuthorization Authorization, long ClusterId, int SecFormId) { final String S_ProcName = "CFAccRamSecForm.readDerivedByIdIdx() "; CFAccSecFormPKey key = schema.getFactorySecForm().newPKey(); key.setRequiredClusterId(ClusterId); key.setRequiredSecFormId(SecFormId); CFAccSecFormBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public CFAccSecFormBuff readBuff(CFAccAuthorization Authorization, CFAccSecFormPKey PKey) { final String S_ProcName = "CFAccRamSecForm.readBuff() "; CFAccSecFormBuff buff = readDerived(Authorization, PKey); if ((buff != null) && (!buff.getClassCode().equals("SFRM"))) { buff = null; } return (buff); } public CFAccSecFormBuff lockBuff(CFAccAuthorization Authorization, CFAccSecFormPKey PKey) { final String S_ProcName = "CFAccRamSecForm.readBuff() "; CFAccSecFormBuff buff = readDerived(Authorization, PKey); if ((buff != null) && (!buff.getClassCode().equals("SFRM"))) { buff = null; } return (buff); } public CFAccSecFormBuff[] readAllBuff(CFAccAuthorization Authorization) { final String S_ProcName = "CFAccRamSecForm.readAllBuff() "; CFAccSecFormBuff buff; ArrayList<CFAccSecFormBuff> filteredList = new ArrayList<CFAccSecFormBuff>(); CFAccSecFormBuff[] 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 CFAccSecFormBuff[0])); } public CFAccSecFormBuff readBuffByIdIdx(CFAccAuthorization Authorization, long ClusterId, int SecFormId) { final String S_ProcName = "CFAccRamSecForm.readBuffByIdIdx() "; CFAccSecFormBuff buff = readDerivedByIdIdx(Authorization, ClusterId, SecFormId); if ((buff != null) && buff.getClassCode().equals("SFRM")) { return ((CFAccSecFormBuff) buff); } else { return (null); } } public CFAccSecFormBuff[] readBuffByClusterIdx(CFAccAuthorization Authorization, long ClusterId) { final String S_ProcName = "CFAccRamSecForm.readBuffByClusterIdx() "; CFAccSecFormBuff buff; ArrayList<CFAccSecFormBuff> filteredList = new ArrayList<CFAccSecFormBuff>(); CFAccSecFormBuff[] buffList = readDerivedByClusterIdx(Authorization, ClusterId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("SFRM")) { filteredList.add((CFAccSecFormBuff) buff); } } return (filteredList.toArray(new CFAccSecFormBuff[0])); } public CFAccSecFormBuff[] readBuffBySecAppIdx(CFAccAuthorization Authorization, long ClusterId, int SecAppId) { final String S_ProcName = "CFAccRamSecForm.readBuffBySecAppIdx() "; CFAccSecFormBuff buff; ArrayList<CFAccSecFormBuff> filteredList = new ArrayList<CFAccSecFormBuff>(); CFAccSecFormBuff[] 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((CFAccSecFormBuff) buff); } } return (filteredList.toArray(new CFAccSecFormBuff[0])); } public CFAccSecFormBuff readBuffByUJEEServletIdx(CFAccAuthorization Authorization, long ClusterId, int SecAppId, String JEEServletMapName) { final String S_ProcName = "CFAccRamSecForm.readBuffByUJEEServletIdx() "; CFAccSecFormBuff buff = readDerivedByUJEEServletIdx(Authorization, ClusterId, SecAppId, JEEServletMapName); if ((buff != null) && buff.getClassCode().equals("SFRM")) { return ((CFAccSecFormBuff) buff); } else { return (null); } } public void updateSecForm(CFAccAuthorization Authorization, CFAccSecFormBuff Buff) { CFAccSecFormPKey pkey = schema.getFactorySecForm().newPKey(); pkey.setRequiredClusterId(Buff.getRequiredClusterId()); pkey.setRequiredSecFormId(Buff.getRequiredSecFormId()); CFAccSecFormBuff 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); CFAccSecFormByClusterIdxKey existingKeyClusterIdx = schema.getFactorySecForm().newClusterIdxKey(); existingKeyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId()); CFAccSecFormByClusterIdxKey newKeyClusterIdx = schema.getFactorySecForm().newClusterIdxKey(); newKeyClusterIdx.setRequiredClusterId(Buff.getRequiredClusterId()); CFAccSecFormBySecAppIdxKey existingKeySecAppIdx = schema.getFactorySecForm().newSecAppIdxKey(); existingKeySecAppIdx.setRequiredClusterId(existing.getRequiredClusterId()); existingKeySecAppIdx.setRequiredSecAppId(existing.getRequiredSecAppId()); CFAccSecFormBySecAppIdxKey newKeySecAppIdx = schema.getFactorySecForm().newSecAppIdxKey(); newKeySecAppIdx.setRequiredClusterId(Buff.getRequiredClusterId()); newKeySecAppIdx.setRequiredSecAppId(Buff.getRequiredSecAppId()); CFAccSecFormByUJEEServletIdxKey existingKeyUJEEServletIdx = schema.getFactorySecForm() .newUJEEServletIdxKey(); existingKeyUJEEServletIdx.setRequiredClusterId(existing.getRequiredClusterId()); existingKeyUJEEServletIdx.setRequiredSecAppId(existing.getRequiredSecAppId()); existingKeyUJEEServletIdx.setRequiredJEEServletMapName(existing.getRequiredJEEServletMapName()); CFAccSecFormByUJEEServletIdxKey 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<CFAccSecFormPKey, CFAccSecFormBuff> 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<CFAccSecFormPKey, CFAccSecFormBuff>(); 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<CFAccSecFormPKey, CFAccSecFormBuff>(); dictBySecAppIdx.put(newKeySecAppIdx, subdict); } subdict.put(pkey, Buff); dictByUJEEServletIdx.remove(existingKeyUJEEServletIdx); dictByUJEEServletIdx.put(newKeyUJEEServletIdx, Buff); } public void deleteSecForm(CFAccAuthorization Authorization, CFAccSecFormBuff Buff) { final String S_ProcName = "CFAccRamSecFormTable.deleteSecForm() "; CFAccSecFormPKey pkey = schema.getFactorySecForm().newPKey(); pkey.setRequiredClusterId(Buff.getRequiredClusterId()); pkey.setRequiredSecFormId(Buff.getRequiredSecFormId()); CFAccSecFormBuff existing = dictByPKey.get(pkey); if (existing == null) { return; } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteSecForm", pkey); } CFAccSecFormByClusterIdxKey keyClusterIdx = schema.getFactorySecForm().newClusterIdxKey(); keyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId()); CFAccSecFormBySecAppIdxKey keySecAppIdx = schema.getFactorySecForm().newSecAppIdxKey(); keySecAppIdx.setRequiredClusterId(existing.getRequiredClusterId()); keySecAppIdx.setRequiredSecAppId(existing.getRequiredSecAppId()); CFAccSecFormByUJEEServletIdxKey keyUJEEServletIdx = schema.getFactorySecForm().newUJEEServletIdxKey(); keyUJEEServletIdx.setRequiredClusterId(existing.getRequiredClusterId()); keyUJEEServletIdx.setRequiredSecAppId(existing.getRequiredSecAppId()); keyUJEEServletIdx.setRequiredJEEServletMapName(existing.getRequiredJEEServletMapName()); // Validate reverse foreign keys // Delete is valid SortedMap<CFAccSecFormPKey, CFAccSecFormBuff> subdict; dictByPKey.remove(pkey); subdict = dictByClusterIdx.get(keyClusterIdx); subdict.remove(pkey); subdict = dictBySecAppIdx.get(keySecAppIdx); subdict.remove(pkey); dictByUJEEServletIdx.remove(keyUJEEServletIdx); } public void deleteSecFormByIdIdx(CFAccAuthorization Authorization, long argClusterId, int argSecFormId) { CFAccSecFormPKey key = schema.getFactorySecForm().newPKey(); key.setRequiredClusterId(argClusterId); key.setRequiredSecFormId(argSecFormId); deleteSecFormByIdIdx(Authorization, key); } public void deleteSecFormByIdIdx(CFAccAuthorization Authorization, CFAccSecFormPKey argKey) { CFAccSecFormBuff cur; LinkedList<CFAccSecFormBuff> matchSet = new LinkedList<CFAccSecFormBuff>(); Iterator<CFAccSecFormBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAccSecFormBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteSecForm(Authorization, cur); } } public void deleteSecFormByClusterIdx(CFAccAuthorization Authorization, long argClusterId) { CFAccSecFormByClusterIdxKey key = schema.getFactorySecForm().newClusterIdxKey(); key.setRequiredClusterId(argClusterId); deleteSecFormByClusterIdx(Authorization, key); } public void deleteSecFormByClusterIdx(CFAccAuthorization Authorization, CFAccSecFormByClusterIdxKey argKey) { CFAccSecFormBuff cur; LinkedList<CFAccSecFormBuff> matchSet = new LinkedList<CFAccSecFormBuff>(); Iterator<CFAccSecFormBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAccSecFormBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteSecForm(Authorization, cur); } } public void deleteSecFormBySecAppIdx(CFAccAuthorization Authorization, long argClusterId, int argSecAppId) { CFAccSecFormBySecAppIdxKey key = schema.getFactorySecForm().newSecAppIdxKey(); key.setRequiredClusterId(argClusterId); key.setRequiredSecAppId(argSecAppId); deleteSecFormBySecAppIdx(Authorization, key); } public void deleteSecFormBySecAppIdx(CFAccAuthorization Authorization, CFAccSecFormBySecAppIdxKey argKey) { CFAccSecFormBuff cur; LinkedList<CFAccSecFormBuff> matchSet = new LinkedList<CFAccSecFormBuff>(); Iterator<CFAccSecFormBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAccSecFormBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteSecForm(Authorization, cur); } } public void deleteSecFormByUJEEServletIdx(CFAccAuthorization Authorization, long argClusterId, int argSecAppId, String argJEEServletMapName) { CFAccSecFormByUJEEServletIdxKey key = schema.getFactorySecForm().newUJEEServletIdxKey(); key.setRequiredClusterId(argClusterId); key.setRequiredSecAppId(argSecAppId); key.setRequiredJEEServletMapName(argJEEServletMapName); deleteSecFormByUJEEServletIdx(Authorization, key); } public void deleteSecFormByUJEEServletIdx(CFAccAuthorization Authorization, CFAccSecFormByUJEEServletIdxKey argKey) { CFAccSecFormBuff cur; LinkedList<CFAccSecFormBuff> matchSet = new LinkedList<CFAccSecFormBuff>(); Iterator<CFAccSecFormBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFAccSecFormBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteSecForm(Authorization, cur); } } public CFAccCursor openSecFormCursorAll(CFAccAuthorization Authorization) { CFAccCursor cursor = new CFAccRamSecFormCursor(Authorization, schema, dictByPKey.values()); return (cursor); } public CFAccCursor openSecFormCursorByClusterIdx(CFAccAuthorization Authorization, long ClusterId) { CFAccCursor cursor; CFAccSecFormByClusterIdxKey key = schema.getFactorySecForm().newClusterIdxKey(); key.setRequiredClusterId(ClusterId); if (dictByClusterIdx.containsKey(key)) { SortedMap<CFAccSecFormPKey, CFAccSecFormBuff> subdictClusterIdx = dictByClusterIdx.get(key); cursor = new CFAccRamSecFormCursor(Authorization, schema, subdictClusterIdx.values()); } else { cursor = new CFAccRamSecFormCursor(Authorization, schema, new ArrayList<CFAccSecFormBuff>()); } return (cursor); } public CFAccCursor openSecFormCursorBySecAppIdx(CFAccAuthorization Authorization, long ClusterId, int SecAppId) { CFAccCursor cursor; CFAccSecFormBySecAppIdxKey key = schema.getFactorySecForm().newSecAppIdxKey(); key.setRequiredClusterId(ClusterId); key.setRequiredSecAppId(SecAppId); if (dictBySecAppIdx.containsKey(key)) { SortedMap<CFAccSecFormPKey, CFAccSecFormBuff> subdictSecAppIdx = dictBySecAppIdx.get(key); cursor = new CFAccRamSecFormCursor(Authorization, schema, subdictSecAppIdx.values()); } else { cursor = new CFAccRamSecFormCursor(Authorization, schema, new ArrayList<CFAccSecFormBuff>()); } return (cursor); } public void closeSecFormCursor(CFAccCursor Cursor) { // Cursor.DataReader.Close(); } public CFAccSecFormBuff nextSecFormCursor(CFAccCursor Cursor) { CFAccRamSecFormCursor cursor = (CFAccRamSecFormCursor) Cursor; CFAccSecFormBuff rec = cursor.getCursor().next(); cursor.setRowIdx(cursor.getRowIdx() + 1); return (rec); } public CFAccSecFormBuff prevSecFormCursor(CFAccCursor Cursor) { int targetRowIdx = (Cursor.getRowIdx() > 1) ? Cursor.getRowIdx() - 1 : 1; CFAccSecFormBuff rec = null; if (Cursor.getRowIdx() >= targetRowIdx) { Cursor.reset(); } while (Cursor.getRowIdx() < targetRowIdx) { rec = nextSecFormCursor(Cursor); } return (rec); } public CFAccSecFormBuff firstSecFormCursor(CFAccCursor Cursor) { int targetRowIdx = 1; CFAccSecFormBuff rec = null; Cursor.reset(); while (Cursor.getRowIdx() < targetRowIdx) { rec = nextSecFormCursor(Cursor); } return (rec); } public CFAccSecFormBuff lastSecFormCursor(CFAccCursor Cursor) { throw CFLib.getDefaultExceptionFactory().newNotImplementedYetException(getClass(), "lastSecFormCursor"); } public CFAccSecFormBuff nthSecFormCursor(CFAccCursor Cursor, int Idx) { int targetRowIdx = Idx; CFAccSecFormBuff rec = null; if (Cursor.getRowIdx() >= targetRowIdx) { Cursor.reset(); } while (Cursor.getRowIdx() < targetRowIdx) { rec = nextSecFormCursor(Cursor); } return (rec); } public void releasePreparedStatements() { } }