Java tutorial
// Description: Java6 in-memory RAM DbIO implementation for SchemaNumber. /* * 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.*; /* * MSSBamRamSchemaNumberTable in-memory RAM DbIO implementation * for SchemaNumber. */ public class MSSBamRamSchemaNumberTable implements IMSSBamSchemaNumberTable { private MSSBamBLRamSchema schema; private Map<MSSBamAnyObjPKey, MSSBamSchemaNumberBuff> dictByPKey = new HashMap<MSSBamAnyObjPKey, MSSBamSchemaNumberBuff>(); private SortedMap<MSSBamSchemaNumberByContainerIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamSchemaNumberBuff>> dictByContainerIdx = new TreeMap<MSSBamSchemaNumberByContainerIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamSchemaNumberBuff>>(); public MSSBamRamSchemaNumberTable(MSSBamBLRamSchema argSchema) { schema = argSchema; } public void createSchemaNumber(MSSBamAuthorization Authorization, MSSBamSchemaNumberBuff Buff) { MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey(); pkey.setClassCode(Buff.getClassCode()); pkey.setRequiredId(Buff.getRequiredId()); MSSBamSchemaNumberByContainerIdxKey keyContainerIdx = schema.getFactorySchemaNumber().newContainerIdxKey(); keyContainerIdx.setRequiredContainerId(Buff.getRequiredContainerId()); // Validate unique indexes if (dictByPKey.containsKey(pkey)) { throw CFLib.getDefaultExceptionFactory().newPrimaryKeyNotNewException(getClass(), "createSchemaNumber", pkey); } // Validate foreign keys { boolean allNull = true; allNull = false; if (!allNull) { if (null == schema.getTableNumberDef().readDerivedByIdIdx(Authorization, Buff.getRequiredId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "createSchemaNumber", "Superclass", "SuperClass", "NumberDef", null); } } } { boolean allNull = true; allNull = false; if (!allNull) { if (null == schema.getTableSchemaDef().readDerivedByIdIdx(Authorization, Buff.getRequiredContainerId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "createSchemaNumber", "Container", "CSchema", "SchemaDef", null); } } } // Proceed with adding the new record dictByPKey.put(pkey, Buff); SortedMap<MSSBamAnyObjPKey, MSSBamSchemaNumberBuff> subdictContainerIdx; if (dictByContainerIdx.containsKey(keyContainerIdx)) { subdictContainerIdx = dictByContainerIdx.get(keyContainerIdx); } else { subdictContainerIdx = new TreeMap<MSSBamAnyObjPKey, MSSBamSchemaNumberBuff>(); dictByContainerIdx.put(keyContainerIdx, subdictContainerIdx); } subdictContainerIdx.put(pkey, Buff); } public MSSBamSchemaNumberBuff readDerived(MSSBamAuthorization Authorization, MSSBamAnyObjPKey PKey) { final String S_ProcName = "MSSBamRamSchemaNumber.readDerived() "; MSSBamAnyObjPKey key = schema.getFactoryAnyObj().newPKey(); key.setRequiredId(PKey.getRequiredId()); MSSBamSchemaNumberBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public MSSBamSchemaNumberBuff[] readAllDerived(MSSBamAuthorization Authorization) { final String S_ProcName = "MSSBamRamSchemaNumber.readAllDerived() "; MSSBamSchemaNumberBuff[] retList = new MSSBamSchemaNumberBuff[dictByPKey.values().size()]; Iterator<MSSBamSchemaNumberBuff> iter = dictByPKey.values().iterator(); int idx = 0; while (iter.hasNext()) { retList[idx++] = iter.next(); } return (retList); } public MSSBamSchemaNumberBuff[] 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<MSSBamSchemaNumberBuff> filteredList = new ArrayList<MSSBamSchemaNumberBuff>(); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && (buff instanceof MSSBamSchemaNumberBuff)) { filteredList.add((MSSBamSchemaNumberBuff) buff); } } return (filteredList.toArray(new MSSBamSchemaNumberBuff[0])); } } public MSSBamSchemaNumberBuff[] 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<MSSBamSchemaNumberBuff> filteredList = new ArrayList<MSSBamSchemaNumberBuff>(); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && (buff instanceof MSSBamSchemaNumberBuff)) { filteredList.add((MSSBamSchemaNumberBuff) buff); } } return (filteredList.toArray(new MSSBamSchemaNumberBuff[0])); } } public MSSBamSchemaNumberBuff[] 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<MSSBamSchemaNumberBuff> filteredList = new ArrayList<MSSBamSchemaNumberBuff>(); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && (buff instanceof MSSBamSchemaNumberBuff)) { filteredList.add((MSSBamSchemaNumberBuff) buff); } } return (filteredList.toArray(new MSSBamSchemaNumberBuff[0])); } } public MSSBamSchemaNumberBuff 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 MSSBamSchemaNumberBuff) { return ((MSSBamSchemaNumberBuff) buff); } else { return (null); } } public MSSBamSchemaNumberBuff[] readDerivedByVContIdx(MSSBamAuthorization Authorization, long ValueContainerId) { final String S_ProcName = "MSSBamRamValue.readDerivedByVContIdx() "; MSSBamValueBuff buffList[] = schema.getTableValue().readDerivedByVContIdx(Authorization, ValueContainerId); if (buffList == null) { return (null); } else { MSSBamValueBuff buff; ArrayList<MSSBamSchemaNumberBuff> filteredList = new ArrayList<MSSBamSchemaNumberBuff>(); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && (buff instanceof MSSBamSchemaNumberBuff)) { filteredList.add((MSSBamSchemaNumberBuff) buff); } } return (filteredList.toArray(new MSSBamSchemaNumberBuff[0])); } } public MSSBamSchemaNumberBuff[] readDerivedByDataScopeIdx(MSSBamAuthorization Authorization, Short DataScopeId) { final String S_ProcName = "MSSBamRamValue.readDerivedByDataScopeIdx() "; MSSBamValueBuff buffList[] = schema.getTableValue().readDerivedByDataScopeIdx(Authorization, DataScopeId); if (buffList == null) { return (null); } else { MSSBamValueBuff buff; ArrayList<MSSBamSchemaNumberBuff> filteredList = new ArrayList<MSSBamSchemaNumberBuff>(); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && (buff instanceof MSSBamSchemaNumberBuff)) { filteredList.add((MSSBamSchemaNumberBuff) buff); } } return (filteredList.toArray(new MSSBamSchemaNumberBuff[0])); } } public MSSBamSchemaNumberBuff[] readDerivedByVAccSecIdx(MSSBamAuthorization Authorization, Short ViewAccessSecurityId) { final String S_ProcName = "MSSBamRamValue.readDerivedByVAccSecIdx() "; MSSBamValueBuff buffList[] = schema.getTableValue().readDerivedByVAccSecIdx(Authorization, ViewAccessSecurityId); if (buffList == null) { return (null); } else { MSSBamValueBuff buff; ArrayList<MSSBamSchemaNumberBuff> filteredList = new ArrayList<MSSBamSchemaNumberBuff>(); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && (buff instanceof MSSBamSchemaNumberBuff)) { filteredList.add((MSSBamSchemaNumberBuff) buff); } } return (filteredList.toArray(new MSSBamSchemaNumberBuff[0])); } } public MSSBamSchemaNumberBuff[] readDerivedByVAccFreqIdx(MSSBamAuthorization Authorization, Short ViewAccessFrequencyId) { final String S_ProcName = "MSSBamRamValue.readDerivedByVAccFreqIdx() "; MSSBamValueBuff buffList[] = schema.getTableValue().readDerivedByVAccFreqIdx(Authorization, ViewAccessFrequencyId); if (buffList == null) { return (null); } else { MSSBamValueBuff buff; ArrayList<MSSBamSchemaNumberBuff> filteredList = new ArrayList<MSSBamSchemaNumberBuff>(); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && (buff instanceof MSSBamSchemaNumberBuff)) { filteredList.add((MSSBamSchemaNumberBuff) buff); } } return (filteredList.toArray(new MSSBamSchemaNumberBuff[0])); } } public MSSBamSchemaNumberBuff[] readDerivedByEAccSecIdx(MSSBamAuthorization Authorization, Short EditAccessSecurityId) { final String S_ProcName = "MSSBamRamValue.readDerivedByEAccSecIdx() "; MSSBamValueBuff buffList[] = schema.getTableValue().readDerivedByEAccSecIdx(Authorization, EditAccessSecurityId); if (buffList == null) { return (null); } else { MSSBamValueBuff buff; ArrayList<MSSBamSchemaNumberBuff> filteredList = new ArrayList<MSSBamSchemaNumberBuff>(); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && (buff instanceof MSSBamSchemaNumberBuff)) { filteredList.add((MSSBamSchemaNumberBuff) buff); } } return (filteredList.toArray(new MSSBamSchemaNumberBuff[0])); } } public MSSBamSchemaNumberBuff[] readDerivedByEAccFreqIdx(MSSBamAuthorization Authorization, Short EditAccessFrequencyId) { final String S_ProcName = "MSSBamRamValue.readDerivedByEAccFreqIdx() "; MSSBamValueBuff buffList[] = schema.getTableValue().readDerivedByEAccFreqIdx(Authorization, EditAccessFrequencyId); if (buffList == null) { return (null); } else { MSSBamValueBuff buff; ArrayList<MSSBamSchemaNumberBuff> filteredList = new ArrayList<MSSBamSchemaNumberBuff>(); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && (buff instanceof MSSBamSchemaNumberBuff)) { filteredList.add((MSSBamSchemaNumberBuff) buff); } } return (filteredList.toArray(new MSSBamSchemaNumberBuff[0])); } } public MSSBamSchemaNumberBuff[] readDerivedByPrevIdx(MSSBamAuthorization Authorization, Long PrevId) { final String S_ProcName = "MSSBamRamValue.readDerivedByPrevIdx() "; MSSBamValueBuff buffList[] = schema.getTableValue().readDerivedByPrevIdx(Authorization, PrevId); if (buffList == null) { return (null); } else { MSSBamValueBuff buff; ArrayList<MSSBamSchemaNumberBuff> filteredList = new ArrayList<MSSBamSchemaNumberBuff>(); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && (buff instanceof MSSBamSchemaNumberBuff)) { filteredList.add((MSSBamSchemaNumberBuff) buff); } } return (filteredList.toArray(new MSSBamSchemaNumberBuff[0])); } } public MSSBamSchemaNumberBuff[] readDerivedByNextIdx(MSSBamAuthorization Authorization, Long NextId) { final String S_ProcName = "MSSBamRamValue.readDerivedByNextIdx() "; MSSBamValueBuff buffList[] = schema.getTableValue().readDerivedByNextIdx(Authorization, NextId); if (buffList == null) { return (null); } else { MSSBamValueBuff buff; ArrayList<MSSBamSchemaNumberBuff> filteredList = new ArrayList<MSSBamSchemaNumberBuff>(); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && (buff instanceof MSSBamSchemaNumberBuff)) { filteredList.add((MSSBamSchemaNumberBuff) buff); } } return (filteredList.toArray(new MSSBamSchemaNumberBuff[0])); } } public MSSBamSchemaNumberBuff[] readDerivedByContPrevIdx(MSSBamAuthorization Authorization, long ValueContainerId, Long PrevId) { final String S_ProcName = "MSSBamRamValue.readDerivedByContPrevIdx() "; MSSBamValueBuff buffList[] = schema.getTableValue().readDerivedByContPrevIdx(Authorization, ValueContainerId, PrevId); if (buffList == null) { return (null); } else { MSSBamValueBuff buff; ArrayList<MSSBamSchemaNumberBuff> filteredList = new ArrayList<MSSBamSchemaNumberBuff>(); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && (buff instanceof MSSBamSchemaNumberBuff)) { filteredList.add((MSSBamSchemaNumberBuff) buff); } } return (filteredList.toArray(new MSSBamSchemaNumberBuff[0])); } } public MSSBamSchemaNumberBuff[] readDerivedByContNextIdx(MSSBamAuthorization Authorization, long ValueContainerId, Long NextId) { final String S_ProcName = "MSSBamRamValue.readDerivedByContNextIdx() "; MSSBamValueBuff buffList[] = schema.getTableValue().readDerivedByContNextIdx(Authorization, ValueContainerId, NextId); if (buffList == null) { return (null); } else { MSSBamValueBuff buff; ArrayList<MSSBamSchemaNumberBuff> filteredList = new ArrayList<MSSBamSchemaNumberBuff>(); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && (buff instanceof MSSBamSchemaNumberBuff)) { filteredList.add((MSSBamSchemaNumberBuff) buff); } } return (filteredList.toArray(new MSSBamSchemaNumberBuff[0])); } } public MSSBamSchemaNumberBuff[] readDerivedByContainerIdx(MSSBamAuthorization Authorization, long ContainerId) { final String S_ProcName = "MSSBamRamSchemaNumber.readDerivedByContainerIdx() "; MSSBamSchemaNumberByContainerIdxKey key = schema.getFactorySchemaNumber().newContainerIdxKey(); key.setRequiredContainerId(ContainerId); MSSBamSchemaNumberBuff[] recArray; if (dictByContainerIdx.containsKey(key)) { SortedMap<MSSBamAnyObjPKey, MSSBamSchemaNumberBuff> subdictContainerIdx = dictByContainerIdx.get(key); recArray = new MSSBamSchemaNumberBuff[subdictContainerIdx.size()]; Iterator<MSSBamSchemaNumberBuff> iter = subdictContainerIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new MSSBamSchemaNumberBuff[0]; } return (recArray); } public MSSBamSchemaNumberBuff readDerivedByIdIdx(MSSBamAuthorization Authorization, long Id) { final String S_ProcName = "MSSBamRamAnyObj.readDerivedByIdIdx() "; MSSBamAnyObjPKey key = schema.getFactoryAnyObj().newPKey(); key.setRequiredId(Id); MSSBamSchemaNumberBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public MSSBamSchemaNumberBuff readBuff(MSSBamAuthorization Authorization, MSSBamAnyObjPKey PKey) { final String S_ProcName = "MSSBamRamSchemaNumber.readBuff() "; MSSBamSchemaNumberBuff buff = readDerived(Authorization, PKey); if ((buff != null) && (!buff.getClassCode().equals("SNUM"))) { buff = null; } return (buff); } public MSSBamSchemaNumberBuff[] readAllBuff(MSSBamAuthorization Authorization) { final String S_ProcName = "MSSBamRamSchemaNumber.readAllBuff() "; MSSBamSchemaNumberBuff buff; ArrayList<MSSBamSchemaNumberBuff> filteredList = new ArrayList<MSSBamSchemaNumberBuff>(); MSSBamSchemaNumberBuff[] buffList = readAllDerived(Authorization); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("SNUM")) { filteredList.add(buff); } } return (filteredList.toArray(new MSSBamSchemaNumberBuff[0])); } public MSSBamSchemaNumberBuff readBuffByIdIdx(MSSBamAuthorization Authorization, long Id) { final String S_ProcName = "MSSBamRamAnyObj.readBuffByIdIdx() "; MSSBamAnyObjBuff buff = readDerivedByIdIdx(Authorization, Id); if ((buff != null) && buff.getClassCode().equals("ANYO")) { return ((MSSBamSchemaNumberBuff) buff); } else { return (null); } } public MSSBamSchemaNumberBuff[] readBuffByTenantIdx(MSSBamAuthorization Authorization, long TenantId) { final String S_ProcName = "MSSBamRamAnyObj.readBuffByTenantIdx() "; MSSBamAnyObjBuff buff; ArrayList<MSSBamSchemaNumberBuff> filteredList = new ArrayList<MSSBamSchemaNumberBuff>(); 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((MSSBamSchemaNumberBuff) buff); } } return (filteredList.toArray(new MSSBamSchemaNumberBuff[0])); } public MSSBamSchemaNumberBuff[] readBuffByScopeIdx(MSSBamAuthorization Authorization, Long ScopeId) { final String S_ProcName = "MSSBamRamAnyObj.readBuffByScopeIdx() "; MSSBamAnyObjBuff buff; ArrayList<MSSBamSchemaNumberBuff> filteredList = new ArrayList<MSSBamSchemaNumberBuff>(); 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((MSSBamSchemaNumberBuff) buff); } } return (filteredList.toArray(new MSSBamSchemaNumberBuff[0])); } public MSSBamSchemaNumberBuff[] readBuffByAuthorIdx(MSSBamAuthorization Authorization, Long AuthorId) { final String S_ProcName = "MSSBamRamAnyObj.readBuffByAuthorIdx() "; MSSBamAnyObjBuff buff; ArrayList<MSSBamSchemaNumberBuff> filteredList = new ArrayList<MSSBamSchemaNumberBuff>(); 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((MSSBamSchemaNumberBuff) buff); } } return (filteredList.toArray(new MSSBamSchemaNumberBuff[0])); } public MSSBamSchemaNumberBuff 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 ((MSSBamSchemaNumberBuff) buff); } else { return (null); } } public MSSBamSchemaNumberBuff[] readBuffByVContIdx(MSSBamAuthorization Authorization, long ValueContainerId) { final String S_ProcName = "MSSBamRamValue.readBuffByVContIdx() "; MSSBamValueBuff buff; ArrayList<MSSBamSchemaNumberBuff> filteredList = new ArrayList<MSSBamSchemaNumberBuff>(); 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((MSSBamSchemaNumberBuff) buff); } } return (filteredList.toArray(new MSSBamSchemaNumberBuff[0])); } public MSSBamSchemaNumberBuff[] readBuffByDataScopeIdx(MSSBamAuthorization Authorization, Short DataScopeId) { final String S_ProcName = "MSSBamRamValue.readBuffByDataScopeIdx() "; MSSBamValueBuff buff; ArrayList<MSSBamSchemaNumberBuff> filteredList = new ArrayList<MSSBamSchemaNumberBuff>(); 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((MSSBamSchemaNumberBuff) buff); } } return (filteredList.toArray(new MSSBamSchemaNumberBuff[0])); } public MSSBamSchemaNumberBuff[] readBuffByVAccSecIdx(MSSBamAuthorization Authorization, Short ViewAccessSecurityId) { final String S_ProcName = "MSSBamRamValue.readBuffByVAccSecIdx() "; MSSBamValueBuff buff; ArrayList<MSSBamSchemaNumberBuff> filteredList = new ArrayList<MSSBamSchemaNumberBuff>(); 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((MSSBamSchemaNumberBuff) buff); } } return (filteredList.toArray(new MSSBamSchemaNumberBuff[0])); } public MSSBamSchemaNumberBuff[] readBuffByVAccFreqIdx(MSSBamAuthorization Authorization, Short ViewAccessFrequencyId) { final String S_ProcName = "MSSBamRamValue.readBuffByVAccFreqIdx() "; MSSBamValueBuff buff; ArrayList<MSSBamSchemaNumberBuff> filteredList = new ArrayList<MSSBamSchemaNumberBuff>(); 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((MSSBamSchemaNumberBuff) buff); } } return (filteredList.toArray(new MSSBamSchemaNumberBuff[0])); } public MSSBamSchemaNumberBuff[] readBuffByEAccSecIdx(MSSBamAuthorization Authorization, Short EditAccessSecurityId) { final String S_ProcName = "MSSBamRamValue.readBuffByEAccSecIdx() "; MSSBamValueBuff buff; ArrayList<MSSBamSchemaNumberBuff> filteredList = new ArrayList<MSSBamSchemaNumberBuff>(); 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((MSSBamSchemaNumberBuff) buff); } } return (filteredList.toArray(new MSSBamSchemaNumberBuff[0])); } public MSSBamSchemaNumberBuff[] readBuffByEAccFreqIdx(MSSBamAuthorization Authorization, Short EditAccessFrequencyId) { final String S_ProcName = "MSSBamRamValue.readBuffByEAccFreqIdx() "; MSSBamValueBuff buff; ArrayList<MSSBamSchemaNumberBuff> filteredList = new ArrayList<MSSBamSchemaNumberBuff>(); 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((MSSBamSchemaNumberBuff) buff); } } return (filteredList.toArray(new MSSBamSchemaNumberBuff[0])); } public MSSBamSchemaNumberBuff[] readBuffByPrevIdx(MSSBamAuthorization Authorization, Long PrevId) { final String S_ProcName = "MSSBamRamValue.readBuffByPrevIdx() "; MSSBamValueBuff buff; ArrayList<MSSBamSchemaNumberBuff> filteredList = new ArrayList<MSSBamSchemaNumberBuff>(); 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((MSSBamSchemaNumberBuff) buff); } } return (filteredList.toArray(new MSSBamSchemaNumberBuff[0])); } public MSSBamSchemaNumberBuff[] readBuffByNextIdx(MSSBamAuthorization Authorization, Long NextId) { final String S_ProcName = "MSSBamRamValue.readBuffByNextIdx() "; MSSBamValueBuff buff; ArrayList<MSSBamSchemaNumberBuff> filteredList = new ArrayList<MSSBamSchemaNumberBuff>(); 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((MSSBamSchemaNumberBuff) buff); } } return (filteredList.toArray(new MSSBamSchemaNumberBuff[0])); } public MSSBamSchemaNumberBuff[] readBuffByContPrevIdx(MSSBamAuthorization Authorization, long ValueContainerId, Long PrevId) { final String S_ProcName = "MSSBamRamValue.readBuffByContPrevIdx() "; MSSBamValueBuff buff; ArrayList<MSSBamSchemaNumberBuff> filteredList = new ArrayList<MSSBamSchemaNumberBuff>(); 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((MSSBamSchemaNumberBuff) buff); } } return (filteredList.toArray(new MSSBamSchemaNumberBuff[0])); } public MSSBamSchemaNumberBuff[] readBuffByContNextIdx(MSSBamAuthorization Authorization, long ValueContainerId, Long NextId) { final String S_ProcName = "MSSBamRamValue.readBuffByContNextIdx() "; MSSBamValueBuff buff; ArrayList<MSSBamSchemaNumberBuff> filteredList = new ArrayList<MSSBamSchemaNumberBuff>(); 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((MSSBamSchemaNumberBuff) buff); } } return (filteredList.toArray(new MSSBamSchemaNumberBuff[0])); } public MSSBamSchemaNumberBuff[] readBuffByContainerIdx(MSSBamAuthorization Authorization, long ContainerId) { final String S_ProcName = "MSSBamRamSchemaNumber.readBuffByContainerIdx() "; MSSBamSchemaNumberBuff buff; ArrayList<MSSBamSchemaNumberBuff> filteredList = new ArrayList<MSSBamSchemaNumberBuff>(); MSSBamSchemaNumberBuff[] buffList = readDerivedByContainerIdx(Authorization, ContainerId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("SNUM")) { filteredList.add((MSSBamSchemaNumberBuff) buff); } } return (filteredList.toArray(new MSSBamSchemaNumberBuff[0])); } public void updateSchemaNumber(MSSBamAuthorization Authorization, MSSBamSchemaNumberBuff Buff) { MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey(); pkey.setRequiredId(Buff.getRequiredId()); MSSBamSchemaNumberBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateSchemaNumber", "Existing record not found", "SchemaNumber", pkey); } MSSBamSchemaNumberByContainerIdxKey existingKeyContainerIdx = schema.getFactorySchemaNumber() .newContainerIdxKey(); existingKeyContainerIdx.setRequiredContainerId(existing.getRequiredContainerId()); MSSBamSchemaNumberByContainerIdxKey newKeyContainerIdx = schema.getFactorySchemaNumber() .newContainerIdxKey(); newKeyContainerIdx.setRequiredContainerId(Buff.getRequiredContainerId()); // Check unique indexes // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema.getTableNumberDef().readDerivedByIdIdx(Authorization, Buff.getRequiredId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateSchemaNumber", "Superclass", "SuperClass", "NumberDef", null); } } } { boolean allNull = true; if (allNull) { if (null == schema.getTableSchemaDef().readDerivedByIdIdx(Authorization, Buff.getRequiredContainerId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateSchemaNumber", "Container", "CSchema", "SchemaDef", null); } } } // Update is valid SortedMap<MSSBamAnyObjPKey, MSSBamSchemaNumberBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); subdict = dictByContainerIdx.get(existingKeyContainerIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByContainerIdx.containsKey(newKeyContainerIdx)) { subdict = dictByContainerIdx.get(newKeyContainerIdx); } else { subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamSchemaNumberBuff>(); dictByContainerIdx.put(newKeyContainerIdx, subdict); } subdict.put(pkey, Buff); } public void deleteSchemaNumber(MSSBamAuthorization Authorization, MSSBamSchemaNumberBuff Buff) { final String S_ProcName = "MSSBamRamSchemaNumberTable.deleteSchemaNumber() "; MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey(); pkey.setRequiredId(schema.nextAnyObjIdGen()); MSSBamSchemaNumberBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteSchemaNumber", "Existing record not found", "SchemaNumber", pkey); } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteSchemaNumber", pkey); } MSSBamSchemaNumberByContainerIdxKey keyContainerIdx = schema.getFactorySchemaNumber().newContainerIdxKey(); keyContainerIdx.setRequiredContainerId(existing.getRequiredContainerId()); // Validate reverse foreign keys // Delete is valid SortedMap<MSSBamAnyObjPKey, MSSBamSchemaNumberBuff> subdict; dictByPKey.remove(pkey); subdict = dictByContainerIdx.get(keyContainerIdx); subdict.remove(pkey); } public MSSBamCursor openSchemaNumberCursorAll(MSSBamAuthorization Authorization) { MSSBamCursor cursor = new MSSBamRamSchemaNumberCursor(Authorization, schema, dictByPKey.values()); return (cursor); } public MSSBamCursor openSchemaNumberCursorByContainerIdx(MSSBamAuthorization Authorization, long ContainerId) { MSSBamCursor cursor; MSSBamSchemaNumberByContainerIdxKey key = schema.getFactorySchemaNumber().newContainerIdxKey(); key.setRequiredContainerId(ContainerId); if (dictByContainerIdx.containsKey(key)) { SortedMap<MSSBamAnyObjPKey, MSSBamSchemaNumberBuff> subdictContainerIdx = dictByContainerIdx.get(key); cursor = new MSSBamRamSchemaNumberCursor(Authorization, schema, subdictContainerIdx.values()); } else { cursor = new MSSBamRamSchemaNumberCursor(Authorization, schema, new ArrayList<MSSBamSchemaNumberBuff>()); } return (cursor); } public void closeSchemaNumberCursor(MSSBamCursor Cursor) { // Cursor.DataReader.Close(); } public MSSBamSchemaNumberBuff nextSchemaNumberCursor(MSSBamCursor Cursor) { MSSBamRamSchemaNumberCursor cursor = (MSSBamRamSchemaNumberCursor) Cursor; MSSBamSchemaNumberBuff rec = cursor.getCursor().next(); cursor.setRowIdx(cursor.getRowIdx() + 1); return (rec); } public MSSBamSchemaNumberBuff prevSchemaNumberCursor(MSSBamCursor Cursor) { int targetRowIdx = (Cursor.getRowIdx() > 1) ? Cursor.getRowIdx() - 1 : 1; MSSBamSchemaNumberBuff rec = null; if (Cursor.getRowIdx() >= targetRowIdx) { Cursor.reset(); } while (Cursor.getRowIdx() < targetRowIdx) { rec = nextSchemaNumberCursor(Cursor); } return (rec); } public MSSBamSchemaNumberBuff firstSchemaNumberCursor(MSSBamCursor Cursor) { int targetRowIdx = 1; MSSBamSchemaNumberBuff rec = null; Cursor.reset(); while (Cursor.getRowIdx() < targetRowIdx) { rec = nextSchemaNumberCursor(Cursor); } return (rec); } public MSSBamSchemaNumberBuff lastSchemaNumberCursor(MSSBamCursor Cursor) { throw CFLib.getDefaultExceptionFactory().newNotImplementedYetException(getClass(), "lastSchemaNumberCursor"); } public MSSBamSchemaNumberBuff nthSchemaNumberCursor(MSSBamCursor Cursor, int Idx) { int targetRowIdx = Idx; MSSBamSchemaNumberBuff rec = null; if (Cursor.getRowIdx() >= targetRowIdx) { Cursor.reset(); } while (Cursor.getRowIdx() < targetRowIdx) { rec = nextSchemaNumberCursor(Cursor); } return (rec); } }