Java tutorial
// Description: Java6 in-memory RAM DbIO implementation for Value. /* * MSS Code Factory 1.10 * * Copyright (c) 2012 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/>. * * *********************************************************************** * * Code manufactured * by MSS Code Factory version 1.9.3294 * * $Revision: 26 $ */ package net.sourceforge.msscodefactory.v1_10.MSSBamRam; import java.sql.*; import java.util.*; import net.sourceforge.msscodefactory.cflib.v1_9.CFLib.*; import org.apache.commons.codec.binary.Base64; import net.sourceforge.msscodefactory.v1_10.MSSBam.*; import net.sourceforge.msscodefactory.v1_10.MSSBamBL.*; import net.sourceforge.msscodefactory.v1_10.MSSBamBLRam.*; /* * MSSBamRamValueTable in-memory RAM DbIO implementation * for Value. */ public class MSSBamRamValueTable implements IMSSBamValueTable { private MSSBamBLRamSchema schema; private Map<MSSBamAnyObjPKey, MSSBamValueBuff> dictByPKey = new HashMap<MSSBamAnyObjPKey, MSSBamValueBuff>(); private SortedMap<MSSBamValueByVContIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff>> dictByVContIdx = new TreeMap<MSSBamValueByVContIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff>>(); private SortedMap<MSSBamValueByDataScopeIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff>> dictByDataScopeIdx = new TreeMap<MSSBamValueByDataScopeIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff>>(); private SortedMap<MSSBamValueByVAccSecIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff>> dictByVAccSecIdx = new TreeMap<MSSBamValueByVAccSecIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff>>(); private SortedMap<MSSBamValueByVAccFreqIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff>> dictByVAccFreqIdx = new TreeMap<MSSBamValueByVAccFreqIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff>>(); private SortedMap<MSSBamValueByEAccSecIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff>> dictByEAccSecIdx = new TreeMap<MSSBamValueByEAccSecIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff>>(); private SortedMap<MSSBamValueByEAccFreqIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff>> dictByEAccFreqIdx = new TreeMap<MSSBamValueByEAccFreqIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff>>(); private SortedMap<MSSBamValueByPrevIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff>> dictByPrevIdx = new TreeMap<MSSBamValueByPrevIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff>>(); private SortedMap<MSSBamValueByNextIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff>> dictByNextIdx = new TreeMap<MSSBamValueByNextIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff>>(); private SortedMap<MSSBamValueByContPrevIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff>> dictByContPrevIdx = new TreeMap<MSSBamValueByContPrevIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff>>(); private SortedMap<MSSBamValueByContNextIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff>> dictByContNextIdx = new TreeMap<MSSBamValueByContNextIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff>>(); public MSSBamRamValueTable(MSSBamBLRamSchema argSchema) { schema = argSchema; } public void createValue(MSSBamAuthorization Authorization, MSSBamValueBuff Buff) { MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey(); pkey.setClassCode(Buff.getClassCode()); pkey.setRequiredId(Buff.getRequiredId()); MSSBamValueByVContIdxKey keyVContIdx = schema.getFactoryValue().newVContIdxKey(); keyVContIdx.setRequiredValueContainerId(Buff.getRequiredValueContainerId()); MSSBamValueByDataScopeIdxKey keyDataScopeIdx = schema.getFactoryValue().newDataScopeIdxKey(); keyDataScopeIdx.setOptionalDataScopeId(Buff.getOptionalDataScopeId()); MSSBamValueByVAccSecIdxKey keyVAccSecIdx = schema.getFactoryValue().newVAccSecIdxKey(); keyVAccSecIdx.setOptionalViewAccessSecurityId(Buff.getOptionalViewAccessSecurityId()); MSSBamValueByVAccFreqIdxKey keyVAccFreqIdx = schema.getFactoryValue().newVAccFreqIdxKey(); keyVAccFreqIdx.setOptionalViewAccessFrequencyId(Buff.getOptionalViewAccessFrequencyId()); MSSBamValueByEAccSecIdxKey keyEAccSecIdx = schema.getFactoryValue().newEAccSecIdxKey(); keyEAccSecIdx.setOptionalEditAccessSecurityId(Buff.getOptionalEditAccessSecurityId()); MSSBamValueByEAccFreqIdxKey keyEAccFreqIdx = schema.getFactoryValue().newEAccFreqIdxKey(); keyEAccFreqIdx.setOptionalEditAccessFrequencyId(Buff.getOptionalEditAccessFrequencyId()); MSSBamValueByPrevIdxKey keyPrevIdx = schema.getFactoryValue().newPrevIdxKey(); keyPrevIdx.setOptionalPrevId(Buff.getOptionalPrevId()); MSSBamValueByNextIdxKey keyNextIdx = schema.getFactoryValue().newNextIdxKey(); keyNextIdx.setOptionalNextId(Buff.getOptionalNextId()); MSSBamValueByContPrevIdxKey keyContPrevIdx = schema.getFactoryValue().newContPrevIdxKey(); keyContPrevIdx.setRequiredValueContainerId(Buff.getRequiredValueContainerId()); keyContPrevIdx.setOptionalPrevId(Buff.getOptionalPrevId()); MSSBamValueByContNextIdxKey keyContNextIdx = schema.getFactoryValue().newContNextIdxKey(); keyContNextIdx.setRequiredValueContainerId(Buff.getRequiredValueContainerId()); keyContNextIdx.setOptionalNextId(Buff.getOptionalNextId()); // Validate unique indexes if (dictByPKey.containsKey(pkey)) { throw CFLib.getDefaultExceptionFactory().newPrimaryKeyNotNewException(getClass(), "createValue", pkey); } // Validate foreign keys { boolean allNull = true; allNull = false; if (!allNull) { if (null == schema.getTableScope().readDerivedByIdIdx(Authorization, Buff.getRequiredId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "createValue", "Superclass", "SuperClass", "Scope", null); } } } { boolean allNull = true; allNull = false; if (!allNull) { if (null == schema.getTableScope().readDerivedByIdIdx(Authorization, Buff.getRequiredValueContainerId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "createValue", "Container", "ValueContainer", "Scope", null); } } } // Proceed with adding the new record dictByPKey.put(pkey, Buff); SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff> subdictVContIdx; if (dictByVContIdx.containsKey(keyVContIdx)) { subdictVContIdx = dictByVContIdx.get(keyVContIdx); } else { subdictVContIdx = new TreeMap<MSSBamAnyObjPKey, MSSBamValueBuff>(); dictByVContIdx.put(keyVContIdx, subdictVContIdx); } subdictVContIdx.put(pkey, Buff); SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff> subdictDataScopeIdx; if (dictByDataScopeIdx.containsKey(keyDataScopeIdx)) { subdictDataScopeIdx = dictByDataScopeIdx.get(keyDataScopeIdx); } else { subdictDataScopeIdx = new TreeMap<MSSBamAnyObjPKey, MSSBamValueBuff>(); dictByDataScopeIdx.put(keyDataScopeIdx, subdictDataScopeIdx); } subdictDataScopeIdx.put(pkey, Buff); SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff> subdictVAccSecIdx; if (dictByVAccSecIdx.containsKey(keyVAccSecIdx)) { subdictVAccSecIdx = dictByVAccSecIdx.get(keyVAccSecIdx); } else { subdictVAccSecIdx = new TreeMap<MSSBamAnyObjPKey, MSSBamValueBuff>(); dictByVAccSecIdx.put(keyVAccSecIdx, subdictVAccSecIdx); } subdictVAccSecIdx.put(pkey, Buff); SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff> subdictVAccFreqIdx; if (dictByVAccFreqIdx.containsKey(keyVAccFreqIdx)) { subdictVAccFreqIdx = dictByVAccFreqIdx.get(keyVAccFreqIdx); } else { subdictVAccFreqIdx = new TreeMap<MSSBamAnyObjPKey, MSSBamValueBuff>(); dictByVAccFreqIdx.put(keyVAccFreqIdx, subdictVAccFreqIdx); } subdictVAccFreqIdx.put(pkey, Buff); SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff> subdictEAccSecIdx; if (dictByEAccSecIdx.containsKey(keyEAccSecIdx)) { subdictEAccSecIdx = dictByEAccSecIdx.get(keyEAccSecIdx); } else { subdictEAccSecIdx = new TreeMap<MSSBamAnyObjPKey, MSSBamValueBuff>(); dictByEAccSecIdx.put(keyEAccSecIdx, subdictEAccSecIdx); } subdictEAccSecIdx.put(pkey, Buff); SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff> subdictEAccFreqIdx; if (dictByEAccFreqIdx.containsKey(keyEAccFreqIdx)) { subdictEAccFreqIdx = dictByEAccFreqIdx.get(keyEAccFreqIdx); } else { subdictEAccFreqIdx = new TreeMap<MSSBamAnyObjPKey, MSSBamValueBuff>(); dictByEAccFreqIdx.put(keyEAccFreqIdx, subdictEAccFreqIdx); } subdictEAccFreqIdx.put(pkey, Buff); SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff> subdictPrevIdx; if (dictByPrevIdx.containsKey(keyPrevIdx)) { subdictPrevIdx = dictByPrevIdx.get(keyPrevIdx); } else { subdictPrevIdx = new TreeMap<MSSBamAnyObjPKey, MSSBamValueBuff>(); dictByPrevIdx.put(keyPrevIdx, subdictPrevIdx); } subdictPrevIdx.put(pkey, Buff); SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff> subdictNextIdx; if (dictByNextIdx.containsKey(keyNextIdx)) { subdictNextIdx = dictByNextIdx.get(keyNextIdx); } else { subdictNextIdx = new TreeMap<MSSBamAnyObjPKey, MSSBamValueBuff>(); dictByNextIdx.put(keyNextIdx, subdictNextIdx); } subdictNextIdx.put(pkey, Buff); SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff> subdictContPrevIdx; if (dictByContPrevIdx.containsKey(keyContPrevIdx)) { subdictContPrevIdx = dictByContPrevIdx.get(keyContPrevIdx); } else { subdictContPrevIdx = new TreeMap<MSSBamAnyObjPKey, MSSBamValueBuff>(); dictByContPrevIdx.put(keyContPrevIdx, subdictContPrevIdx); } subdictContPrevIdx.put(pkey, Buff); SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff> subdictContNextIdx; if (dictByContNextIdx.containsKey(keyContNextIdx)) { subdictContNextIdx = dictByContNextIdx.get(keyContNextIdx); } else { subdictContNextIdx = new TreeMap<MSSBamAnyObjPKey, MSSBamValueBuff>(); dictByContNextIdx.put(keyContNextIdx, subdictContNextIdx); } subdictContNextIdx.put(pkey, Buff); } public MSSBamValueBuff readDerived(MSSBamAuthorization Authorization, MSSBamAnyObjPKey PKey) { final String S_ProcName = "MSSBamRamValue.readDerived() "; MSSBamAnyObjPKey key = schema.getFactoryAnyObj().newPKey(); key.setRequiredId(PKey.getRequiredId()); MSSBamValueBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public MSSBamValueBuff[] readAllDerived(MSSBamAuthorization Authorization) { final String S_ProcName = "MSSBamRamValue.readAllDerived() "; MSSBamValueBuff[] retList = new MSSBamValueBuff[dictByPKey.values().size()]; Iterator<MSSBamValueBuff> iter = dictByPKey.values().iterator(); int idx = 0; while (iter.hasNext()) { retList[idx++] = iter.next(); } return (retList); } public MSSBamValueBuff[] readDerivedByTenantIdx(MSSBamAuthorization Authorization, long TenantId) { final String S_ProcName = "MSSBamRamAnyObj.readDerivedByTenantIdx() "; MSSBamAnyObjBuff buffList[] = schema.getTableAnyObj().readDerivedByTenantIdx(Authorization, TenantId); if (buffList == null) { return (null); } else { MSSBamAnyObjBuff buff; ArrayList<MSSBamValueBuff> filteredList = new ArrayList<MSSBamValueBuff>(); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && (buff instanceof MSSBamValueBuff)) { filteredList.add((MSSBamValueBuff) buff); } } return (filteredList.toArray(new MSSBamValueBuff[0])); } } public MSSBamValueBuff[] readDerivedByScopeIdx(MSSBamAuthorization Authorization, Long ScopeId) { final String S_ProcName = "MSSBamRamAnyObj.readDerivedByScopeIdx() "; MSSBamAnyObjBuff buffList[] = schema.getTableAnyObj().readDerivedByScopeIdx(Authorization, ScopeId); if (buffList == null) { return (null); } else { MSSBamAnyObjBuff buff; ArrayList<MSSBamValueBuff> filteredList = new ArrayList<MSSBamValueBuff>(); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && (buff instanceof MSSBamValueBuff)) { filteredList.add((MSSBamValueBuff) buff); } } return (filteredList.toArray(new MSSBamValueBuff[0])); } } public MSSBamValueBuff[] readDerivedByAuthorIdx(MSSBamAuthorization Authorization, Long AuthorId) { final String S_ProcName = "MSSBamRamAnyObj.readDerivedByAuthorIdx() "; MSSBamAnyObjBuff buffList[] = schema.getTableAnyObj().readDerivedByAuthorIdx(Authorization, AuthorId); if (buffList == null) { return (null); } else { MSSBamAnyObjBuff buff; ArrayList<MSSBamValueBuff> filteredList = new ArrayList<MSSBamValueBuff>(); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && (buff instanceof MSSBamValueBuff)) { filteredList.add((MSSBamValueBuff) buff); } } return (filteredList.toArray(new MSSBamValueBuff[0])); } } public MSSBamValueBuff readDerivedByUNameIdx(MSSBamAuthorization Authorization, Long ScopeId, String Name) { final String S_ProcName = "MSSBamRamAnyObj.readDerivedByUNameIdx() "; MSSBamAnyObjBuff buff = schema.getTableAnyObj().readDerivedByUNameIdx(Authorization, ScopeId, Name); if (buff == null) { return (null); } else if (buff instanceof MSSBamValueBuff) { return ((MSSBamValueBuff) buff); } else { return (null); } } public MSSBamValueBuff[] readDerivedByVContIdx(MSSBamAuthorization Authorization, long ValueContainerId) { final String S_ProcName = "MSSBamRamValue.readDerivedByVContIdx() "; MSSBamValueByVContIdxKey key = schema.getFactoryValue().newVContIdxKey(); key.setRequiredValueContainerId(ValueContainerId); MSSBamValueBuff[] recArray; if (dictByVContIdx.containsKey(key)) { SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff> subdictVContIdx = dictByVContIdx.get(key); recArray = new MSSBamValueBuff[subdictVContIdx.size()]; Iterator<MSSBamValueBuff> iter = subdictVContIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new MSSBamValueBuff[0]; } return (recArray); } public MSSBamValueBuff[] readDerivedByDataScopeIdx(MSSBamAuthorization Authorization, Short DataScopeId) { final String S_ProcName = "MSSBamRamValue.readDerivedByDataScopeIdx() "; MSSBamValueByDataScopeIdxKey key = schema.getFactoryValue().newDataScopeIdxKey(); key.setOptionalDataScopeId(DataScopeId); MSSBamValueBuff[] recArray; if (dictByDataScopeIdx.containsKey(key)) { SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff> subdictDataScopeIdx = dictByDataScopeIdx.get(key); recArray = new MSSBamValueBuff[subdictDataScopeIdx.size()]; Iterator<MSSBamValueBuff> iter = subdictDataScopeIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new MSSBamValueBuff[0]; } return (recArray); } public MSSBamValueBuff[] readDerivedByVAccSecIdx(MSSBamAuthorization Authorization, Short ViewAccessSecurityId) { final String S_ProcName = "MSSBamRamValue.readDerivedByVAccSecIdx() "; MSSBamValueByVAccSecIdxKey key = schema.getFactoryValue().newVAccSecIdxKey(); key.setOptionalViewAccessSecurityId(ViewAccessSecurityId); MSSBamValueBuff[] recArray; if (dictByVAccSecIdx.containsKey(key)) { SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff> subdictVAccSecIdx = dictByVAccSecIdx.get(key); recArray = new MSSBamValueBuff[subdictVAccSecIdx.size()]; Iterator<MSSBamValueBuff> iter = subdictVAccSecIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new MSSBamValueBuff[0]; } return (recArray); } public MSSBamValueBuff[] readDerivedByVAccFreqIdx(MSSBamAuthorization Authorization, Short ViewAccessFrequencyId) { final String S_ProcName = "MSSBamRamValue.readDerivedByVAccFreqIdx() "; MSSBamValueByVAccFreqIdxKey key = schema.getFactoryValue().newVAccFreqIdxKey(); key.setOptionalViewAccessFrequencyId(ViewAccessFrequencyId); MSSBamValueBuff[] recArray; if (dictByVAccFreqIdx.containsKey(key)) { SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff> subdictVAccFreqIdx = dictByVAccFreqIdx.get(key); recArray = new MSSBamValueBuff[subdictVAccFreqIdx.size()]; Iterator<MSSBamValueBuff> iter = subdictVAccFreqIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new MSSBamValueBuff[0]; } return (recArray); } public MSSBamValueBuff[] readDerivedByEAccSecIdx(MSSBamAuthorization Authorization, Short EditAccessSecurityId) { final String S_ProcName = "MSSBamRamValue.readDerivedByEAccSecIdx() "; MSSBamValueByEAccSecIdxKey key = schema.getFactoryValue().newEAccSecIdxKey(); key.setOptionalEditAccessSecurityId(EditAccessSecurityId); MSSBamValueBuff[] recArray; if (dictByEAccSecIdx.containsKey(key)) { SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff> subdictEAccSecIdx = dictByEAccSecIdx.get(key); recArray = new MSSBamValueBuff[subdictEAccSecIdx.size()]; Iterator<MSSBamValueBuff> iter = subdictEAccSecIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new MSSBamValueBuff[0]; } return (recArray); } public MSSBamValueBuff[] readDerivedByEAccFreqIdx(MSSBamAuthorization Authorization, Short EditAccessFrequencyId) { final String S_ProcName = "MSSBamRamValue.readDerivedByEAccFreqIdx() "; MSSBamValueByEAccFreqIdxKey key = schema.getFactoryValue().newEAccFreqIdxKey(); key.setOptionalEditAccessFrequencyId(EditAccessFrequencyId); MSSBamValueBuff[] recArray; if (dictByEAccFreqIdx.containsKey(key)) { SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff> subdictEAccFreqIdx = dictByEAccFreqIdx.get(key); recArray = new MSSBamValueBuff[subdictEAccFreqIdx.size()]; Iterator<MSSBamValueBuff> iter = subdictEAccFreqIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new MSSBamValueBuff[0]; } return (recArray); } public MSSBamValueBuff[] readDerivedByPrevIdx(MSSBamAuthorization Authorization, Long PrevId) { final String S_ProcName = "MSSBamRamValue.readDerivedByPrevIdx() "; MSSBamValueByPrevIdxKey key = schema.getFactoryValue().newPrevIdxKey(); key.setOptionalPrevId(PrevId); MSSBamValueBuff[] recArray; if (dictByPrevIdx.containsKey(key)) { SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff> subdictPrevIdx = dictByPrevIdx.get(key); recArray = new MSSBamValueBuff[subdictPrevIdx.size()]; Iterator<MSSBamValueBuff> iter = subdictPrevIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new MSSBamValueBuff[0]; } return (recArray); } public MSSBamValueBuff[] readDerivedByNextIdx(MSSBamAuthorization Authorization, Long NextId) { final String S_ProcName = "MSSBamRamValue.readDerivedByNextIdx() "; MSSBamValueByNextIdxKey key = schema.getFactoryValue().newNextIdxKey(); key.setOptionalNextId(NextId); MSSBamValueBuff[] recArray; if (dictByNextIdx.containsKey(key)) { SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff> subdictNextIdx = dictByNextIdx.get(key); recArray = new MSSBamValueBuff[subdictNextIdx.size()]; Iterator<MSSBamValueBuff> iter = subdictNextIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new MSSBamValueBuff[0]; } return (recArray); } public MSSBamValueBuff[] readDerivedByContPrevIdx(MSSBamAuthorization Authorization, long ValueContainerId, Long PrevId) { final String S_ProcName = "MSSBamRamValue.readDerivedByContPrevIdx() "; MSSBamValueByContPrevIdxKey key = schema.getFactoryValue().newContPrevIdxKey(); key.setRequiredValueContainerId(ValueContainerId); key.setOptionalPrevId(PrevId); MSSBamValueBuff[] recArray; if (dictByContPrevIdx.containsKey(key)) { SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff> subdictContPrevIdx = dictByContPrevIdx.get(key); recArray = new MSSBamValueBuff[subdictContPrevIdx.size()]; Iterator<MSSBamValueBuff> iter = subdictContPrevIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new MSSBamValueBuff[0]; } return (recArray); } public MSSBamValueBuff[] readDerivedByContNextIdx(MSSBamAuthorization Authorization, long ValueContainerId, Long NextId) { final String S_ProcName = "MSSBamRamValue.readDerivedByContNextIdx() "; MSSBamValueByContNextIdxKey key = schema.getFactoryValue().newContNextIdxKey(); key.setRequiredValueContainerId(ValueContainerId); key.setOptionalNextId(NextId); MSSBamValueBuff[] recArray; if (dictByContNextIdx.containsKey(key)) { SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff> subdictContNextIdx = dictByContNextIdx.get(key); recArray = new MSSBamValueBuff[subdictContNextIdx.size()]; Iterator<MSSBamValueBuff> iter = subdictContNextIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new MSSBamValueBuff[0]; } return (recArray); } public MSSBamValueBuff readDerivedByIdIdx(MSSBamAuthorization Authorization, long Id) { final String S_ProcName = "MSSBamRamAnyObj.readDerivedByIdIdx() "; MSSBamAnyObjPKey key = schema.getFactoryAnyObj().newPKey(); key.setRequiredId(Id); MSSBamValueBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public MSSBamValueBuff readBuff(MSSBamAuthorization Authorization, MSSBamAnyObjPKey PKey) { final String S_ProcName = "MSSBamRamValue.readBuff() "; MSSBamValueBuff buff = readDerived(Authorization, PKey); if ((buff != null) && (!buff.getClassCode().equals("VAL"))) { buff = null; } return (buff); } public MSSBamValueBuff[] readAllBuff(MSSBamAuthorization Authorization) { final String S_ProcName = "MSSBamRamValue.readAllBuff() "; MSSBamValueBuff buff; ArrayList<MSSBamValueBuff> filteredList = new ArrayList<MSSBamValueBuff>(); MSSBamValueBuff[] buffList = readAllDerived(Authorization); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("VAL")) { filteredList.add(buff); } } return (filteredList.toArray(new MSSBamValueBuff[0])); } public MSSBamValueBuff readBuffByIdIdx(MSSBamAuthorization Authorization, long Id) { final String S_ProcName = "MSSBamRamAnyObj.readBuffByIdIdx() "; MSSBamAnyObjBuff buff = readDerivedByIdIdx(Authorization, Id); if ((buff != null) && buff.getClassCode().equals("ANYO")) { return ((MSSBamValueBuff) buff); } else { return (null); } } public MSSBamValueBuff[] readBuffByTenantIdx(MSSBamAuthorization Authorization, long TenantId) { final String S_ProcName = "MSSBamRamAnyObj.readBuffByTenantIdx() "; MSSBamAnyObjBuff buff; ArrayList<MSSBamValueBuff> filteredList = new ArrayList<MSSBamValueBuff>(); MSSBamAnyObjBuff[] buffList = readDerivedByTenantIdx(Authorization, TenantId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("ANYO")) { filteredList.add((MSSBamValueBuff) buff); } } return (filteredList.toArray(new MSSBamValueBuff[0])); } public MSSBamValueBuff[] readBuffByScopeIdx(MSSBamAuthorization Authorization, Long ScopeId) { final String S_ProcName = "MSSBamRamAnyObj.readBuffByScopeIdx() "; MSSBamAnyObjBuff buff; ArrayList<MSSBamValueBuff> filteredList = new ArrayList<MSSBamValueBuff>(); MSSBamAnyObjBuff[] buffList = readDerivedByScopeIdx(Authorization, ScopeId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("ANYO")) { filteredList.add((MSSBamValueBuff) buff); } } return (filteredList.toArray(new MSSBamValueBuff[0])); } public MSSBamValueBuff[] readBuffByAuthorIdx(MSSBamAuthorization Authorization, Long AuthorId) { final String S_ProcName = "MSSBamRamAnyObj.readBuffByAuthorIdx() "; MSSBamAnyObjBuff buff; ArrayList<MSSBamValueBuff> filteredList = new ArrayList<MSSBamValueBuff>(); MSSBamAnyObjBuff[] buffList = readDerivedByAuthorIdx(Authorization, AuthorId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("ANYO")) { filteredList.add((MSSBamValueBuff) buff); } } return (filteredList.toArray(new MSSBamValueBuff[0])); } public MSSBamValueBuff readBuffByUNameIdx(MSSBamAuthorization Authorization, Long ScopeId, String Name) { final String S_ProcName = "MSSBamRamAnyObj.readBuffByUNameIdx() "; MSSBamAnyObjBuff buff = readDerivedByUNameIdx(Authorization, ScopeId, Name); if ((buff != null) && buff.getClassCode().equals("ANYO")) { return ((MSSBamValueBuff) buff); } else { return (null); } } public MSSBamValueBuff[] readBuffByVContIdx(MSSBamAuthorization Authorization, long ValueContainerId) { final String S_ProcName = "MSSBamRamValue.readBuffByVContIdx() "; MSSBamValueBuff buff; ArrayList<MSSBamValueBuff> filteredList = new ArrayList<MSSBamValueBuff>(); MSSBamValueBuff[] buffList = readDerivedByVContIdx(Authorization, ValueContainerId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("VAL")) { filteredList.add((MSSBamValueBuff) buff); } } return (filteredList.toArray(new MSSBamValueBuff[0])); } public MSSBamValueBuff[] readBuffByDataScopeIdx(MSSBamAuthorization Authorization, Short DataScopeId) { final String S_ProcName = "MSSBamRamValue.readBuffByDataScopeIdx() "; MSSBamValueBuff buff; ArrayList<MSSBamValueBuff> filteredList = new ArrayList<MSSBamValueBuff>(); MSSBamValueBuff[] buffList = readDerivedByDataScopeIdx(Authorization, DataScopeId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("VAL")) { filteredList.add((MSSBamValueBuff) buff); } } return (filteredList.toArray(new MSSBamValueBuff[0])); } public MSSBamValueBuff[] readBuffByVAccSecIdx(MSSBamAuthorization Authorization, Short ViewAccessSecurityId) { final String S_ProcName = "MSSBamRamValue.readBuffByVAccSecIdx() "; MSSBamValueBuff buff; ArrayList<MSSBamValueBuff> filteredList = new ArrayList<MSSBamValueBuff>(); MSSBamValueBuff[] buffList = readDerivedByVAccSecIdx(Authorization, ViewAccessSecurityId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("VAL")) { filteredList.add((MSSBamValueBuff) buff); } } return (filteredList.toArray(new MSSBamValueBuff[0])); } public MSSBamValueBuff[] readBuffByVAccFreqIdx(MSSBamAuthorization Authorization, Short ViewAccessFrequencyId) { final String S_ProcName = "MSSBamRamValue.readBuffByVAccFreqIdx() "; MSSBamValueBuff buff; ArrayList<MSSBamValueBuff> filteredList = new ArrayList<MSSBamValueBuff>(); MSSBamValueBuff[] buffList = readDerivedByVAccFreqIdx(Authorization, ViewAccessFrequencyId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("VAL")) { filteredList.add((MSSBamValueBuff) buff); } } return (filteredList.toArray(new MSSBamValueBuff[0])); } public MSSBamValueBuff[] readBuffByEAccSecIdx(MSSBamAuthorization Authorization, Short EditAccessSecurityId) { final String S_ProcName = "MSSBamRamValue.readBuffByEAccSecIdx() "; MSSBamValueBuff buff; ArrayList<MSSBamValueBuff> filteredList = new ArrayList<MSSBamValueBuff>(); MSSBamValueBuff[] buffList = readDerivedByEAccSecIdx(Authorization, EditAccessSecurityId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("VAL")) { filteredList.add((MSSBamValueBuff) buff); } } return (filteredList.toArray(new MSSBamValueBuff[0])); } public MSSBamValueBuff[] readBuffByEAccFreqIdx(MSSBamAuthorization Authorization, Short EditAccessFrequencyId) { final String S_ProcName = "MSSBamRamValue.readBuffByEAccFreqIdx() "; MSSBamValueBuff buff; ArrayList<MSSBamValueBuff> filteredList = new ArrayList<MSSBamValueBuff>(); MSSBamValueBuff[] buffList = readDerivedByEAccFreqIdx(Authorization, EditAccessFrequencyId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("VAL")) { filteredList.add((MSSBamValueBuff) buff); } } return (filteredList.toArray(new MSSBamValueBuff[0])); } public MSSBamValueBuff[] readBuffByPrevIdx(MSSBamAuthorization Authorization, Long PrevId) { final String S_ProcName = "MSSBamRamValue.readBuffByPrevIdx() "; MSSBamValueBuff buff; ArrayList<MSSBamValueBuff> filteredList = new ArrayList<MSSBamValueBuff>(); MSSBamValueBuff[] buffList = readDerivedByPrevIdx(Authorization, PrevId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("VAL")) { filteredList.add((MSSBamValueBuff) buff); } } return (filteredList.toArray(new MSSBamValueBuff[0])); } public MSSBamValueBuff[] readBuffByNextIdx(MSSBamAuthorization Authorization, Long NextId) { final String S_ProcName = "MSSBamRamValue.readBuffByNextIdx() "; MSSBamValueBuff buff; ArrayList<MSSBamValueBuff> filteredList = new ArrayList<MSSBamValueBuff>(); MSSBamValueBuff[] buffList = readDerivedByNextIdx(Authorization, NextId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("VAL")) { filteredList.add((MSSBamValueBuff) buff); } } return (filteredList.toArray(new MSSBamValueBuff[0])); } public MSSBamValueBuff[] readBuffByContPrevIdx(MSSBamAuthorization Authorization, long ValueContainerId, Long PrevId) { final String S_ProcName = "MSSBamRamValue.readBuffByContPrevIdx() "; MSSBamValueBuff buff; ArrayList<MSSBamValueBuff> filteredList = new ArrayList<MSSBamValueBuff>(); MSSBamValueBuff[] buffList = readDerivedByContPrevIdx(Authorization, ValueContainerId, PrevId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("VAL")) { filteredList.add((MSSBamValueBuff) buff); } } return (filteredList.toArray(new MSSBamValueBuff[0])); } public MSSBamValueBuff[] readBuffByContNextIdx(MSSBamAuthorization Authorization, long ValueContainerId, Long NextId) { final String S_ProcName = "MSSBamRamValue.readBuffByContNextIdx() "; MSSBamValueBuff buff; ArrayList<MSSBamValueBuff> filteredList = new ArrayList<MSSBamValueBuff>(); MSSBamValueBuff[] buffList = readDerivedByContNextIdx(Authorization, ValueContainerId, NextId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("VAL")) { filteredList.add((MSSBamValueBuff) buff); } } return (filteredList.toArray(new MSSBamValueBuff[0])); } public void updateValue(MSSBamAuthorization Authorization, MSSBamValueBuff Buff) { MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey(); pkey.setRequiredId(Buff.getRequiredId()); MSSBamValueBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateValue", "Existing record not found", "Value", pkey); } MSSBamValueByVContIdxKey existingKeyVContIdx = schema.getFactoryValue().newVContIdxKey(); existingKeyVContIdx.setRequiredValueContainerId(existing.getRequiredValueContainerId()); MSSBamValueByVContIdxKey newKeyVContIdx = schema.getFactoryValue().newVContIdxKey(); newKeyVContIdx.setRequiredValueContainerId(Buff.getRequiredValueContainerId()); MSSBamValueByDataScopeIdxKey existingKeyDataScopeIdx = schema.getFactoryValue().newDataScopeIdxKey(); existingKeyDataScopeIdx.setOptionalDataScopeId(existing.getOptionalDataScopeId()); MSSBamValueByDataScopeIdxKey newKeyDataScopeIdx = schema.getFactoryValue().newDataScopeIdxKey(); newKeyDataScopeIdx.setOptionalDataScopeId(Buff.getOptionalDataScopeId()); MSSBamValueByVAccSecIdxKey existingKeyVAccSecIdx = schema.getFactoryValue().newVAccSecIdxKey(); existingKeyVAccSecIdx.setOptionalViewAccessSecurityId(existing.getOptionalViewAccessSecurityId()); MSSBamValueByVAccSecIdxKey newKeyVAccSecIdx = schema.getFactoryValue().newVAccSecIdxKey(); newKeyVAccSecIdx.setOptionalViewAccessSecurityId(Buff.getOptionalViewAccessSecurityId()); MSSBamValueByVAccFreqIdxKey existingKeyVAccFreqIdx = schema.getFactoryValue().newVAccFreqIdxKey(); existingKeyVAccFreqIdx.setOptionalViewAccessFrequencyId(existing.getOptionalViewAccessFrequencyId()); MSSBamValueByVAccFreqIdxKey newKeyVAccFreqIdx = schema.getFactoryValue().newVAccFreqIdxKey(); newKeyVAccFreqIdx.setOptionalViewAccessFrequencyId(Buff.getOptionalViewAccessFrequencyId()); MSSBamValueByEAccSecIdxKey existingKeyEAccSecIdx = schema.getFactoryValue().newEAccSecIdxKey(); existingKeyEAccSecIdx.setOptionalEditAccessSecurityId(existing.getOptionalEditAccessSecurityId()); MSSBamValueByEAccSecIdxKey newKeyEAccSecIdx = schema.getFactoryValue().newEAccSecIdxKey(); newKeyEAccSecIdx.setOptionalEditAccessSecurityId(Buff.getOptionalEditAccessSecurityId()); MSSBamValueByEAccFreqIdxKey existingKeyEAccFreqIdx = schema.getFactoryValue().newEAccFreqIdxKey(); existingKeyEAccFreqIdx.setOptionalEditAccessFrequencyId(existing.getOptionalEditAccessFrequencyId()); MSSBamValueByEAccFreqIdxKey newKeyEAccFreqIdx = schema.getFactoryValue().newEAccFreqIdxKey(); newKeyEAccFreqIdx.setOptionalEditAccessFrequencyId(Buff.getOptionalEditAccessFrequencyId()); MSSBamValueByPrevIdxKey existingKeyPrevIdx = schema.getFactoryValue().newPrevIdxKey(); existingKeyPrevIdx.setOptionalPrevId(existing.getOptionalPrevId()); MSSBamValueByPrevIdxKey newKeyPrevIdx = schema.getFactoryValue().newPrevIdxKey(); newKeyPrevIdx.setOptionalPrevId(Buff.getOptionalPrevId()); MSSBamValueByNextIdxKey existingKeyNextIdx = schema.getFactoryValue().newNextIdxKey(); existingKeyNextIdx.setOptionalNextId(existing.getOptionalNextId()); MSSBamValueByNextIdxKey newKeyNextIdx = schema.getFactoryValue().newNextIdxKey(); newKeyNextIdx.setOptionalNextId(Buff.getOptionalNextId()); MSSBamValueByContPrevIdxKey existingKeyContPrevIdx = schema.getFactoryValue().newContPrevIdxKey(); existingKeyContPrevIdx.setRequiredValueContainerId(existing.getRequiredValueContainerId()); existingKeyContPrevIdx.setOptionalPrevId(existing.getOptionalPrevId()); MSSBamValueByContPrevIdxKey newKeyContPrevIdx = schema.getFactoryValue().newContPrevIdxKey(); newKeyContPrevIdx.setRequiredValueContainerId(Buff.getRequiredValueContainerId()); newKeyContPrevIdx.setOptionalPrevId(Buff.getOptionalPrevId()); MSSBamValueByContNextIdxKey existingKeyContNextIdx = schema.getFactoryValue().newContNextIdxKey(); existingKeyContNextIdx.setRequiredValueContainerId(existing.getRequiredValueContainerId()); existingKeyContNextIdx.setOptionalNextId(existing.getOptionalNextId()); MSSBamValueByContNextIdxKey newKeyContNextIdx = schema.getFactoryValue().newContNextIdxKey(); newKeyContNextIdx.setRequiredValueContainerId(Buff.getRequiredValueContainerId()); newKeyContNextIdx.setOptionalNextId(Buff.getOptionalNextId()); // Check unique indexes // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema.getTableScope().readDerivedByIdIdx(Authorization, Buff.getRequiredId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateValue", "Superclass", "SuperClass", "Scope", null); } } } { boolean allNull = true; if (allNull) { if (null == schema.getTableScope().readDerivedByIdIdx(Authorization, Buff.getRequiredValueContainerId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateValue", "Container", "ValueContainer", "Scope", null); } } } // Update is valid SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); subdict = dictByVContIdx.get(existingKeyVContIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByVContIdx.containsKey(newKeyVContIdx)) { subdict = dictByVContIdx.get(newKeyVContIdx); } else { subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamValueBuff>(); dictByVContIdx.put(newKeyVContIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByDataScopeIdx.get(existingKeyDataScopeIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByDataScopeIdx.containsKey(newKeyDataScopeIdx)) { subdict = dictByDataScopeIdx.get(newKeyDataScopeIdx); } else { subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamValueBuff>(); dictByDataScopeIdx.put(newKeyDataScopeIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByVAccSecIdx.get(existingKeyVAccSecIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByVAccSecIdx.containsKey(newKeyVAccSecIdx)) { subdict = dictByVAccSecIdx.get(newKeyVAccSecIdx); } else { subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamValueBuff>(); dictByVAccSecIdx.put(newKeyVAccSecIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByVAccFreqIdx.get(existingKeyVAccFreqIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByVAccFreqIdx.containsKey(newKeyVAccFreqIdx)) { subdict = dictByVAccFreqIdx.get(newKeyVAccFreqIdx); } else { subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamValueBuff>(); dictByVAccFreqIdx.put(newKeyVAccFreqIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByEAccSecIdx.get(existingKeyEAccSecIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByEAccSecIdx.containsKey(newKeyEAccSecIdx)) { subdict = dictByEAccSecIdx.get(newKeyEAccSecIdx); } else { subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamValueBuff>(); dictByEAccSecIdx.put(newKeyEAccSecIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByEAccFreqIdx.get(existingKeyEAccFreqIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByEAccFreqIdx.containsKey(newKeyEAccFreqIdx)) { subdict = dictByEAccFreqIdx.get(newKeyEAccFreqIdx); } else { subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamValueBuff>(); dictByEAccFreqIdx.put(newKeyEAccFreqIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByPrevIdx.get(existingKeyPrevIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByPrevIdx.containsKey(newKeyPrevIdx)) { subdict = dictByPrevIdx.get(newKeyPrevIdx); } else { subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamValueBuff>(); dictByPrevIdx.put(newKeyPrevIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByNextIdx.get(existingKeyNextIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByNextIdx.containsKey(newKeyNextIdx)) { subdict = dictByNextIdx.get(newKeyNextIdx); } else { subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamValueBuff>(); dictByNextIdx.put(newKeyNextIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByContPrevIdx.get(existingKeyContPrevIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByContPrevIdx.containsKey(newKeyContPrevIdx)) { subdict = dictByContPrevIdx.get(newKeyContPrevIdx); } else { subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamValueBuff>(); dictByContPrevIdx.put(newKeyContPrevIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByContNextIdx.get(existingKeyContNextIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByContNextIdx.containsKey(newKeyContNextIdx)) { subdict = dictByContNextIdx.get(newKeyContNextIdx); } else { subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamValueBuff>(); dictByContNextIdx.put(newKeyContNextIdx, subdict); } subdict.put(pkey, Buff); } public void deleteValue(MSSBamAuthorization Authorization, MSSBamValueBuff Buff) { final String S_ProcName = "MSSBamRamValueTable.deleteValue() "; MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey(); pkey.setRequiredId(schema.nextAnyObjIdGen()); MSSBamValueBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteValue", "Existing record not found", "Value", pkey); } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteValue", pkey); } MSSBamValueByVContIdxKey keyVContIdx = schema.getFactoryValue().newVContIdxKey(); keyVContIdx.setRequiredValueContainerId(existing.getRequiredValueContainerId()); MSSBamValueByDataScopeIdxKey keyDataScopeIdx = schema.getFactoryValue().newDataScopeIdxKey(); keyDataScopeIdx.setOptionalDataScopeId(existing.getOptionalDataScopeId()); MSSBamValueByVAccSecIdxKey keyVAccSecIdx = schema.getFactoryValue().newVAccSecIdxKey(); keyVAccSecIdx.setOptionalViewAccessSecurityId(existing.getOptionalViewAccessSecurityId()); MSSBamValueByVAccFreqIdxKey keyVAccFreqIdx = schema.getFactoryValue().newVAccFreqIdxKey(); keyVAccFreqIdx.setOptionalViewAccessFrequencyId(existing.getOptionalViewAccessFrequencyId()); MSSBamValueByEAccSecIdxKey keyEAccSecIdx = schema.getFactoryValue().newEAccSecIdxKey(); keyEAccSecIdx.setOptionalEditAccessSecurityId(existing.getOptionalEditAccessSecurityId()); MSSBamValueByEAccFreqIdxKey keyEAccFreqIdx = schema.getFactoryValue().newEAccFreqIdxKey(); keyEAccFreqIdx.setOptionalEditAccessFrequencyId(existing.getOptionalEditAccessFrequencyId()); MSSBamValueByPrevIdxKey keyPrevIdx = schema.getFactoryValue().newPrevIdxKey(); keyPrevIdx.setOptionalPrevId(existing.getOptionalPrevId()); MSSBamValueByNextIdxKey keyNextIdx = schema.getFactoryValue().newNextIdxKey(); keyNextIdx.setOptionalNextId(existing.getOptionalNextId()); MSSBamValueByContPrevIdxKey keyContPrevIdx = schema.getFactoryValue().newContPrevIdxKey(); keyContPrevIdx.setRequiredValueContainerId(existing.getRequiredValueContainerId()); keyContPrevIdx.setOptionalPrevId(existing.getOptionalPrevId()); MSSBamValueByContNextIdxKey keyContNextIdx = schema.getFactoryValue().newContNextIdxKey(); keyContNextIdx.setRequiredValueContainerId(existing.getRequiredValueContainerId()); keyContNextIdx.setOptionalNextId(existing.getOptionalNextId()); // Validate reverse foreign keys if (schema.getTableAtomDef().readDerivedByIdIdx(Authorization, existing.getRequiredId()) != null) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteValue", "Superclass", "SuperClass", "AtomDef", pkey); } if (schema.getTableTableCol().readDerivedByIdIdx(Authorization, existing.getRequiredId()) != null) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteValue", "Superclass", "SuperClass", "TableCol", pkey); } if (schema.getTableIndexCol().readDerivedByColIdx(Authorization, existing.getRequiredId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteValue", "Lookup", "Column", "IndexCol", pkey); } if (schema.getTableRelationCol().readDerivedByFromColIdx(Authorization, existing.getRequiredId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteValue", "Lookup", "LookupFromCol", "RelationCol", pkey); } if (schema.getTableRelationCol().readDerivedByToColIdx(Authorization, existing.getRequiredId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteValue", "Lookup", "LookupToCol", "RelationCol", pkey); } // Delete is valid SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff> subdict; dictByPKey.remove(pkey); subdict = dictByVContIdx.get(keyVContIdx); subdict.remove(pkey); subdict = dictByDataScopeIdx.get(keyDataScopeIdx); subdict.remove(pkey); subdict = dictByVAccSecIdx.get(keyVAccSecIdx); subdict.remove(pkey); subdict = dictByVAccFreqIdx.get(keyVAccFreqIdx); subdict.remove(pkey); subdict = dictByEAccSecIdx.get(keyEAccSecIdx); subdict.remove(pkey); subdict = dictByEAccFreqIdx.get(keyEAccFreqIdx); subdict.remove(pkey); subdict = dictByPrevIdx.get(keyPrevIdx); subdict.remove(pkey); subdict = dictByNextIdx.get(keyNextIdx); subdict.remove(pkey); subdict = dictByContPrevIdx.get(keyContPrevIdx); subdict.remove(pkey); subdict = dictByContNextIdx.get(keyContNextIdx); subdict.remove(pkey); } public MSSBamCursor openValueCursorAll(MSSBamAuthorization Authorization) { MSSBamCursor cursor = new MSSBamRamValueCursor(Authorization, schema, dictByPKey.values()); return (cursor); } public MSSBamCursor openValueCursorByVContIdx(MSSBamAuthorization Authorization, long ValueContainerId) { MSSBamCursor cursor; MSSBamValueByVContIdxKey key = schema.getFactoryValue().newVContIdxKey(); key.setRequiredValueContainerId(ValueContainerId); if (dictByVContIdx.containsKey(key)) { SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff> subdictVContIdx = dictByVContIdx.get(key); cursor = new MSSBamRamValueCursor(Authorization, schema, subdictVContIdx.values()); } else { cursor = new MSSBamRamValueCursor(Authorization, schema, new ArrayList<MSSBamValueBuff>()); } return (cursor); } public MSSBamCursor openValueCursorByDataScopeIdx(MSSBamAuthorization Authorization, Short DataScopeId) { MSSBamCursor cursor; MSSBamValueByDataScopeIdxKey key = schema.getFactoryValue().newDataScopeIdxKey(); key.setOptionalDataScopeId(DataScopeId); if (dictByDataScopeIdx.containsKey(key)) { SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff> subdictDataScopeIdx = dictByDataScopeIdx.get(key); cursor = new MSSBamRamValueCursor(Authorization, schema, subdictDataScopeIdx.values()); } else { cursor = new MSSBamRamValueCursor(Authorization, schema, new ArrayList<MSSBamValueBuff>()); } return (cursor); } public MSSBamCursor openValueCursorByVAccSecIdx(MSSBamAuthorization Authorization, Short ViewAccessSecurityId) { MSSBamCursor cursor; MSSBamValueByVAccSecIdxKey key = schema.getFactoryValue().newVAccSecIdxKey(); key.setOptionalViewAccessSecurityId(ViewAccessSecurityId); if (dictByVAccSecIdx.containsKey(key)) { SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff> subdictVAccSecIdx = dictByVAccSecIdx.get(key); cursor = new MSSBamRamValueCursor(Authorization, schema, subdictVAccSecIdx.values()); } else { cursor = new MSSBamRamValueCursor(Authorization, schema, new ArrayList<MSSBamValueBuff>()); } return (cursor); } public MSSBamCursor openValueCursorByVAccFreqIdx(MSSBamAuthorization Authorization, Short ViewAccessFrequencyId) { MSSBamCursor cursor; MSSBamValueByVAccFreqIdxKey key = schema.getFactoryValue().newVAccFreqIdxKey(); key.setOptionalViewAccessFrequencyId(ViewAccessFrequencyId); if (dictByVAccFreqIdx.containsKey(key)) { SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff> subdictVAccFreqIdx = dictByVAccFreqIdx.get(key); cursor = new MSSBamRamValueCursor(Authorization, schema, subdictVAccFreqIdx.values()); } else { cursor = new MSSBamRamValueCursor(Authorization, schema, new ArrayList<MSSBamValueBuff>()); } return (cursor); } public MSSBamCursor openValueCursorByEAccSecIdx(MSSBamAuthorization Authorization, Short EditAccessSecurityId) { MSSBamCursor cursor; MSSBamValueByEAccSecIdxKey key = schema.getFactoryValue().newEAccSecIdxKey(); key.setOptionalEditAccessSecurityId(EditAccessSecurityId); if (dictByEAccSecIdx.containsKey(key)) { SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff> subdictEAccSecIdx = dictByEAccSecIdx.get(key); cursor = new MSSBamRamValueCursor(Authorization, schema, subdictEAccSecIdx.values()); } else { cursor = new MSSBamRamValueCursor(Authorization, schema, new ArrayList<MSSBamValueBuff>()); } return (cursor); } public MSSBamCursor openValueCursorByEAccFreqIdx(MSSBamAuthorization Authorization, Short EditAccessFrequencyId) { MSSBamCursor cursor; MSSBamValueByEAccFreqIdxKey key = schema.getFactoryValue().newEAccFreqIdxKey(); key.setOptionalEditAccessFrequencyId(EditAccessFrequencyId); if (dictByEAccFreqIdx.containsKey(key)) { SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff> subdictEAccFreqIdx = dictByEAccFreqIdx.get(key); cursor = new MSSBamRamValueCursor(Authorization, schema, subdictEAccFreqIdx.values()); } else { cursor = new MSSBamRamValueCursor(Authorization, schema, new ArrayList<MSSBamValueBuff>()); } return (cursor); } public MSSBamCursor openValueCursorByPrevIdx(MSSBamAuthorization Authorization, Long PrevId) { MSSBamCursor cursor; MSSBamValueByPrevIdxKey key = schema.getFactoryValue().newPrevIdxKey(); key.setOptionalPrevId(PrevId); if (dictByPrevIdx.containsKey(key)) { SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff> subdictPrevIdx = dictByPrevIdx.get(key); cursor = new MSSBamRamValueCursor(Authorization, schema, subdictPrevIdx.values()); } else { cursor = new MSSBamRamValueCursor(Authorization, schema, new ArrayList<MSSBamValueBuff>()); } return (cursor); } public MSSBamCursor openValueCursorByNextIdx(MSSBamAuthorization Authorization, Long NextId) { MSSBamCursor cursor; MSSBamValueByNextIdxKey key = schema.getFactoryValue().newNextIdxKey(); key.setOptionalNextId(NextId); if (dictByNextIdx.containsKey(key)) { SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff> subdictNextIdx = dictByNextIdx.get(key); cursor = new MSSBamRamValueCursor(Authorization, schema, subdictNextIdx.values()); } else { cursor = new MSSBamRamValueCursor(Authorization, schema, new ArrayList<MSSBamValueBuff>()); } return (cursor); } public MSSBamCursor openValueCursorByContPrevIdx(MSSBamAuthorization Authorization, long ValueContainerId, Long PrevId) { MSSBamCursor cursor; MSSBamValueByContPrevIdxKey key = schema.getFactoryValue().newContPrevIdxKey(); key.setRequiredValueContainerId(ValueContainerId); key.setOptionalPrevId(PrevId); if (dictByContPrevIdx.containsKey(key)) { SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff> subdictContPrevIdx = dictByContPrevIdx.get(key); cursor = new MSSBamRamValueCursor(Authorization, schema, subdictContPrevIdx.values()); } else { cursor = new MSSBamRamValueCursor(Authorization, schema, new ArrayList<MSSBamValueBuff>()); } return (cursor); } public MSSBamCursor openValueCursorByContNextIdx(MSSBamAuthorization Authorization, long ValueContainerId, Long NextId) { MSSBamCursor cursor; MSSBamValueByContNextIdxKey key = schema.getFactoryValue().newContNextIdxKey(); key.setRequiredValueContainerId(ValueContainerId); key.setOptionalNextId(NextId); if (dictByContNextIdx.containsKey(key)) { SortedMap<MSSBamAnyObjPKey, MSSBamValueBuff> subdictContNextIdx = dictByContNextIdx.get(key); cursor = new MSSBamRamValueCursor(Authorization, schema, subdictContNextIdx.values()); } else { cursor = new MSSBamRamValueCursor(Authorization, schema, new ArrayList<MSSBamValueBuff>()); } return (cursor); } public void closeValueCursor(MSSBamCursor Cursor) { // Cursor.DataReader.Close(); } public MSSBamValueBuff nextValueCursor(MSSBamCursor Cursor) { MSSBamRamValueCursor cursor = (MSSBamRamValueCursor) Cursor; MSSBamValueBuff rec = cursor.getCursor().next(); cursor.setRowIdx(cursor.getRowIdx() + 1); return (rec); } public MSSBamValueBuff prevValueCursor(MSSBamCursor Cursor) { int targetRowIdx = (Cursor.getRowIdx() > 1) ? Cursor.getRowIdx() - 1 : 1; MSSBamValueBuff rec = null; if (Cursor.getRowIdx() >= targetRowIdx) { Cursor.reset(); } while (Cursor.getRowIdx() < targetRowIdx) { rec = nextValueCursor(Cursor); } return (rec); } public MSSBamValueBuff firstValueCursor(MSSBamCursor Cursor) { int targetRowIdx = 1; MSSBamValueBuff rec = null; Cursor.reset(); while (Cursor.getRowIdx() < targetRowIdx) { rec = nextValueCursor(Cursor); } return (rec); } public MSSBamValueBuff lastValueCursor(MSSBamCursor Cursor) { throw CFLib.getDefaultExceptionFactory().newNotImplementedYetException(getClass(), "lastValueCursor"); } public MSSBamValueBuff nthValueCursor(MSSBamCursor Cursor, int Idx) { int targetRowIdx = Idx; MSSBamValueBuff rec = null; if (Cursor.getRowIdx() >= targetRowIdx) { Cursor.reset(); } while (Cursor.getRowIdx() < targetRowIdx) { rec = nextValueCursor(Cursor); } return (rec); } }