Java tutorial
// Description: Java 8 in-memory RAM DbIO implementation for Cluster. /* * CFBam * * Copyright (c) 2014-2016 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.cfbam.v2_7.CFBamRam; import java.sql.*; import java.util.*; import org.apache.commons.codec.binary.Base64; import net.sourceforge.msscodefactory.cflib.v2_7.CFLib.*; import net.sourceforge.msscodefactory.cfsecurity.v2_7.CFSecurity.*; import net.sourceforge.msscodefactory.cfinternet.v2_7.CFInternet.*; import net.sourceforge.msscodefactory.cfbam.v2_7.CFBam.*; import net.sourceforge.msscodefactory.cfbam.v2_7.CFBamObj.*; import net.sourceforge.msscodefactory.cfsecurity.v2_7.CFSecurityObj.*; import net.sourceforge.msscodefactory.cfinternet.v2_7.CFInternetObj.*; import net.sourceforge.msscodefactory.cfbam.v2_7.CFBamObj.*; /* * CFBamRamClusterTable in-memory RAM DbIO implementation * for Cluster. */ public class CFBamRamClusterTable implements ICFBamClusterTable { private ICFBamSchema schema; private Map<CFSecurityClusterPKey, CFSecurityClusterBuff> dictByPKey = new HashMap<CFSecurityClusterPKey, CFSecurityClusterBuff>(); private Map<CFSecurityClusterByUDomainNameIdxKey, CFSecurityClusterBuff> dictByUDomainNameIdx = new HashMap<CFSecurityClusterByUDomainNameIdxKey, CFSecurityClusterBuff>(); private Map<CFSecurityClusterByUDescrIdxKey, CFSecurityClusterBuff> dictByUDescrIdx = new HashMap<CFSecurityClusterByUDescrIdxKey, CFSecurityClusterBuff>(); private Map<CFBamRamClusterId32Gen, CFBamRamClusterId32Gen> id32Generator = new HashMap<CFBamRamClusterId32Gen, CFBamRamClusterId32Gen>(); private Map<CFBamRamClusterId64Gen, CFBamRamClusterId64Gen> id64Generator = new HashMap<CFBamRamClusterId64Gen, CFBamRamClusterId64Gen>(); public CFBamRamClusterTable(ICFBamSchema argSchema) { schema = argSchema; } protected int generateNextId32(long argId, short argSliceId) { CFBamRamClusterId32Gen key = new CFBamRamClusterId32Gen(); key.setRequiredId(argId); key.setRequiredSliceId(argSliceId); CFBamRamClusterId32Gen useGen = id32Generator.get(key); if (useGen == null) { id32Generator.put(key, key); useGen = key; } int retNext = useGen.getNextId(); return (retNext); } protected long generateNextId64(long argId, short argSliceId) { CFBamRamClusterId64Gen key = new CFBamRamClusterId64Gen(); key.setRequiredId(argId); key.setRequiredSliceId(argSliceId); CFBamRamClusterId64Gen useGen = id64Generator.get(key); if (useGen == null) { id64Generator.put(key, key); useGen = key; } long retNext = useGen.getNextId(); return (retNext); } public int nextSecAppIdGen(CFSecurityAuthorization Authorization, CFSecurityClusterPKey pkey) { int retval = nextSecAppIdGen(Authorization, pkey.getRequiredId()); return (retval); } public int nextSecAppIdGen(CFSecurityAuthorization Authorization, long argId) { int retNext = generateNextId32(argId, (short) 107); return (retNext); } public int nextSecFormIdGen(CFSecurityAuthorization Authorization, CFSecurityClusterPKey pkey) { int retval = nextSecFormIdGen(Authorization, pkey.getRequiredId()); return (retval); } public int nextSecFormIdGen(CFSecurityAuthorization Authorization, long argId) { int retNext = generateNextId32(argId, (short) 108); return (retNext); } public int nextSecGroupIdGen(CFSecurityAuthorization Authorization, CFSecurityClusterPKey pkey) { int retval = nextSecGroupIdGen(Authorization, pkey.getRequiredId()); return (retval); } public int nextSecGroupIdGen(CFSecurityAuthorization Authorization, long argId) { int retNext = generateNextId32(argId, (short) 109); return (retNext); } public long nextSecGroupMemberIdGen(CFSecurityAuthorization Authorization, CFSecurityClusterPKey pkey) { long retval = nextSecGroupMemberIdGen(Authorization, pkey.getRequiredId()); return (retval); } public long nextSecGroupMemberIdGen(CFSecurityAuthorization Authorization, long argId) { long retNext = generateNextId64(argId, (short) 110); return (retNext); } public long nextSecGroupIncludeIdGen(CFSecurityAuthorization Authorization, CFSecurityClusterPKey pkey) { long retval = nextSecGroupIncludeIdGen(Authorization, pkey.getRequiredId()); return (retval); } public long nextSecGroupIncludeIdGen(CFSecurityAuthorization Authorization, long argId) { long retNext = generateNextId64(argId, (short) 111); return (retNext); } public long nextSecGroupFormIdGen(CFSecurityAuthorization Authorization, CFSecurityClusterPKey pkey) { long retval = nextSecGroupFormIdGen(Authorization, pkey.getRequiredId()); return (retval); } public long nextSecGroupFormIdGen(CFSecurityAuthorization Authorization, long argId) { long retNext = generateNextId64(argId, (short) 112); return (retNext); } public long nextServiceIdGen(CFSecurityAuthorization Authorization, CFSecurityClusterPKey pkey) { long retval = nextServiceIdGen(Authorization, pkey.getRequiredId()); return (retval); } public long nextServiceIdGen(CFSecurityAuthorization Authorization, long argId) { long retNext = generateNextId64(argId, (short) 115); return (retNext); } public long nextHostNodeIdGen(CFSecurityAuthorization Authorization, CFSecurityClusterPKey pkey) { long retval = nextHostNodeIdGen(Authorization, pkey.getRequiredId()); return (retval); } public long nextHostNodeIdGen(CFSecurityAuthorization Authorization, long argId) { long retNext = generateNextId64(argId, (short) 116); return (retNext); } public void createCluster(CFSecurityAuthorization Authorization, CFSecurityClusterBuff Buff) { final String S_ProcName = "createCluster"; CFSecurityClusterPKey pkey = schema.getFactoryCluster().newPKey(); pkey.setRequiredId(schema.nextClusterIdGen()); Buff.setRequiredId(pkey.getRequiredId()); CFSecurityClusterByUDomainNameIdxKey keyUDomainNameIdx = schema.getFactoryCluster().newUDomainNameIdxKey(); keyUDomainNameIdx.setRequiredFullDomainName(Buff.getRequiredFullDomainName()); CFSecurityClusterByUDescrIdxKey keyUDescrIdx = schema.getFactoryCluster().newUDescrIdxKey(); keyUDescrIdx.setRequiredDescription(Buff.getRequiredDescription()); // Validate unique indexes if (dictByPKey.containsKey(pkey)) { throw CFLib.getDefaultExceptionFactory().newPrimaryKeyNotNewException(getClass(), S_ProcName, pkey); } if (dictByUDomainNameIdx.containsKey(keyUDomainNameIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, "ClusterUDomainNameIdx", keyUDomainNameIdx); } if (dictByUDescrIdx.containsKey(keyUDescrIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), S_ProcName, "ClusterUDescrNameIdx", keyUDescrIdx); } // Validate foreign keys // Proceed with adding the new record dictByPKey.put(pkey, Buff); dictByUDomainNameIdx.put(keyUDomainNameIdx, Buff); dictByUDescrIdx.put(keyUDescrIdx, Buff); } public CFSecurityClusterBuff readDerived(CFSecurityAuthorization Authorization, CFSecurityClusterPKey PKey) { final String S_ProcName = "CFBamRamCluster.readDerived"; CFSecurityClusterPKey key = schema.getFactoryCluster().newPKey(); key.setRequiredId(PKey.getRequiredId()); CFSecurityClusterBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public CFSecurityClusterBuff lockDerived(CFSecurityAuthorization Authorization, CFSecurityClusterPKey PKey) { final String S_ProcName = "CFBamRamCluster.readDerived"; CFSecurityClusterPKey key = schema.getFactoryCluster().newPKey(); key.setRequiredId(PKey.getRequiredId()); CFSecurityClusterBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public CFSecurityClusterBuff[] readAllDerived(CFSecurityAuthorization Authorization) { final String S_ProcName = "CFBamRamCluster.readAllDerived"; CFSecurityClusterBuff[] retList = new CFSecurityClusterBuff[dictByPKey.values().size()]; Iterator<CFSecurityClusterBuff> iter = dictByPKey.values().iterator(); int idx = 0; while (iter.hasNext()) { retList[idx++] = iter.next(); } return (retList); } public CFSecurityClusterBuff readDerivedByUDomainNameIdx(CFSecurityAuthorization Authorization, String FullDomainName) { final String S_ProcName = "CFBamRamCluster.readDerivedByUDomainNameIdx"; CFSecurityClusterByUDomainNameIdxKey key = schema.getFactoryCluster().newUDomainNameIdxKey(); key.setRequiredFullDomainName(FullDomainName); CFSecurityClusterBuff buff; if (dictByUDomainNameIdx.containsKey(key)) { buff = dictByUDomainNameIdx.get(key); } else { buff = null; } return (buff); } public CFSecurityClusterBuff readDerivedByUDescrIdx(CFSecurityAuthorization Authorization, String Description) { final String S_ProcName = "CFBamRamCluster.readDerivedByUDescrIdx"; CFSecurityClusterByUDescrIdxKey key = schema.getFactoryCluster().newUDescrIdxKey(); key.setRequiredDescription(Description); CFSecurityClusterBuff buff; if (dictByUDescrIdx.containsKey(key)) { buff = dictByUDescrIdx.get(key); } else { buff = null; } return (buff); } public CFSecurityClusterBuff readDerivedByIdIdx(CFSecurityAuthorization Authorization, long Id) { final String S_ProcName = "CFBamRamCluster.readDerivedByIdIdx() "; CFSecurityClusterPKey key = schema.getFactoryCluster().newPKey(); key.setRequiredId(Id); CFSecurityClusterBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public CFSecurityClusterBuff readBuff(CFSecurityAuthorization Authorization, CFSecurityClusterPKey PKey) { final String S_ProcName = "CFBamRamCluster.readBuff"; CFSecurityClusterBuff buff = readDerived(Authorization, PKey); if ((buff != null) && (!buff.getClassCode().equals("CLUS"))) { buff = null; } return (buff); } public CFSecurityClusterBuff lockBuff(CFSecurityAuthorization Authorization, CFSecurityClusterPKey PKey) { final String S_ProcName = "lockBuff"; CFSecurityClusterBuff buff = readDerived(Authorization, PKey); if ((buff != null) && (!buff.getClassCode().equals("CLUS"))) { buff = null; } return (buff); } public CFSecurityClusterBuff[] readAllBuff(CFSecurityAuthorization Authorization) { final String S_ProcName = "CFBamRamCluster.readAllBuff"; CFSecurityClusterBuff buff; ArrayList<CFSecurityClusterBuff> filteredList = new ArrayList<CFSecurityClusterBuff>(); CFSecurityClusterBuff[] buffList = readAllDerived(Authorization); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("CLUS")) { filteredList.add(buff); } } return (filteredList.toArray(new CFSecurityClusterBuff[0])); } public CFSecurityClusterBuff readBuffByIdIdx(CFSecurityAuthorization Authorization, long Id) { final String S_ProcName = "CFBamRamCluster.readBuffByIdIdx() "; CFSecurityClusterBuff buff = readDerivedByIdIdx(Authorization, Id); if ((buff != null) && buff.getClassCode().equals("CLUS")) { return ((CFSecurityClusterBuff) buff); } else { return (null); } } public CFSecurityClusterBuff readBuffByUDomainNameIdx(CFSecurityAuthorization Authorization, String FullDomainName) { final String S_ProcName = "CFBamRamCluster.readBuffByUDomainNameIdx() "; CFSecurityClusterBuff buff = readDerivedByUDomainNameIdx(Authorization, FullDomainName); if ((buff != null) && buff.getClassCode().equals("CLUS")) { return ((CFSecurityClusterBuff) buff); } else { return (null); } } public CFSecurityClusterBuff readBuffByUDescrIdx(CFSecurityAuthorization Authorization, String Description) { final String S_ProcName = "CFBamRamCluster.readBuffByUDescrIdx() "; CFSecurityClusterBuff buff = readDerivedByUDescrIdx(Authorization, Description); if ((buff != null) && buff.getClassCode().equals("CLUS")) { return ((CFSecurityClusterBuff) buff); } else { return (null); } } public void updateCluster(CFSecurityAuthorization Authorization, CFSecurityClusterBuff Buff) { CFSecurityClusterPKey pkey = schema.getFactoryCluster().newPKey(); pkey.setRequiredId(Buff.getRequiredId()); CFSecurityClusterBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateCluster", "Existing record not found", "Cluster", pkey); } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateCluster", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); CFSecurityClusterByUDomainNameIdxKey existingKeyUDomainNameIdx = schema.getFactoryCluster() .newUDomainNameIdxKey(); existingKeyUDomainNameIdx.setRequiredFullDomainName(existing.getRequiredFullDomainName()); CFSecurityClusterByUDomainNameIdxKey newKeyUDomainNameIdx = schema.getFactoryCluster() .newUDomainNameIdxKey(); newKeyUDomainNameIdx.setRequiredFullDomainName(Buff.getRequiredFullDomainName()); CFSecurityClusterByUDescrIdxKey existingKeyUDescrIdx = schema.getFactoryCluster().newUDescrIdxKey(); existingKeyUDescrIdx.setRequiredDescription(existing.getRequiredDescription()); CFSecurityClusterByUDescrIdxKey newKeyUDescrIdx = schema.getFactoryCluster().newUDescrIdxKey(); newKeyUDescrIdx.setRequiredDescription(Buff.getRequiredDescription()); // Check unique indexes if (!existingKeyUDomainNameIdx.equals(newKeyUDomainNameIdx)) { if (dictByUDomainNameIdx.containsKey(newKeyUDomainNameIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "updateCluster", "ClusterUDomainNameIdx", newKeyUDomainNameIdx); } } if (!existingKeyUDescrIdx.equals(newKeyUDescrIdx)) { if (dictByUDescrIdx.containsKey(newKeyUDescrIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "updateCluster", "ClusterUDescrNameIdx", newKeyUDescrIdx); } } // Validate foreign keys // Update is valid Map<CFSecurityClusterPKey, CFSecurityClusterBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); dictByUDomainNameIdx.remove(existingKeyUDomainNameIdx); dictByUDomainNameIdx.put(newKeyUDomainNameIdx, Buff); dictByUDescrIdx.remove(existingKeyUDescrIdx); dictByUDescrIdx.put(newKeyUDescrIdx, Buff); } public void deleteCluster(CFSecurityAuthorization Authorization, CFSecurityClusterBuff Buff) { final String S_ProcName = "CFBamRamClusterTable.deleteCluster() "; String classCode; CFSecurityClusterPKey pkey = schema.getFactoryCluster().newPKey(); pkey.setRequiredId(Buff.getRequiredId()); CFSecurityClusterBuff existing = dictByPKey.get(pkey); if (existing == null) { return; } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteCluster", pkey); } CFSecuritySecGroupBuff buffDelSecGroupForms; CFSecuritySecGroupBuff arrDelSecGroupForms[] = schema.getTableSecGroup() .readDerivedByClusterIdx(Authorization, existing.getRequiredId()); for (int idxDelSecGroupForms = 0; idxDelSecGroupForms < arrDelSecGroupForms.length; idxDelSecGroupForms++) { buffDelSecGroupForms = arrDelSecGroupForms[idxDelSecGroupForms]; schema.getTableSecGroupForm().deleteSecGroupFormByGroupIdx(Authorization, buffDelSecGroupForms.getRequiredClusterId(), buffDelSecGroupForms.getRequiredSecGroupId()); } CFSecuritySecGroupBuff buffDelSecGroupIncludedByGroup; CFSecuritySecGroupBuff arrDelSecGroupIncludedByGroup[] = schema.getTableSecGroup() .readDerivedByClusterIdx(Authorization, existing.getRequiredId()); for (int idxDelSecGroupIncludedByGroup = 0; idxDelSecGroupIncludedByGroup < arrDelSecGroupIncludedByGroup.length; idxDelSecGroupIncludedByGroup++) { buffDelSecGroupIncludedByGroup = arrDelSecGroupIncludedByGroup[idxDelSecGroupIncludedByGroup]; schema.getTableSecGroupInclude().deleteSecGroupIncludeByIncludeIdx(Authorization, buffDelSecGroupIncludedByGroup.getRequiredClusterId(), buffDelSecGroupIncludedByGroup.getRequiredSecGroupId()); } CFSecuritySecGroupBuff buffDelSecGroupMembers; CFSecuritySecGroupBuff arrDelSecGroupMembers[] = schema.getTableSecGroup() .readDerivedByClusterIdx(Authorization, existing.getRequiredId()); for (int idxDelSecGroupMembers = 0; idxDelSecGroupMembers < arrDelSecGroupMembers.length; idxDelSecGroupMembers++) { buffDelSecGroupMembers = arrDelSecGroupMembers[idxDelSecGroupMembers]; schema.getTableSecGroupMember().deleteSecGroupMemberByGroupIdx(Authorization, buffDelSecGroupMembers.getRequiredClusterId(), buffDelSecGroupMembers.getRequiredSecGroupId()); } CFSecuritySecGroupBuff buffDelSecGroupIncludes; CFSecuritySecGroupBuff arrDelSecGroupIncludes[] = schema.getTableSecGroup() .readDerivedByClusterIdx(Authorization, existing.getRequiredId()); for (int idxDelSecGroupIncludes = 0; idxDelSecGroupIncludes < arrDelSecGroupIncludes.length; idxDelSecGroupIncludes++) { buffDelSecGroupIncludes = arrDelSecGroupIncludes[idxDelSecGroupIncludes]; schema.getTableSecGroupInclude().deleteSecGroupIncludeByGroupIdx(Authorization, buffDelSecGroupIncludes.getRequiredClusterId(), buffDelSecGroupIncludes.getRequiredSecGroupId()); } schema.getTableSecGroup().deleteSecGroupByClusterIdx(Authorization, existing.getRequiredId()); CFSecuritySecAppBuff buffDelSecAppForms; CFSecuritySecAppBuff arrDelSecAppForms[] = schema.getTableSecApp().readDerivedByClusterIdx(Authorization, existing.getRequiredId()); for (int idxDelSecAppForms = 0; idxDelSecAppForms < arrDelSecAppForms.length; idxDelSecAppForms++) { buffDelSecAppForms = arrDelSecAppForms[idxDelSecAppForms]; schema.getTableSecForm().deleteSecFormBySecAppIdx(Authorization, buffDelSecAppForms.getRequiredClusterId(), buffDelSecAppForms.getRequiredSecAppId()); } schema.getTableSecApp().deleteSecAppByClusterIdx(Authorization, existing.getRequiredId()); schema.getTableTenant().deleteTenantByClusterIdx(Authorization, existing.getRequiredId()); schema.getTableHostNode().deleteHostNodeByClusterIdx(Authorization, existing.getRequiredId()); CFSecurityClusterByUDomainNameIdxKey keyUDomainNameIdx = schema.getFactoryCluster().newUDomainNameIdxKey(); keyUDomainNameIdx.setRequiredFullDomainName(existing.getRequiredFullDomainName()); CFSecurityClusterByUDescrIdxKey keyUDescrIdx = schema.getFactoryCluster().newUDescrIdxKey(); keyUDescrIdx.setRequiredDescription(existing.getRequiredDescription()); // Validate reverse foreign keys // Delete is valid Map<CFSecurityClusterPKey, CFSecurityClusterBuff> subdict; dictByPKey.remove(pkey); dictByUDomainNameIdx.remove(keyUDomainNameIdx); dictByUDescrIdx.remove(keyUDescrIdx); } public void deleteClusterByIdIdx(CFSecurityAuthorization Authorization, long argId) { CFSecurityClusterPKey key = schema.getFactoryCluster().newPKey(); key.setRequiredId(argId); deleteClusterByIdIdx(Authorization, key); } public void deleteClusterByIdIdx(CFSecurityAuthorization Authorization, CFSecurityClusterPKey argKey) { boolean anyNotNull = false; anyNotNull = true; if (!anyNotNull) { return; } CFSecurityClusterBuff cur; LinkedList<CFSecurityClusterBuff> matchSet = new LinkedList<CFSecurityClusterBuff>(); Iterator<CFSecurityClusterBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFSecurityClusterBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); cur = schema.getTableCluster().readDerivedByIdIdx(Authorization, cur.getRequiredId()); deleteCluster(Authorization, cur); } } public void deleteClusterByUDomainNameIdx(CFSecurityAuthorization Authorization, String argFullDomainName) { CFSecurityClusterByUDomainNameIdxKey key = schema.getFactoryCluster().newUDomainNameIdxKey(); key.setRequiredFullDomainName(argFullDomainName); deleteClusterByUDomainNameIdx(Authorization, key); } public void deleteClusterByUDomainNameIdx(CFSecurityAuthorization Authorization, CFSecurityClusterByUDomainNameIdxKey argKey) { CFSecurityClusterBuff cur; boolean anyNotNull = false; anyNotNull = true; if (!anyNotNull) { return; } LinkedList<CFSecurityClusterBuff> matchSet = new LinkedList<CFSecurityClusterBuff>(); Iterator<CFSecurityClusterBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFSecurityClusterBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); cur = schema.getTableCluster().readDerivedByIdIdx(Authorization, cur.getRequiredId()); deleteCluster(Authorization, cur); } } public void deleteClusterByUDescrIdx(CFSecurityAuthorization Authorization, String argDescription) { CFSecurityClusterByUDescrIdxKey key = schema.getFactoryCluster().newUDescrIdxKey(); key.setRequiredDescription(argDescription); deleteClusterByUDescrIdx(Authorization, key); } public void deleteClusterByUDescrIdx(CFSecurityAuthorization Authorization, CFSecurityClusterByUDescrIdxKey argKey) { CFSecurityClusterBuff cur; boolean anyNotNull = false; anyNotNull = true; if (!anyNotNull) { return; } LinkedList<CFSecurityClusterBuff> matchSet = new LinkedList<CFSecurityClusterBuff>(); Iterator<CFSecurityClusterBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFSecurityClusterBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); cur = schema.getTableCluster().readDerivedByIdIdx(Authorization, cur.getRequiredId()); deleteCluster(Authorization, cur); } } public CFSecurityCursor openClusterCursorAll(CFSecurityAuthorization Authorization) { CFSecurityCursor cursor = new CFBamRamClusterCursor(Authorization, schema, dictByPKey.values()); return (cursor); } public void closeClusterCursor(CFSecurityCursor Cursor) { // Cursor.DataReader.Close(); } public CFSecurityClusterBuff nextClusterCursor(CFSecurityCursor Cursor) { CFBamRamClusterCursor cursor = (CFBamRamClusterCursor) Cursor; CFSecurityClusterBuff rec = cursor.getCursor().next(); cursor.setRowIdx(cursor.getRowIdx() + 1); return (rec); } public CFSecurityClusterBuff prevClusterCursor(CFSecurityCursor Cursor) { int targetRowIdx = (Cursor.getRowIdx() > 1) ? Cursor.getRowIdx() - 1 : 1; CFSecurityClusterBuff rec = null; if (Cursor.getRowIdx() >= targetRowIdx) { Cursor.reset(); } while (Cursor.getRowIdx() < targetRowIdx) { rec = nextClusterCursor(Cursor); } return (rec); } public CFSecurityClusterBuff firstClusterCursor(CFSecurityCursor Cursor) { int targetRowIdx = 1; CFSecurityClusterBuff rec = null; Cursor.reset(); while (Cursor.getRowIdx() < targetRowIdx) { rec = nextClusterCursor(Cursor); } return (rec); } public CFSecurityClusterBuff lastClusterCursor(CFSecurityCursor Cursor) { throw CFLib.getDefaultExceptionFactory().newNotImplementedYetException(getClass(), "lastClusterCursor"); } public CFSecurityClusterBuff nthClusterCursor(CFSecurityCursor Cursor, int Idx) { int targetRowIdx = Idx; CFSecurityClusterBuff rec = null; if (Cursor.getRowIdx() >= targetRowIdx) { Cursor.reset(); } while (Cursor.getRowIdx() < targetRowIdx) { rec = nextClusterCursor(Cursor); } return (rec); } public void releasePreparedStatements() { } }