Java tutorial
// Description: Java6 in-memory RAM DbIO implementation for SchemaDef. /* * MSS Code Factory 1.11 * * Copyright (c) 2012-2014 Mark Sobkow * * This program is available as free software under the GNU GPL v3, or * under a commercial license from Mark Sobkow. For commercial licensing * details, please contact msobkow@sasktel.net. * * Under the terms of the GPL: * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * *********************************************************************** * * $Revision$ */ package net.sourceforge.msscodefactory.v1_11.MSSBamRam; import java.sql.*; import java.util.*; import net.sourceforge.msscodefactory.cflib.v1_11.CFLib.*; import org.apache.commons.codec.binary.Base64; import net.sourceforge.msscodefactory.v1_11.MSSBam.*; import net.sourceforge.msscodefactory.v1_11.MSSBamBL.*; import net.sourceforge.msscodefactory.v1_11.MSSBamBLRam.*; /* * MSSBamRamSchemaDefTable in-memory RAM DbIO implementation * for SchemaDef. */ public class MSSBamRamSchemaDefTable implements IMSSBamSchemaDefTable { private MSSBamBLRamSchema schema; private Map<MSSBamAnyObjPKey, MSSBamSchemaDefBuff> dictByPKey = new HashMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff>(); private SortedMap<MSSBamSchemaDefByVersionIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff>> dictByVersionIdx = new TreeMap<MSSBamSchemaDefByVersionIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff>>(); private SortedMap<MSSBamSchemaDefByDefLcnIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff>> dictByDefLcnIdx = new TreeMap<MSSBamSchemaDefByDefLcnIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff>>(); private SortedMap<MSSBamSchemaDefByDataScopeIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff>> dictByDataScopeIdx = new TreeMap<MSSBamSchemaDefByDataScopeIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff>>(); private SortedMap<MSSBamSchemaDefByVAccSecIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff>> dictByVAccSecIdx = new TreeMap<MSSBamSchemaDefByVAccSecIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff>>(); private SortedMap<MSSBamSchemaDefByVAccFreqIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff>> dictByVAccFreqIdx = new TreeMap<MSSBamSchemaDefByVAccFreqIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff>>(); private SortedMap<MSSBamSchemaDefByEAccSecIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff>> dictByEAccSecIdx = new TreeMap<MSSBamSchemaDefByEAccSecIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff>>(); private SortedMap<MSSBamSchemaDefByEAccFreqIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff>> dictByEAccFreqIdx = new TreeMap<MSSBamSchemaDefByEAccFreqIdxKey, SortedMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff>>(); public MSSBamRamSchemaDefTable(MSSBamBLRamSchema argSchema) { schema = argSchema; } public void createSchemaDef(MSSBamAuthorization Authorization, MSSBamSchemaDefBuff Buff) { MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey(); pkey.setClassCode(Buff.getClassCode()); pkey.setRequiredId(Buff.getRequiredId()); MSSBamSchemaDefByVersionIdxKey keyVersionIdx = schema.getFactorySchemaDef().newVersionIdxKey(); keyVersionIdx.setRequiredVersionId(Buff.getRequiredVersionId()); MSSBamSchemaDefByDefLcnIdxKey keyDefLcnIdx = schema.getFactorySchemaDef().newDefLcnIdxKey(); keyDefLcnIdx.setOptionalDefaultLicenseId(Buff.getOptionalDefaultLicenseId()); MSSBamSchemaDefByDataScopeIdxKey keyDataScopeIdx = schema.getFactorySchemaDef().newDataScopeIdxKey(); keyDataScopeIdx.setOptionalDataScopeId(Buff.getOptionalDataScopeId()); MSSBamSchemaDefByVAccSecIdxKey keyVAccSecIdx = schema.getFactorySchemaDef().newVAccSecIdxKey(); keyVAccSecIdx.setOptionalViewAccessSecurityId(Buff.getOptionalViewAccessSecurityId()); MSSBamSchemaDefByVAccFreqIdxKey keyVAccFreqIdx = schema.getFactorySchemaDef().newVAccFreqIdxKey(); keyVAccFreqIdx.setOptionalViewAccessFrequencyId(Buff.getOptionalViewAccessFrequencyId()); MSSBamSchemaDefByEAccSecIdxKey keyEAccSecIdx = schema.getFactorySchemaDef().newEAccSecIdxKey(); keyEAccSecIdx.setOptionalEditAccessSecurityId(Buff.getOptionalEditAccessSecurityId()); MSSBamSchemaDefByEAccFreqIdxKey keyEAccFreqIdx = schema.getFactorySchemaDef().newEAccFreqIdxKey(); keyEAccFreqIdx.setOptionalEditAccessFrequencyId(Buff.getOptionalEditAccessFrequencyId()); // Validate unique indexes if (dictByPKey.containsKey(pkey)) { throw CFLib.getDefaultExceptionFactory().newPrimaryKeyNotNewException(getClass(), "createSchemaDef", pkey); } // Validate foreign keys { boolean allNull = true; allNull = false; if (!allNull) { if (null == schema.getTableScope().readDerivedByIdIdx(Authorization, Buff.getRequiredId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "createSchemaDef", "Superclass", "SuperClass", "Scope", null); } } } { boolean allNull = true; allNull = false; if (!allNull) { if (null == schema.getTableVersion().readDerivedByIdIdx(Authorization, Buff.getRequiredVersionId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "createSchemaDef", "Container", "Version", "Version", null); } } } // Proceed with adding the new record dictByPKey.put(pkey, Buff); SortedMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff> subdictVersionIdx; if (dictByVersionIdx.containsKey(keyVersionIdx)) { subdictVersionIdx = dictByVersionIdx.get(keyVersionIdx); } else { subdictVersionIdx = new TreeMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff>(); dictByVersionIdx.put(keyVersionIdx, subdictVersionIdx); } subdictVersionIdx.put(pkey, Buff); SortedMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff> subdictDefLcnIdx; if (dictByDefLcnIdx.containsKey(keyDefLcnIdx)) { subdictDefLcnIdx = dictByDefLcnIdx.get(keyDefLcnIdx); } else { subdictDefLcnIdx = new TreeMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff>(); dictByDefLcnIdx.put(keyDefLcnIdx, subdictDefLcnIdx); } subdictDefLcnIdx.put(pkey, Buff); SortedMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff> subdictDataScopeIdx; if (dictByDataScopeIdx.containsKey(keyDataScopeIdx)) { subdictDataScopeIdx = dictByDataScopeIdx.get(keyDataScopeIdx); } else { subdictDataScopeIdx = new TreeMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff>(); dictByDataScopeIdx.put(keyDataScopeIdx, subdictDataScopeIdx); } subdictDataScopeIdx.put(pkey, Buff); SortedMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff> subdictVAccSecIdx; if (dictByVAccSecIdx.containsKey(keyVAccSecIdx)) { subdictVAccSecIdx = dictByVAccSecIdx.get(keyVAccSecIdx); } else { subdictVAccSecIdx = new TreeMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff>(); dictByVAccSecIdx.put(keyVAccSecIdx, subdictVAccSecIdx); } subdictVAccSecIdx.put(pkey, Buff); SortedMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff> subdictVAccFreqIdx; if (dictByVAccFreqIdx.containsKey(keyVAccFreqIdx)) { subdictVAccFreqIdx = dictByVAccFreqIdx.get(keyVAccFreqIdx); } else { subdictVAccFreqIdx = new TreeMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff>(); dictByVAccFreqIdx.put(keyVAccFreqIdx, subdictVAccFreqIdx); } subdictVAccFreqIdx.put(pkey, Buff); SortedMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff> subdictEAccSecIdx; if (dictByEAccSecIdx.containsKey(keyEAccSecIdx)) { subdictEAccSecIdx = dictByEAccSecIdx.get(keyEAccSecIdx); } else { subdictEAccSecIdx = new TreeMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff>(); dictByEAccSecIdx.put(keyEAccSecIdx, subdictEAccSecIdx); } subdictEAccSecIdx.put(pkey, Buff); SortedMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff> subdictEAccFreqIdx; if (dictByEAccFreqIdx.containsKey(keyEAccFreqIdx)) { subdictEAccFreqIdx = dictByEAccFreqIdx.get(keyEAccFreqIdx); } else { subdictEAccFreqIdx = new TreeMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff>(); dictByEAccFreqIdx.put(keyEAccFreqIdx, subdictEAccFreqIdx); } subdictEAccFreqIdx.put(pkey, Buff); } public MSSBamSchemaDefBuff readDerived(MSSBamAuthorization Authorization, MSSBamAnyObjPKey PKey) { final String S_ProcName = "MSSBamRamSchemaDef.readDerived() "; MSSBamAnyObjPKey key = schema.getFactoryAnyObj().newPKey(); key.setRequiredId(PKey.getRequiredId()); MSSBamSchemaDefBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public MSSBamSchemaDefBuff lockDerived(MSSBamAuthorization Authorization, MSSBamAnyObjPKey PKey) { final String S_ProcName = "MSSBamRamSchemaDef.readDerived() "; MSSBamAnyObjPKey key = schema.getFactoryAnyObj().newPKey(); key.setRequiredId(PKey.getRequiredId()); MSSBamSchemaDefBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public MSSBamSchemaDefBuff[] readAllDerived(MSSBamAuthorization Authorization) { final String S_ProcName = "MSSBamRamSchemaDef.readAllDerived() "; MSSBamSchemaDefBuff[] retList = new MSSBamSchemaDefBuff[dictByPKey.values().size()]; Iterator<MSSBamSchemaDefBuff> iter = dictByPKey.values().iterator(); int idx = 0; while (iter.hasNext()) { retList[idx++] = iter.next(); } return (retList); } public MSSBamSchemaDefBuff[] 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<MSSBamSchemaDefBuff> filteredList = new ArrayList<MSSBamSchemaDefBuff>(); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && (buff instanceof MSSBamSchemaDefBuff)) { filteredList.add((MSSBamSchemaDefBuff) buff); } } return (filteredList.toArray(new MSSBamSchemaDefBuff[0])); } } public MSSBamSchemaDefBuff[] 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<MSSBamSchemaDefBuff> filteredList = new ArrayList<MSSBamSchemaDefBuff>(); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && (buff instanceof MSSBamSchemaDefBuff)) { filteredList.add((MSSBamSchemaDefBuff) buff); } } return (filteredList.toArray(new MSSBamSchemaDefBuff[0])); } } public MSSBamSchemaDefBuff[] readDerivedByDefSchemaIdx(MSSBamAuthorization Authorization, Long DefSchemaId) { final String S_ProcName = "MSSBamRamAnyObj.readDerivedByDefSchemaIdx() "; MSSBamAnyObjBuff buffList[] = schema.getTableAnyObj().readDerivedByDefSchemaIdx(Authorization, DefSchemaId); if (buffList == null) { return (null); } else { MSSBamAnyObjBuff buff; ArrayList<MSSBamSchemaDefBuff> filteredList = new ArrayList<MSSBamSchemaDefBuff>(); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && (buff instanceof MSSBamSchemaDefBuff)) { filteredList.add((MSSBamSchemaDefBuff) buff); } } return (filteredList.toArray(new MSSBamSchemaDefBuff[0])); } } public MSSBamSchemaDefBuff[] 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<MSSBamSchemaDefBuff> filteredList = new ArrayList<MSSBamSchemaDefBuff>(); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && (buff instanceof MSSBamSchemaDefBuff)) { filteredList.add((MSSBamSchemaDefBuff) buff); } } return (filteredList.toArray(new MSSBamSchemaDefBuff[0])); } } public MSSBamSchemaDefBuff 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 MSSBamSchemaDefBuff) { return ((MSSBamSchemaDefBuff) buff); } else { return (null); } } public MSSBamSchemaDefBuff[] readDerivedByVersionIdx(MSSBamAuthorization Authorization, long VersionId) { final String S_ProcName = "MSSBamRamSchemaDef.readDerivedByVersionIdx() "; MSSBamSchemaDefByVersionIdxKey key = schema.getFactorySchemaDef().newVersionIdxKey(); key.setRequiredVersionId(VersionId); MSSBamSchemaDefBuff[] recArray; if (dictByVersionIdx.containsKey(key)) { SortedMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff> subdictVersionIdx = dictByVersionIdx.get(key); recArray = new MSSBamSchemaDefBuff[subdictVersionIdx.size()]; Iterator<MSSBamSchemaDefBuff> iter = subdictVersionIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new MSSBamSchemaDefBuff[0]; } return (recArray); } public MSSBamSchemaDefBuff[] readDerivedByDefLcnIdx(MSSBamAuthorization Authorization, Long DefaultLicenseId) { final String S_ProcName = "MSSBamRamSchemaDef.readDerivedByDefLcnIdx() "; MSSBamSchemaDefByDefLcnIdxKey key = schema.getFactorySchemaDef().newDefLcnIdxKey(); key.setOptionalDefaultLicenseId(DefaultLicenseId); MSSBamSchemaDefBuff[] recArray; if (dictByDefLcnIdx.containsKey(key)) { SortedMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff> subdictDefLcnIdx = dictByDefLcnIdx.get(key); recArray = new MSSBamSchemaDefBuff[subdictDefLcnIdx.size()]; Iterator<MSSBamSchemaDefBuff> iter = subdictDefLcnIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new MSSBamSchemaDefBuff[0]; } return (recArray); } public MSSBamSchemaDefBuff[] readDerivedByDataScopeIdx(MSSBamAuthorization Authorization, Short DataScopeId) { final String S_ProcName = "MSSBamRamSchemaDef.readDerivedByDataScopeIdx() "; MSSBamSchemaDefByDataScopeIdxKey key = schema.getFactorySchemaDef().newDataScopeIdxKey(); key.setOptionalDataScopeId(DataScopeId); MSSBamSchemaDefBuff[] recArray; if (dictByDataScopeIdx.containsKey(key)) { SortedMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff> subdictDataScopeIdx = dictByDataScopeIdx.get(key); recArray = new MSSBamSchemaDefBuff[subdictDataScopeIdx.size()]; Iterator<MSSBamSchemaDefBuff> iter = subdictDataScopeIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new MSSBamSchemaDefBuff[0]; } return (recArray); } public MSSBamSchemaDefBuff[] readDerivedByVAccSecIdx(MSSBamAuthorization Authorization, Short ViewAccessSecurityId) { final String S_ProcName = "MSSBamRamSchemaDef.readDerivedByVAccSecIdx() "; MSSBamSchemaDefByVAccSecIdxKey key = schema.getFactorySchemaDef().newVAccSecIdxKey(); key.setOptionalViewAccessSecurityId(ViewAccessSecurityId); MSSBamSchemaDefBuff[] recArray; if (dictByVAccSecIdx.containsKey(key)) { SortedMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff> subdictVAccSecIdx = dictByVAccSecIdx.get(key); recArray = new MSSBamSchemaDefBuff[subdictVAccSecIdx.size()]; Iterator<MSSBamSchemaDefBuff> iter = subdictVAccSecIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new MSSBamSchemaDefBuff[0]; } return (recArray); } public MSSBamSchemaDefBuff[] readDerivedByVAccFreqIdx(MSSBamAuthorization Authorization, Short ViewAccessFrequencyId) { final String S_ProcName = "MSSBamRamSchemaDef.readDerivedByVAccFreqIdx() "; MSSBamSchemaDefByVAccFreqIdxKey key = schema.getFactorySchemaDef().newVAccFreqIdxKey(); key.setOptionalViewAccessFrequencyId(ViewAccessFrequencyId); MSSBamSchemaDefBuff[] recArray; if (dictByVAccFreqIdx.containsKey(key)) { SortedMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff> subdictVAccFreqIdx = dictByVAccFreqIdx.get(key); recArray = new MSSBamSchemaDefBuff[subdictVAccFreqIdx.size()]; Iterator<MSSBamSchemaDefBuff> iter = subdictVAccFreqIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new MSSBamSchemaDefBuff[0]; } return (recArray); } public MSSBamSchemaDefBuff[] readDerivedByEAccSecIdx(MSSBamAuthorization Authorization, Short EditAccessSecurityId) { final String S_ProcName = "MSSBamRamSchemaDef.readDerivedByEAccSecIdx() "; MSSBamSchemaDefByEAccSecIdxKey key = schema.getFactorySchemaDef().newEAccSecIdxKey(); key.setOptionalEditAccessSecurityId(EditAccessSecurityId); MSSBamSchemaDefBuff[] recArray; if (dictByEAccSecIdx.containsKey(key)) { SortedMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff> subdictEAccSecIdx = dictByEAccSecIdx.get(key); recArray = new MSSBamSchemaDefBuff[subdictEAccSecIdx.size()]; Iterator<MSSBamSchemaDefBuff> iter = subdictEAccSecIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new MSSBamSchemaDefBuff[0]; } return (recArray); } public MSSBamSchemaDefBuff[] readDerivedByEAccFreqIdx(MSSBamAuthorization Authorization, Short EditAccessFrequencyId) { final String S_ProcName = "MSSBamRamSchemaDef.readDerivedByEAccFreqIdx() "; MSSBamSchemaDefByEAccFreqIdxKey key = schema.getFactorySchemaDef().newEAccFreqIdxKey(); key.setOptionalEditAccessFrequencyId(EditAccessFrequencyId); MSSBamSchemaDefBuff[] recArray; if (dictByEAccFreqIdx.containsKey(key)) { SortedMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff> subdictEAccFreqIdx = dictByEAccFreqIdx.get(key); recArray = new MSSBamSchemaDefBuff[subdictEAccFreqIdx.size()]; Iterator<MSSBamSchemaDefBuff> iter = subdictEAccFreqIdx.values().iterator(); int idx = 0; while (iter.hasNext()) { recArray[idx++] = iter.next(); } } else { recArray = new MSSBamSchemaDefBuff[0]; } return (recArray); } public MSSBamSchemaDefBuff readDerivedByIdIdx(MSSBamAuthorization Authorization, long Id) { final String S_ProcName = "MSSBamRamAnyObj.readDerivedByIdIdx() "; MSSBamAnyObjPKey key = schema.getFactoryAnyObj().newPKey(); key.setRequiredId(Id); MSSBamSchemaDefBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); } public MSSBamSchemaDefBuff readBuff(MSSBamAuthorization Authorization, MSSBamAnyObjPKey PKey) { final String S_ProcName = "MSSBamRamSchemaDef.readBuff() "; MSSBamSchemaDefBuff buff = readDerived(Authorization, PKey); if ((buff != null) && (!buff.getClassCode().equals("SCH"))) { buff = null; } return (buff); } public MSSBamSchemaDefBuff lockBuff(MSSBamAuthorization Authorization, MSSBamAnyObjPKey PKey) { final String S_ProcName = "MSSBamRamSchemaDef.readBuff() "; MSSBamSchemaDefBuff buff = readDerived(Authorization, PKey); if ((buff != null) && (!buff.getClassCode().equals("SCH"))) { buff = null; } return (buff); } public MSSBamSchemaDefBuff[] readAllBuff(MSSBamAuthorization Authorization) { final String S_ProcName = "MSSBamRamSchemaDef.readAllBuff() "; MSSBamSchemaDefBuff buff; ArrayList<MSSBamSchemaDefBuff> filteredList = new ArrayList<MSSBamSchemaDefBuff>(); MSSBamSchemaDefBuff[] buffList = readAllDerived(Authorization); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("SCH")) { filteredList.add(buff); } } return (filteredList.toArray(new MSSBamSchemaDefBuff[0])); } public MSSBamSchemaDefBuff readBuffByIdIdx(MSSBamAuthorization Authorization, long Id) { final String S_ProcName = "MSSBamRamAnyObj.readBuffByIdIdx() "; MSSBamAnyObjBuff buff = readDerivedByIdIdx(Authorization, Id); if ((buff != null) && buff.getClassCode().equals("ANYO")) { return ((MSSBamSchemaDefBuff) buff); } else { return (null); } } public MSSBamSchemaDefBuff[] readBuffByTenantIdx(MSSBamAuthorization Authorization, long TenantId) { final String S_ProcName = "MSSBamRamAnyObj.readBuffByTenantIdx() "; MSSBamAnyObjBuff buff; ArrayList<MSSBamSchemaDefBuff> filteredList = new ArrayList<MSSBamSchemaDefBuff>(); 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((MSSBamSchemaDefBuff) buff); } } return (filteredList.toArray(new MSSBamSchemaDefBuff[0])); } public MSSBamSchemaDefBuff[] readBuffByScopeIdx(MSSBamAuthorization Authorization, Long ScopeId) { final String S_ProcName = "MSSBamRamAnyObj.readBuffByScopeIdx() "; MSSBamAnyObjBuff buff; ArrayList<MSSBamSchemaDefBuff> filteredList = new ArrayList<MSSBamSchemaDefBuff>(); 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((MSSBamSchemaDefBuff) buff); } } return (filteredList.toArray(new MSSBamSchemaDefBuff[0])); } public MSSBamSchemaDefBuff[] readBuffByDefSchemaIdx(MSSBamAuthorization Authorization, Long DefSchemaId) { final String S_ProcName = "MSSBamRamAnyObj.readBuffByDefSchemaIdx() "; MSSBamAnyObjBuff buff; ArrayList<MSSBamSchemaDefBuff> filteredList = new ArrayList<MSSBamSchemaDefBuff>(); MSSBamAnyObjBuff[] buffList = readDerivedByDefSchemaIdx(Authorization, DefSchemaId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("ANYO")) { filteredList.add((MSSBamSchemaDefBuff) buff); } } return (filteredList.toArray(new MSSBamSchemaDefBuff[0])); } public MSSBamSchemaDefBuff[] readBuffByAuthorIdx(MSSBamAuthorization Authorization, Long AuthorId) { final String S_ProcName = "MSSBamRamAnyObj.readBuffByAuthorIdx() "; MSSBamAnyObjBuff buff; ArrayList<MSSBamSchemaDefBuff> filteredList = new ArrayList<MSSBamSchemaDefBuff>(); 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((MSSBamSchemaDefBuff) buff); } } return (filteredList.toArray(new MSSBamSchemaDefBuff[0])); } public MSSBamSchemaDefBuff 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 ((MSSBamSchemaDefBuff) buff); } else { return (null); } } public MSSBamSchemaDefBuff[] readBuffByVersionIdx(MSSBamAuthorization Authorization, long VersionId) { final String S_ProcName = "MSSBamRamSchemaDef.readBuffByVersionIdx() "; MSSBamSchemaDefBuff buff; ArrayList<MSSBamSchemaDefBuff> filteredList = new ArrayList<MSSBamSchemaDefBuff>(); MSSBamSchemaDefBuff[] buffList = readDerivedByVersionIdx(Authorization, VersionId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("SCH")) { filteredList.add((MSSBamSchemaDefBuff) buff); } } return (filteredList.toArray(new MSSBamSchemaDefBuff[0])); } public MSSBamSchemaDefBuff[] readBuffByDefLcnIdx(MSSBamAuthorization Authorization, Long DefaultLicenseId) { final String S_ProcName = "MSSBamRamSchemaDef.readBuffByDefLcnIdx() "; MSSBamSchemaDefBuff buff; ArrayList<MSSBamSchemaDefBuff> filteredList = new ArrayList<MSSBamSchemaDefBuff>(); MSSBamSchemaDefBuff[] buffList = readDerivedByDefLcnIdx(Authorization, DefaultLicenseId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("SCH")) { filteredList.add((MSSBamSchemaDefBuff) buff); } } return (filteredList.toArray(new MSSBamSchemaDefBuff[0])); } public MSSBamSchemaDefBuff[] readBuffByDataScopeIdx(MSSBamAuthorization Authorization, Short DataScopeId) { final String S_ProcName = "MSSBamRamSchemaDef.readBuffByDataScopeIdx() "; MSSBamSchemaDefBuff buff; ArrayList<MSSBamSchemaDefBuff> filteredList = new ArrayList<MSSBamSchemaDefBuff>(); MSSBamSchemaDefBuff[] buffList = readDerivedByDataScopeIdx(Authorization, DataScopeId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("SCH")) { filteredList.add((MSSBamSchemaDefBuff) buff); } } return (filteredList.toArray(new MSSBamSchemaDefBuff[0])); } public MSSBamSchemaDefBuff[] readBuffByVAccSecIdx(MSSBamAuthorization Authorization, Short ViewAccessSecurityId) { final String S_ProcName = "MSSBamRamSchemaDef.readBuffByVAccSecIdx() "; MSSBamSchemaDefBuff buff; ArrayList<MSSBamSchemaDefBuff> filteredList = new ArrayList<MSSBamSchemaDefBuff>(); MSSBamSchemaDefBuff[] buffList = readDerivedByVAccSecIdx(Authorization, ViewAccessSecurityId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("SCH")) { filteredList.add((MSSBamSchemaDefBuff) buff); } } return (filteredList.toArray(new MSSBamSchemaDefBuff[0])); } public MSSBamSchemaDefBuff[] readBuffByVAccFreqIdx(MSSBamAuthorization Authorization, Short ViewAccessFrequencyId) { final String S_ProcName = "MSSBamRamSchemaDef.readBuffByVAccFreqIdx() "; MSSBamSchemaDefBuff buff; ArrayList<MSSBamSchemaDefBuff> filteredList = new ArrayList<MSSBamSchemaDefBuff>(); MSSBamSchemaDefBuff[] buffList = readDerivedByVAccFreqIdx(Authorization, ViewAccessFrequencyId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("SCH")) { filteredList.add((MSSBamSchemaDefBuff) buff); } } return (filteredList.toArray(new MSSBamSchemaDefBuff[0])); } public MSSBamSchemaDefBuff[] readBuffByEAccSecIdx(MSSBamAuthorization Authorization, Short EditAccessSecurityId) { final String S_ProcName = "MSSBamRamSchemaDef.readBuffByEAccSecIdx() "; MSSBamSchemaDefBuff buff; ArrayList<MSSBamSchemaDefBuff> filteredList = new ArrayList<MSSBamSchemaDefBuff>(); MSSBamSchemaDefBuff[] buffList = readDerivedByEAccSecIdx(Authorization, EditAccessSecurityId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("SCH")) { filteredList.add((MSSBamSchemaDefBuff) buff); } } return (filteredList.toArray(new MSSBamSchemaDefBuff[0])); } public MSSBamSchemaDefBuff[] readBuffByEAccFreqIdx(MSSBamAuthorization Authorization, Short EditAccessFrequencyId) { final String S_ProcName = "MSSBamRamSchemaDef.readBuffByEAccFreqIdx() "; MSSBamSchemaDefBuff buff; ArrayList<MSSBamSchemaDefBuff> filteredList = new ArrayList<MSSBamSchemaDefBuff>(); MSSBamSchemaDefBuff[] buffList = readDerivedByEAccFreqIdx(Authorization, EditAccessFrequencyId); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("SCH")) { filteredList.add((MSSBamSchemaDefBuff) buff); } } return (filteredList.toArray(new MSSBamSchemaDefBuff[0])); } public void updateSchemaDef(MSSBamAuthorization Authorization, MSSBamSchemaDefBuff Buff) { MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey(); pkey.setRequiredId(Buff.getRequiredId()); MSSBamSchemaDefBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateSchemaDef", "Existing record not found", "SchemaDef", pkey); } MSSBamSchemaDefByVersionIdxKey existingKeyVersionIdx = schema.getFactorySchemaDef().newVersionIdxKey(); existingKeyVersionIdx.setRequiredVersionId(existing.getRequiredVersionId()); MSSBamSchemaDefByVersionIdxKey newKeyVersionIdx = schema.getFactorySchemaDef().newVersionIdxKey(); newKeyVersionIdx.setRequiredVersionId(Buff.getRequiredVersionId()); MSSBamSchemaDefByDefLcnIdxKey existingKeyDefLcnIdx = schema.getFactorySchemaDef().newDefLcnIdxKey(); existingKeyDefLcnIdx.setOptionalDefaultLicenseId(existing.getOptionalDefaultLicenseId()); MSSBamSchemaDefByDefLcnIdxKey newKeyDefLcnIdx = schema.getFactorySchemaDef().newDefLcnIdxKey(); newKeyDefLcnIdx.setOptionalDefaultLicenseId(Buff.getOptionalDefaultLicenseId()); MSSBamSchemaDefByDataScopeIdxKey existingKeyDataScopeIdx = schema.getFactorySchemaDef() .newDataScopeIdxKey(); existingKeyDataScopeIdx.setOptionalDataScopeId(existing.getOptionalDataScopeId()); MSSBamSchemaDefByDataScopeIdxKey newKeyDataScopeIdx = schema.getFactorySchemaDef().newDataScopeIdxKey(); newKeyDataScopeIdx.setOptionalDataScopeId(Buff.getOptionalDataScopeId()); MSSBamSchemaDefByVAccSecIdxKey existingKeyVAccSecIdx = schema.getFactorySchemaDef().newVAccSecIdxKey(); existingKeyVAccSecIdx.setOptionalViewAccessSecurityId(existing.getOptionalViewAccessSecurityId()); MSSBamSchemaDefByVAccSecIdxKey newKeyVAccSecIdx = schema.getFactorySchemaDef().newVAccSecIdxKey(); newKeyVAccSecIdx.setOptionalViewAccessSecurityId(Buff.getOptionalViewAccessSecurityId()); MSSBamSchemaDefByVAccFreqIdxKey existingKeyVAccFreqIdx = schema.getFactorySchemaDef().newVAccFreqIdxKey(); existingKeyVAccFreqIdx.setOptionalViewAccessFrequencyId(existing.getOptionalViewAccessFrequencyId()); MSSBamSchemaDefByVAccFreqIdxKey newKeyVAccFreqIdx = schema.getFactorySchemaDef().newVAccFreqIdxKey(); newKeyVAccFreqIdx.setOptionalViewAccessFrequencyId(Buff.getOptionalViewAccessFrequencyId()); MSSBamSchemaDefByEAccSecIdxKey existingKeyEAccSecIdx = schema.getFactorySchemaDef().newEAccSecIdxKey(); existingKeyEAccSecIdx.setOptionalEditAccessSecurityId(existing.getOptionalEditAccessSecurityId()); MSSBamSchemaDefByEAccSecIdxKey newKeyEAccSecIdx = schema.getFactorySchemaDef().newEAccSecIdxKey(); newKeyEAccSecIdx.setOptionalEditAccessSecurityId(Buff.getOptionalEditAccessSecurityId()); MSSBamSchemaDefByEAccFreqIdxKey existingKeyEAccFreqIdx = schema.getFactorySchemaDef().newEAccFreqIdxKey(); existingKeyEAccFreqIdx.setOptionalEditAccessFrequencyId(existing.getOptionalEditAccessFrequencyId()); MSSBamSchemaDefByEAccFreqIdxKey newKeyEAccFreqIdx = schema.getFactorySchemaDef().newEAccFreqIdxKey(); newKeyEAccFreqIdx.setOptionalEditAccessFrequencyId(Buff.getOptionalEditAccessFrequencyId()); // Check unique indexes // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema.getTableScope().readDerivedByIdIdx(Authorization, Buff.getRequiredId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateSchemaDef", "Superclass", "SuperClass", "Scope", null); } } } { boolean allNull = true; if (allNull) { if (null == schema.getTableVersion().readDerivedByIdIdx(Authorization, Buff.getRequiredVersionId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateSchemaDef", "Container", "Version", "Version", null); } } } // Update is valid SortedMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); subdict = dictByVersionIdx.get(existingKeyVersionIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByVersionIdx.containsKey(newKeyVersionIdx)) { subdict = dictByVersionIdx.get(newKeyVersionIdx); } else { subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff>(); dictByVersionIdx.put(newKeyVersionIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByDefLcnIdx.get(existingKeyDefLcnIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByDefLcnIdx.containsKey(newKeyDefLcnIdx)) { subdict = dictByDefLcnIdx.get(newKeyDefLcnIdx); } else { subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff>(); dictByDefLcnIdx.put(newKeyDefLcnIdx, 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, MSSBamSchemaDefBuff>(); 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, MSSBamSchemaDefBuff>(); 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, MSSBamSchemaDefBuff>(); 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, MSSBamSchemaDefBuff>(); 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, MSSBamSchemaDefBuff>(); dictByEAccFreqIdx.put(newKeyEAccFreqIdx, subdict); } subdict.put(pkey, Buff); } public void deleteSchemaDef(MSSBamAuthorization Authorization, MSSBamSchemaDefBuff Buff) { final String S_ProcName = "MSSBamRamSchemaDefTable.deleteSchemaDef() "; MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey(); pkey.setRequiredId(schema.nextAnyObjIdGen()); MSSBamSchemaDefBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteSchemaDef", "Existing record not found", "SchemaDef", pkey); } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteSchemaDef", pkey); } MSSBamSchemaDefByVersionIdxKey keyVersionIdx = schema.getFactorySchemaDef().newVersionIdxKey(); keyVersionIdx.setRequiredVersionId(existing.getRequiredVersionId()); MSSBamSchemaDefByDefLcnIdxKey keyDefLcnIdx = schema.getFactorySchemaDef().newDefLcnIdxKey(); keyDefLcnIdx.setOptionalDefaultLicenseId(existing.getOptionalDefaultLicenseId()); MSSBamSchemaDefByDataScopeIdxKey keyDataScopeIdx = schema.getFactorySchemaDef().newDataScopeIdxKey(); keyDataScopeIdx.setOptionalDataScopeId(existing.getOptionalDataScopeId()); MSSBamSchemaDefByVAccSecIdxKey keyVAccSecIdx = schema.getFactorySchemaDef().newVAccSecIdxKey(); keyVAccSecIdx.setOptionalViewAccessSecurityId(existing.getOptionalViewAccessSecurityId()); MSSBamSchemaDefByVAccFreqIdxKey keyVAccFreqIdx = schema.getFactorySchemaDef().newVAccFreqIdxKey(); keyVAccFreqIdx.setOptionalViewAccessFrequencyId(existing.getOptionalViewAccessFrequencyId()); MSSBamSchemaDefByEAccSecIdxKey keyEAccSecIdx = schema.getFactorySchemaDef().newEAccSecIdxKey(); keyEAccSecIdx.setOptionalEditAccessSecurityId(existing.getOptionalEditAccessSecurityId()); MSSBamSchemaDefByEAccFreqIdxKey keyEAccFreqIdx = schema.getFactorySchemaDef().newEAccFreqIdxKey(); keyEAccFreqIdx.setOptionalEditAccessFrequencyId(existing.getOptionalEditAccessFrequencyId()); // Validate reverse foreign keys if (schema.getTableSchemaRef().readDerivedBySchemaIdx(Authorization, existing.getRequiredId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef", "Container", "Schema", "SchemaRef", pkey); } if (schema.getTableTable().readDerivedBySchemaIdx(Authorization, existing.getRequiredId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef", "Container", "Schema", "Table", pkey); } if (schema.getTableSchemaBlob().readDerivedByContainerIdx(Authorization, existing.getRequiredId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef", "Container", "CSchema", "SchemaBlob", pkey); } if (schema.getTableSchemaBool().readDerivedByContainerIdx(Authorization, existing.getRequiredId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef", "Container", "CSchema", "SchemaBool", pkey); } if (schema.getTableSchemaDate().readDerivedByContainerIdx(Authorization, existing.getRequiredId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef", "Container", "CSchema", "SchemaDate", pkey); } if (schema.getTableSchemaDouble().readDerivedByContainerIdx(Authorization, existing.getRequiredId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef", "Container", "CSchema", "SchemaDouble", pkey); } if (schema.getTableSchemaNumber().readDerivedByContainerIdx(Authorization, existing.getRequiredId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef", "Container", "CSchema", "SchemaNumber", pkey); } if (schema.getTableSchemaFloat().readDerivedByContainerIdx(Authorization, existing.getRequiredId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef", "Container", "CSchema", "SchemaFloat", pkey); } if (schema.getTableSchemaInt16().readDerivedByContainerIdx(Authorization, existing.getRequiredId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef", "Container", "CSchema", "SchemaInt16", pkey); } if (schema.getTableSchemaEnum().readDerivedByContainerIdx(Authorization, existing.getRequiredId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef", "Container", "CSchema", "SchemaEnum", pkey); } if (schema.getTableSchemaId16Gen().readDerivedByContainerIdx(Authorization, existing.getRequiredId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef", "Container", "CSchema", "SchemaId16Gen", pkey); } if (schema.getTableSchemaUInt16().readDerivedByContainerIdx(Authorization, existing.getRequiredId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef", "Container", "CSchema", "SchemaUInt16", pkey); } if (schema.getTableSchemaInt32().readDerivedByContainerIdx(Authorization, existing.getRequiredId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef", "Container", "CSchema", "SchemaInt32", pkey); } if (schema.getTableSchemaId32Gen().readDerivedByContainerIdx(Authorization, existing.getRequiredId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef", "Container", "CSchema", "SchemaId32Gen", pkey); } if (schema.getTableSchemaUInt32().readDerivedByContainerIdx(Authorization, existing.getRequiredId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef", "Container", "CSchema", "SchemaUInt32", pkey); } if (schema.getTableSchemaInt64().readDerivedByContainerIdx(Authorization, existing.getRequiredId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef", "Container", "CSchema", "SchemaInt64", pkey); } if (schema.getTableSchemaId64Gen().readDerivedByContainerIdx(Authorization, existing.getRequiredId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef", "Container", "CSchema", "SchemaId64Gen", pkey); } if (schema.getTableSchemaUInt64().readDerivedByContainerIdx(Authorization, existing.getRequiredId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef", "Container", "CSchema", "SchemaUInt64", pkey); } if (schema.getTableSchemaNmToken().readDerivedByContainerIdx(Authorization, existing.getRequiredId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef", "Container", "CSchema", "SchemaNmToken", pkey); } if (schema.getTableSchemaNmTokens().readDerivedByContainerIdx(Authorization, existing.getRequiredId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef", "Container", "CSchema", "SchemaNmTokens", pkey); } if (schema.getTableSchemaString().readDerivedByContainerIdx(Authorization, existing.getRequiredId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef", "Container", "CSchema", "SchemaString", pkey); } if (schema.getTableSchemaTZDate().readDerivedByContainerIdx(Authorization, existing.getRequiredId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef", "Container", "CSchema", "SchemaTZDate", pkey); } if (schema.getTableSchemaTZTime().readDerivedByContainerIdx(Authorization, existing.getRequiredId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef", "Container", "CSchema", "SchemaTZTime", pkey); } if (schema.getTableSchemaTZTimestamp().readDerivedByContainerIdx(Authorization, existing.getRequiredId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef", "Container", "CSchema", "SchemaTZTimestamp", pkey); } if (schema.getTableSchemaText().readDerivedByContainerIdx(Authorization, existing.getRequiredId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef", "Container", "CSchema", "SchemaText", pkey); } if (schema.getTableSchemaTime().readDerivedByContainerIdx(Authorization, existing.getRequiredId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef", "Container", "CSchema", "SchemaTime", pkey); } if (schema.getTableSchemaTimestamp().readDerivedByContainerIdx(Authorization, existing.getRequiredId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef", "Container", "CSchema", "SchemaTimestamp", pkey); } if (schema.getTableSchemaToken().readDerivedByContainerIdx(Authorization, existing.getRequiredId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef", "Container", "CSchema", "SchemaToken", pkey); } if (schema.getTableSchemaUuid().readDerivedByContainerIdx(Authorization, existing.getRequiredId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef", "Container", "CSchema", "SchemaUuid", pkey); } if (schema.getTableSchemaUuidGen().readDerivedByContainerIdx(Authorization, existing.getRequiredId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSchemaDef", "Container", "CSchema", "SchemaUuidGen", pkey); } // Delete is valid SortedMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff> subdict; dictByPKey.remove(pkey); subdict = dictByVersionIdx.get(keyVersionIdx); subdict.remove(pkey); subdict = dictByDefLcnIdx.get(keyDefLcnIdx); 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); } public MSSBamCursor openSchemaDefCursorAll(MSSBamAuthorization Authorization) { MSSBamCursor cursor = new MSSBamRamSchemaDefCursor(Authorization, schema, dictByPKey.values()); return (cursor); } public MSSBamCursor openSchemaDefCursorByVersionIdx(MSSBamAuthorization Authorization, long VersionId) { MSSBamCursor cursor; MSSBamSchemaDefByVersionIdxKey key = schema.getFactorySchemaDef().newVersionIdxKey(); key.setRequiredVersionId(VersionId); if (dictByVersionIdx.containsKey(key)) { SortedMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff> subdictVersionIdx = dictByVersionIdx.get(key); cursor = new MSSBamRamSchemaDefCursor(Authorization, schema, subdictVersionIdx.values()); } else { cursor = new MSSBamRamSchemaDefCursor(Authorization, schema, new ArrayList<MSSBamSchemaDefBuff>()); } return (cursor); } public MSSBamCursor openSchemaDefCursorByDefLcnIdx(MSSBamAuthorization Authorization, Long DefaultLicenseId) { MSSBamCursor cursor; MSSBamSchemaDefByDefLcnIdxKey key = schema.getFactorySchemaDef().newDefLcnIdxKey(); key.setOptionalDefaultLicenseId(DefaultLicenseId); if (dictByDefLcnIdx.containsKey(key)) { SortedMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff> subdictDefLcnIdx = dictByDefLcnIdx.get(key); cursor = new MSSBamRamSchemaDefCursor(Authorization, schema, subdictDefLcnIdx.values()); } else { cursor = new MSSBamRamSchemaDefCursor(Authorization, schema, new ArrayList<MSSBamSchemaDefBuff>()); } return (cursor); } public MSSBamCursor openSchemaDefCursorByDataScopeIdx(MSSBamAuthorization Authorization, Short DataScopeId) { MSSBamCursor cursor; MSSBamSchemaDefByDataScopeIdxKey key = schema.getFactorySchemaDef().newDataScopeIdxKey(); key.setOptionalDataScopeId(DataScopeId); if (dictByDataScopeIdx.containsKey(key)) { SortedMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff> subdictDataScopeIdx = dictByDataScopeIdx.get(key); cursor = new MSSBamRamSchemaDefCursor(Authorization, schema, subdictDataScopeIdx.values()); } else { cursor = new MSSBamRamSchemaDefCursor(Authorization, schema, new ArrayList<MSSBamSchemaDefBuff>()); } return (cursor); } public MSSBamCursor openSchemaDefCursorByVAccSecIdx(MSSBamAuthorization Authorization, Short ViewAccessSecurityId) { MSSBamCursor cursor; MSSBamSchemaDefByVAccSecIdxKey key = schema.getFactorySchemaDef().newVAccSecIdxKey(); key.setOptionalViewAccessSecurityId(ViewAccessSecurityId); if (dictByVAccSecIdx.containsKey(key)) { SortedMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff> subdictVAccSecIdx = dictByVAccSecIdx.get(key); cursor = new MSSBamRamSchemaDefCursor(Authorization, schema, subdictVAccSecIdx.values()); } else { cursor = new MSSBamRamSchemaDefCursor(Authorization, schema, new ArrayList<MSSBamSchemaDefBuff>()); } return (cursor); } public MSSBamCursor openSchemaDefCursorByVAccFreqIdx(MSSBamAuthorization Authorization, Short ViewAccessFrequencyId) { MSSBamCursor cursor; MSSBamSchemaDefByVAccFreqIdxKey key = schema.getFactorySchemaDef().newVAccFreqIdxKey(); key.setOptionalViewAccessFrequencyId(ViewAccessFrequencyId); if (dictByVAccFreqIdx.containsKey(key)) { SortedMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff> subdictVAccFreqIdx = dictByVAccFreqIdx.get(key); cursor = new MSSBamRamSchemaDefCursor(Authorization, schema, subdictVAccFreqIdx.values()); } else { cursor = new MSSBamRamSchemaDefCursor(Authorization, schema, new ArrayList<MSSBamSchemaDefBuff>()); } return (cursor); } public MSSBamCursor openSchemaDefCursorByEAccSecIdx(MSSBamAuthorization Authorization, Short EditAccessSecurityId) { MSSBamCursor cursor; MSSBamSchemaDefByEAccSecIdxKey key = schema.getFactorySchemaDef().newEAccSecIdxKey(); key.setOptionalEditAccessSecurityId(EditAccessSecurityId); if (dictByEAccSecIdx.containsKey(key)) { SortedMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff> subdictEAccSecIdx = dictByEAccSecIdx.get(key); cursor = new MSSBamRamSchemaDefCursor(Authorization, schema, subdictEAccSecIdx.values()); } else { cursor = new MSSBamRamSchemaDefCursor(Authorization, schema, new ArrayList<MSSBamSchemaDefBuff>()); } return (cursor); } public MSSBamCursor openSchemaDefCursorByEAccFreqIdx(MSSBamAuthorization Authorization, Short EditAccessFrequencyId) { MSSBamCursor cursor; MSSBamSchemaDefByEAccFreqIdxKey key = schema.getFactorySchemaDef().newEAccFreqIdxKey(); key.setOptionalEditAccessFrequencyId(EditAccessFrequencyId); if (dictByEAccFreqIdx.containsKey(key)) { SortedMap<MSSBamAnyObjPKey, MSSBamSchemaDefBuff> subdictEAccFreqIdx = dictByEAccFreqIdx.get(key); cursor = new MSSBamRamSchemaDefCursor(Authorization, schema, subdictEAccFreqIdx.values()); } else { cursor = new MSSBamRamSchemaDefCursor(Authorization, schema, new ArrayList<MSSBamSchemaDefBuff>()); } return (cursor); } public void closeSchemaDefCursor(MSSBamCursor Cursor) { // Cursor.DataReader.Close(); } public MSSBamSchemaDefBuff nextSchemaDefCursor(MSSBamCursor Cursor) { MSSBamRamSchemaDefCursor cursor = (MSSBamRamSchemaDefCursor) Cursor; MSSBamSchemaDefBuff rec = cursor.getCursor().next(); cursor.setRowIdx(cursor.getRowIdx() + 1); return (rec); } public MSSBamSchemaDefBuff prevSchemaDefCursor(MSSBamCursor Cursor) { int targetRowIdx = (Cursor.getRowIdx() > 1) ? Cursor.getRowIdx() - 1 : 1; MSSBamSchemaDefBuff rec = null; if (Cursor.getRowIdx() >= targetRowIdx) { Cursor.reset(); } while (Cursor.getRowIdx() < targetRowIdx) { rec = nextSchemaDefCursor(Cursor); } return (rec); } public MSSBamSchemaDefBuff firstSchemaDefCursor(MSSBamCursor Cursor) { int targetRowIdx = 1; MSSBamSchemaDefBuff rec = null; Cursor.reset(); while (Cursor.getRowIdx() < targetRowIdx) { rec = nextSchemaDefCursor(Cursor); } return (rec); } public MSSBamSchemaDefBuff lastSchemaDefCursor(MSSBamCursor Cursor) { throw CFLib.getDefaultExceptionFactory().newNotImplementedYetException(getClass(), "lastSchemaDefCursor"); } public MSSBamSchemaDefBuff nthSchemaDefCursor(MSSBamCursor Cursor, int Idx) { int targetRowIdx = Idx; MSSBamSchemaDefBuff rec = null; if (Cursor.getRowIdx() >= targetRowIdx) { Cursor.reset(); } while (Cursor.getRowIdx() < targetRowIdx) { rec = nextSchemaDefCursor(Cursor); } return (rec); } }