List of usage examples for java.util SortedMap remove
V remove(Object key);
From source file:net.sourceforge.msscodefactory.v1_10.MSSBamRam.MSSBamRamValueTable.java
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); }//from www .jav a 2s.c om 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); }
From source file:net.sourceforge.msscodefactory.v1_11.MSSBamRam.MSSBamRamAnyObjTable.java
public void updateAnyObj(MSSBamAuthorization Authorization, MSSBamAnyObjBuff Buff) { MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey(); pkey.setClassCode(Buff.getClassCode()); pkey.setRequiredId(Buff.getRequiredId()); MSSBamAnyObjBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateAnyObj", "Existing record not found", "AnyObj", pkey); }/*from w ww .j a v a 2s . c om*/ if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateAnyObj", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); MSSBamAnyObjByTenantIdxKey existingKeyTenantIdx = schema.getFactoryAnyObj().newTenantIdxKey(); existingKeyTenantIdx.setRequiredTenantId(existing.getRequiredTenantId()); MSSBamAnyObjByTenantIdxKey newKeyTenantIdx = schema.getFactoryAnyObj().newTenantIdxKey(); newKeyTenantIdx.setRequiredTenantId(Buff.getRequiredTenantId()); MSSBamAnyObjByScopeIdxKey existingKeyScopeIdx = schema.getFactoryAnyObj().newScopeIdxKey(); existingKeyScopeIdx.setOptionalScopeId(existing.getOptionalScopeId()); MSSBamAnyObjByScopeIdxKey newKeyScopeIdx = schema.getFactoryAnyObj().newScopeIdxKey(); newKeyScopeIdx.setOptionalScopeId(Buff.getOptionalScopeId()); MSSBamAnyObjByDefSchemaIdxKey existingKeyDefSchemaIdx = schema.getFactoryAnyObj().newDefSchemaIdxKey(); existingKeyDefSchemaIdx.setOptionalDefSchemaId(existing.getOptionalDefSchemaId()); MSSBamAnyObjByDefSchemaIdxKey newKeyDefSchemaIdx = schema.getFactoryAnyObj().newDefSchemaIdxKey(); newKeyDefSchemaIdx.setOptionalDefSchemaId(Buff.getOptionalDefSchemaId()); MSSBamAnyObjByAuthorIdxKey existingKeyAuthorIdx = schema.getFactoryAnyObj().newAuthorIdxKey(); existingKeyAuthorIdx.setOptionalAuthorId(existing.getOptionalAuthorId()); MSSBamAnyObjByAuthorIdxKey newKeyAuthorIdx = schema.getFactoryAnyObj().newAuthorIdxKey(); newKeyAuthorIdx.setOptionalAuthorId(Buff.getOptionalAuthorId()); MSSBamAnyObjByUNameIdxKey existingKeyUNameIdx = schema.getFactoryAnyObj().newUNameIdxKey(); existingKeyUNameIdx.setOptionalScopeId(existing.getOptionalScopeId()); existingKeyUNameIdx.setRequiredName(existing.getRequiredName()); MSSBamAnyObjByUNameIdxKey newKeyUNameIdx = schema.getFactoryAnyObj().newUNameIdxKey(); newKeyUNameIdx.setOptionalScopeId(Buff.getOptionalScopeId()); newKeyUNameIdx.setRequiredName(Buff.getRequiredName()); // Check unique indexes if (!existingKeyUNameIdx.equals(newKeyUNameIdx)) { if (dictByUNameIdx.containsKey(newKeyUNameIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "updateAnyObj", "AnyObjUNameIdx", newKeyUNameIdx); } } // Validate foreign keys // Update is valid SortedMap<MSSBamAnyObjPKey, MSSBamAnyObjBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); subdict = dictByTenantIdx.get(existingKeyTenantIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByTenantIdx.containsKey(newKeyTenantIdx)) { subdict = dictByTenantIdx.get(newKeyTenantIdx); } else { subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamAnyObjBuff>(); dictByTenantIdx.put(newKeyTenantIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByScopeIdx.get(existingKeyScopeIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByScopeIdx.containsKey(newKeyScopeIdx)) { subdict = dictByScopeIdx.get(newKeyScopeIdx); } else { subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamAnyObjBuff>(); dictByScopeIdx.put(newKeyScopeIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByDefSchemaIdx.get(existingKeyDefSchemaIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByDefSchemaIdx.containsKey(newKeyDefSchemaIdx)) { subdict = dictByDefSchemaIdx.get(newKeyDefSchemaIdx); } else { subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamAnyObjBuff>(); dictByDefSchemaIdx.put(newKeyDefSchemaIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByAuthorIdx.get(existingKeyAuthorIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByAuthorIdx.containsKey(newKeyAuthorIdx)) { subdict = dictByAuthorIdx.get(newKeyAuthorIdx); } else { subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamAnyObjBuff>(); dictByAuthorIdx.put(newKeyAuthorIdx, subdict); } subdict.put(pkey, Buff); dictByUNameIdx.remove(existingKeyUNameIdx); dictByUNameIdx.put(newKeyUNameIdx, Buff); }
From source file:net.sourceforge.msscodefactory.v1_11.MSSBamRam.MSSBamRamAnyObjTable.java
public void deleteAnyObj(MSSBamAuthorization Authorization, MSSBamAnyObjBuff Buff) { final String S_ProcName = "MSSBamRamAnyObjTable.deleteAnyObj() "; MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey(); pkey.setClassCode(Buff.getClassCode()); pkey.setRequiredId(schema.nextAnyObjIdGen()); MSSBamAnyObjBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteAnyObj", "Existing record not found", "AnyObj", pkey); }/*from w ww. ja v a2s. c o m*/ if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteAnyObj", pkey); } MSSBamAnyObjByTenantIdxKey keyTenantIdx = schema.getFactoryAnyObj().newTenantIdxKey(); keyTenantIdx.setRequiredTenantId(existing.getRequiredTenantId()); MSSBamAnyObjByScopeIdxKey keyScopeIdx = schema.getFactoryAnyObj().newScopeIdxKey(); keyScopeIdx.setOptionalScopeId(existing.getOptionalScopeId()); MSSBamAnyObjByDefSchemaIdxKey keyDefSchemaIdx = schema.getFactoryAnyObj().newDefSchemaIdxKey(); keyDefSchemaIdx.setOptionalDefSchemaId(existing.getOptionalDefSchemaId()); MSSBamAnyObjByAuthorIdxKey keyAuthorIdx = schema.getFactoryAnyObj().newAuthorIdxKey(); keyAuthorIdx.setOptionalAuthorId(existing.getOptionalAuthorId()); MSSBamAnyObjByUNameIdxKey keyUNameIdx = schema.getFactoryAnyObj().newUNameIdxKey(); keyUNameIdx.setOptionalScopeId(existing.getOptionalScopeId()); keyUNameIdx.setRequiredName(existing.getRequiredName()); // Validate reverse foreign keys if (schema.getTableScope().readDerivedByIdIdx(Authorization, existing.getRequiredId()) != null) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteAnyObj", "Superclass", "SuperClass", "Scope", pkey); } if (schema.getTableLicense().readDerivedByIdIdx(Authorization, existing.getRequiredId()) != null) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteAnyObj", "Superclass", "SuperClass", "License", pkey); } if (schema.getTableManufactureToolSet().readDerivedByIdIdx(Authorization, existing.getRequiredId()) != null) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteAnyObj", "Superclass", "SuperClass", "ManufactureToolSet", pkey); } if (schema.getTableChain().readDerivedByIdIdx(Authorization, existing.getRequiredId()) != null) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteAnyObj", "Superclass", "SuperClass", "Chain", pkey); } if (schema.getTableSchemaRef().readDerivedByIdIdx(Authorization, existing.getRequiredId()) != null) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteAnyObj", "Superclass", "SuperClass", "SchemaRef", pkey); } if (schema.getTableRelationCol().readDerivedByIdIdx(Authorization, existing.getRequiredId()) != null) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteAnyObj", "Superclass", "SuperClass", "RelationCol", pkey); } if (schema.getTableRelGroupValue().readDerivedByIdIdx(Authorization, existing.getRequiredId()) != null) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteAnyObj", "Superclass", "SuperClass", "RelGroupValue", pkey); } if (schema.getTableEnumTag().readDerivedByIdIdx(Authorization, existing.getRequiredId()) != null) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteAnyObj", "Superclass", "SuperClass", "EnumTag", pkey); } if (schema.getTableIndexCol().readDerivedByIdIdx(Authorization, existing.getRequiredId()) != null) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteAnyObj", "Superclass", "SuperClass", "IndexCol", pkey); } // Delete is valid SortedMap<MSSBamAnyObjPKey, MSSBamAnyObjBuff> subdict; dictByPKey.remove(pkey); subdict = dictByTenantIdx.get(keyTenantIdx); subdict.remove(pkey); subdict = dictByScopeIdx.get(keyScopeIdx); subdict.remove(pkey); subdict = dictByDefSchemaIdx.get(keyDefSchemaIdx); subdict.remove(pkey); subdict = dictByAuthorIdx.get(keyAuthorIdx); subdict.remove(pkey); dictByUNameIdx.remove(keyUNameIdx); }
From source file:net.sourceforge.msscodefactory.v1_11.MSSBamRam.MSSBamRamChainTable.java
public void updateChain(MSSBamAuthorization Authorization, MSSBamChainBuff Buff) { MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey(); pkey.setRequiredId(Buff.getRequiredId()); MSSBamChainBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateChain", "Existing record not found", "Chain", pkey); }//w ww. j a v a 2 s . c om MSSBamChainByTableIdxKey existingKeyTableIdx = schema.getFactoryChain().newTableIdxKey(); existingKeyTableIdx.setRequiredTableId(existing.getRequiredTableId()); MSSBamChainByTableIdxKey newKeyTableIdx = schema.getFactoryChain().newTableIdxKey(); newKeyTableIdx.setRequiredTableId(Buff.getRequiredTableId()); MSSBamChainByPrevRelIdxKey existingKeyPrevRelIdx = schema.getFactoryChain().newPrevRelIdxKey(); existingKeyPrevRelIdx.setRequiredPrevRelationId(existing.getRequiredPrevRelationId()); MSSBamChainByPrevRelIdxKey newKeyPrevRelIdx = schema.getFactoryChain().newPrevRelIdxKey(); newKeyPrevRelIdx.setRequiredPrevRelationId(Buff.getRequiredPrevRelationId()); MSSBamChainByNextRelIdxKey existingKeyNextRelIdx = schema.getFactoryChain().newNextRelIdxKey(); existingKeyNextRelIdx.setRequiredNextRelationId(existing.getRequiredNextRelationId()); MSSBamChainByNextRelIdxKey newKeyNextRelIdx = schema.getFactoryChain().newNextRelIdxKey(); newKeyNextRelIdx.setRequiredNextRelationId(Buff.getRequiredNextRelationId()); // Check unique indexes // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema.getTableAnyObj().readDerivedByIdIdx(Authorization, Buff.getRequiredId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateChain", "Superclass", "SuperClass", "AnyObj", null); } } } { boolean allNull = true; if (allNull) { if (null == schema.getTableTable().readDerivedByIdIdx(Authorization, Buff.getRequiredTableId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateChain", "Container", "Table", "Table", null); } } } { boolean allNull = true; if (allNull) { if (null == schema.getTableRelation().readDerivedByIdIdx(Authorization, Buff.getRequiredPrevRelationId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateChain", "Lookup", "PrevRelation", "Relation", null); } } } { boolean allNull = true; if (allNull) { if (null == schema.getTableRelation().readDerivedByIdIdx(Authorization, Buff.getRequiredNextRelationId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateChain", "Lookup", "NextRelation", "Relation", null); } } } // Update is valid SortedMap<MSSBamAnyObjPKey, MSSBamChainBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); subdict = dictByTableIdx.get(existingKeyTableIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByTableIdx.containsKey(newKeyTableIdx)) { subdict = dictByTableIdx.get(newKeyTableIdx); } else { subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamChainBuff>(); dictByTableIdx.put(newKeyTableIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByPrevRelIdx.get(existingKeyPrevRelIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByPrevRelIdx.containsKey(newKeyPrevRelIdx)) { subdict = dictByPrevRelIdx.get(newKeyPrevRelIdx); } else { subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamChainBuff>(); dictByPrevRelIdx.put(newKeyPrevRelIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByNextRelIdx.get(existingKeyNextRelIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByNextRelIdx.containsKey(newKeyNextRelIdx)) { subdict = dictByNextRelIdx.get(newKeyNextRelIdx); } else { subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamChainBuff>(); dictByNextRelIdx.put(newKeyNextRelIdx, subdict); } subdict.put(pkey, Buff); }
From source file:net.sourceforge.msscodefactory.v1_11.MSSBamRam.MSSBamRamChainTable.java
public void deleteChain(MSSBamAuthorization Authorization, MSSBamChainBuff Buff) { final String S_ProcName = "MSSBamRamChainTable.deleteChain() "; MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey(); pkey.setRequiredId(schema.nextAnyObjIdGen()); MSSBamChainBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteChain", "Existing record not found", "Chain", pkey); }//from w w w. j a v a 2 s.c o m if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteChain", pkey); } MSSBamChainByTableIdxKey keyTableIdx = schema.getFactoryChain().newTableIdxKey(); keyTableIdx.setRequiredTableId(existing.getRequiredTableId()); MSSBamChainByPrevRelIdxKey keyPrevRelIdx = schema.getFactoryChain().newPrevRelIdxKey(); keyPrevRelIdx.setRequiredPrevRelationId(existing.getRequiredPrevRelationId()); MSSBamChainByNextRelIdxKey keyNextRelIdx = schema.getFactoryChain().newNextRelIdxKey(); keyNextRelIdx.setRequiredNextRelationId(existing.getRequiredNextRelationId()); // Validate reverse foreign keys // Delete is valid SortedMap<MSSBamAnyObjPKey, MSSBamChainBuff> subdict; dictByPKey.remove(pkey); subdict = dictByTableIdx.get(keyTableIdx); subdict.remove(pkey); subdict = dictByPrevRelIdx.get(keyPrevRelIdx); subdict.remove(pkey); subdict = dictByNextRelIdx.get(keyNextRelIdx); subdict.remove(pkey); }
From source file:net.sourceforge.msscodefactory.v1_11.MSSBamRam.MSSBamRamClearDepTable.java
public void updateClearDep(MSSBamAuthorization Authorization, MSSBamClearDepBuff Buff) { MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey(); pkey.setRequiredId(Buff.getRequiredId()); MSSBamClearDepBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateClearDep", "Existing record not found", "ClearDep", pkey); }/*from w ww .j a v a 2 s . co m*/ MSSBamClearDepByTableIdxKey existingKeyTableIdx = schema.getFactoryClearDep().newTableIdxKey(); existingKeyTableIdx.setRequiredRelationId(existing.getRequiredRelationId()); MSSBamClearDepByTableIdxKey newKeyTableIdx = schema.getFactoryClearDep().newTableIdxKey(); newKeyTableIdx.setRequiredRelationId(Buff.getRequiredRelationId()); // Check unique indexes // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema.getTableScope().readDerivedByIdIdx(Authorization, Buff.getRequiredId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateClearDep", "Superclass", "SuperClass", "Scope", null); } } } { boolean allNull = true; if (allNull) { if (null == schema.getTableRelation().readDerivedByIdIdx(Authorization, Buff.getRequiredRelationId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateClearDep", "Lookup", "Relation", "Relation", null); } } } // Update is valid SortedMap<MSSBamAnyObjPKey, MSSBamClearDepBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); subdict = dictByTableIdx.get(existingKeyTableIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByTableIdx.containsKey(newKeyTableIdx)) { subdict = dictByTableIdx.get(newKeyTableIdx); } else { subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamClearDepBuff>(); dictByTableIdx.put(newKeyTableIdx, subdict); } subdict.put(pkey, Buff); }
From source file:net.sourceforge.msscodefactory.v1_11.MSSBamRam.MSSBamRamClearDepTable.java
public void deleteClearDep(MSSBamAuthorization Authorization, MSSBamClearDepBuff Buff) { final String S_ProcName = "MSSBamRamClearDepTable.deleteClearDep() "; MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey(); pkey.setRequiredId(schema.nextAnyObjIdGen()); MSSBamClearDepBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteClearDep", "Existing record not found", "ClearDep", pkey); }/*from ww w. j a va 2 s . co m*/ if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteClearDep", pkey); } MSSBamClearDepByTableIdxKey keyTableIdx = schema.getFactoryClearDep().newTableIdxKey(); keyTableIdx.setRequiredRelationId(existing.getRequiredRelationId()); // Validate reverse foreign keys if (schema.getTableClearTopDep().readDerivedByIdIdx(Authorization, existing.getRequiredId()) != null) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteClearDep", "Superclass", "SuperClass", "ClearTopDep", pkey); } if (schema.getTableClearSubDep1().readDerivedByIdIdx(Authorization, existing.getRequiredId()) != null) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteClearDep", "Superclass", "SuperClass", "ClearSubDep1", pkey); } if (schema.getTableClearSubDep2().readDerivedByIdIdx(Authorization, existing.getRequiredId()) != null) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteClearDep", "Superclass", "SuperClass", "ClearSubDep2", pkey); } if (schema.getTableClearSubDep3().readDerivedByIdIdx(Authorization, existing.getRequiredId()) != null) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteClearDep", "Superclass", "SuperClass", "ClearSubDep3", pkey); } // Delete is valid SortedMap<MSSBamAnyObjPKey, MSSBamClearDepBuff> subdict; dictByPKey.remove(pkey); subdict = dictByTableIdx.get(keyTableIdx); subdict.remove(pkey); }
From source file:net.sourceforge.msscodefactory.v1_11.MSSBamRam.MSSBamRamClearSubDep1Table.java
public void updateClearSubDep1(MSSBamAuthorization Authorization, MSSBamClearSubDep1Buff Buff) { MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey(); pkey.setRequiredId(Buff.getRequiredId()); MSSBamClearSubDep1Buff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateClearSubDep1", "Existing record not found", "ClearSubDep1", pkey); }/*from w w w. j av a 2 s . c o m*/ MSSBamClearSubDep1ByContClearTopIdxKey existingKeyContClearTopIdx = schema.getFactoryClearSubDep1() .newContClearTopIdxKey(); existingKeyContClearTopIdx.setRequiredContClearTopDepId(existing.getRequiredContClearTopDepId()); MSSBamClearSubDep1ByContClearTopIdxKey newKeyContClearTopIdx = schema.getFactoryClearSubDep1() .newContClearTopIdxKey(); newKeyContClearTopIdx.setRequiredContClearTopDepId(Buff.getRequiredContClearTopDepId()); // Check unique indexes // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema.getTableClearDep().readDerivedByIdIdx(Authorization, Buff.getRequiredId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateClearSubDep1", "Superclass", "SuperClass", "ClearDep", null); } } } { boolean allNull = true; if (allNull) { if (null == schema.getTableClearTopDep().readDerivedByIdIdx(Authorization, Buff.getRequiredContClearTopDepId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateClearSubDep1", "Container", "ContClearTopDep", "ClearTopDep", null); } } } // Update is valid SortedMap<MSSBamAnyObjPKey, MSSBamClearSubDep1Buff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); subdict = dictByContClearTopIdx.get(existingKeyContClearTopIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByContClearTopIdx.containsKey(newKeyContClearTopIdx)) { subdict = dictByContClearTopIdx.get(newKeyContClearTopIdx); } else { subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamClearSubDep1Buff>(); dictByContClearTopIdx.put(newKeyContClearTopIdx, subdict); } subdict.put(pkey, Buff); }
From source file:net.sourceforge.msscodefactory.v1_11.MSSBamRam.MSSBamRamClearSubDep1Table.java
public void deleteClearSubDep1(MSSBamAuthorization Authorization, MSSBamClearSubDep1Buff Buff) { final String S_ProcName = "MSSBamRamClearSubDep1Table.deleteClearSubDep1() "; MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey(); pkey.setRequiredId(schema.nextAnyObjIdGen()); MSSBamClearSubDep1Buff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteClearSubDep1", "Existing record not found", "ClearSubDep1", pkey); }/*from w w w . j a v a 2 s . c o m*/ if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteClearSubDep1", pkey); } MSSBamClearSubDep1ByContClearTopIdxKey keyContClearTopIdx = schema.getFactoryClearSubDep1() .newContClearTopIdxKey(); keyContClearTopIdx.setRequiredContClearTopDepId(existing.getRequiredContClearTopDepId()); // Validate reverse foreign keys if (schema.getTableClearSubDep2().readDerivedByContClearDep1Idx(Authorization, existing.getRequiredId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteClearSubDep1", "Container", "ContClearSubDep1", "ClearSubDep2", pkey); } // Delete is valid SortedMap<MSSBamAnyObjPKey, MSSBamClearSubDep1Buff> subdict; dictByPKey.remove(pkey); subdict = dictByContClearTopIdx.get(keyContClearTopIdx); subdict.remove(pkey); }
From source file:net.sourceforge.msscodefactory.v1_11.MSSBamRam.MSSBamRamClearSubDep2Table.java
public void updateClearSubDep2(MSSBamAuthorization Authorization, MSSBamClearSubDep2Buff Buff) { MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey(); pkey.setRequiredId(Buff.getRequiredId()); MSSBamClearSubDep2Buff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateClearSubDep2", "Existing record not found", "ClearSubDep2", pkey); }//from w ww. java2 s . c o m MSSBamClearSubDep2ByContClearDep1IdxKey existingKeyContClearDep1Idx = schema.getFactoryClearSubDep2() .newContClearDep1IdxKey(); existingKeyContClearDep1Idx.setRequiredContClearDep1Id(existing.getRequiredContClearDep1Id()); MSSBamClearSubDep2ByContClearDep1IdxKey newKeyContClearDep1Idx = schema.getFactoryClearSubDep2() .newContClearDep1IdxKey(); newKeyContClearDep1Idx.setRequiredContClearDep1Id(Buff.getRequiredContClearDep1Id()); // Check unique indexes // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema.getTableClearDep().readDerivedByIdIdx(Authorization, Buff.getRequiredId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateClearSubDep2", "Superclass", "SuperClass", "ClearDep", null); } } } { boolean allNull = true; if (allNull) { if (null == schema.getTableClearSubDep1().readDerivedByIdIdx(Authorization, Buff.getRequiredContClearDep1Id())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateClearSubDep2", "Container", "ContClearSubDep1", "ClearSubDep1", null); } } } // Update is valid SortedMap<MSSBamAnyObjPKey, MSSBamClearSubDep2Buff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); subdict = dictByContClearDep1Idx.get(existingKeyContClearDep1Idx); if (subdict != null) { subdict.remove(pkey); } if (dictByContClearDep1Idx.containsKey(newKeyContClearDep1Idx)) { subdict = dictByContClearDep1Idx.get(newKeyContClearDep1Idx); } else { subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamClearSubDep2Buff>(); dictByContClearDep1Idx.put(newKeyContClearDep1Idx, subdict); } subdict.put(pkey, Buff); }