List of usage examples for java.util SortedMap remove
V remove(Object key);
From source file:net.sourceforge.msscodefactory.v1_10.MSSBamRam.MSSBamRamAccessSecurityTable.java
public void deleteAccessSecurity(MSSBamAuthorization Authorization, MSSBamAccessSecurityBuff Buff) { final String S_ProcName = "MSSBamRamAccessSecurityTable.deleteAccessSecurity() "; MSSBamAccessSecurityPKey pkey = schema.getFactoryAccessSecurity().newPKey(); pkey.setRequiredId(Buff.getRequiredId()); MSSBamAccessSecurityBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteAccessSecurity", "Existing record not found", "AccessSecurity", pkey); }//from w w w.ja va2 s.c om if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteAccessSecurity", pkey); } MSSBamAccessSecurityByUNameIdxKey keyUNameIdx = schema.getFactoryAccessSecurity().newUNameIdxKey(); keyUNameIdx.setRequiredName(existing.getRequiredName()); // Validate reverse foreign keys // Delete is valid SortedMap<MSSBamAccessSecurityPKey, MSSBamAccessSecurityBuff> subdict; dictByPKey.remove(pkey); subdict = dictByUNameIdx.get(keyUNameIdx); subdict.remove(pkey); }
From source file:net.sourceforge.msscodefactory.v1_10.MSSBamRam.MSSBamRamAddressTable.java
public void updateAddress(MSSBamAuthorization Authorization, MSSBamAddressBuff Buff) { MSSBamAddressPKey pkey = schema.getFactoryAddress().newPKey(); pkey.setRequiredAddressId(Buff.getRequiredAddressId()); MSSBamAddressBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateAddress", "Existing record not found", "Address", pkey); }/*w w w.j a v a 2 s. c o m*/ if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateAddress", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); MSSBamAddressByContactIdxKey existingKeyContactIdx = schema.getFactoryAddress().newContactIdxKey(); existingKeyContactIdx.setRequiredContactId(existing.getRequiredContactId()); MSSBamAddressByContactIdxKey newKeyContactIdx = schema.getFactoryAddress().newContactIdxKey(); newKeyContactIdx.setRequiredContactId(Buff.getRequiredContactId()); MSSBamAddressByUDescrIdxKey existingKeyUDescrIdx = schema.getFactoryAddress().newUDescrIdxKey(); existingKeyUDescrIdx.setRequiredContactId(existing.getRequiredContactId()); existingKeyUDescrIdx.setRequiredDescription(existing.getRequiredDescription()); MSSBamAddressByUDescrIdxKey newKeyUDescrIdx = schema.getFactoryAddress().newUDescrIdxKey(); newKeyUDescrIdx.setRequiredContactId(Buff.getRequiredContactId()); newKeyUDescrIdx.setRequiredDescription(Buff.getRequiredDescription()); // Check unique indexes if (!existingKeyUDescrIdx.equals(newKeyUDescrIdx)) { if (dictByUDescrIdx.containsKey(newKeyUDescrIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "updateAddress", "AddressUDescrIdx", newKeyUDescrIdx); } } // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema.getTableContact().readDerivedByIdIdx(Authorization, Buff.getRequiredContactId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateAddress", "Container", "Contact", "Contact", null); } } } // Update is valid SortedMap<MSSBamAddressPKey, MSSBamAddressBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); subdict = dictByContactIdx.get(existingKeyContactIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByContactIdx.containsKey(newKeyContactIdx)) { subdict = dictByContactIdx.get(newKeyContactIdx); } else { subdict = new TreeMap<MSSBamAddressPKey, MSSBamAddressBuff>(); dictByContactIdx.put(newKeyContactIdx, subdict); } subdict.put(pkey, Buff); dictByUDescrIdx.remove(existingKeyUDescrIdx); dictByUDescrIdx.put(newKeyUDescrIdx, Buff); }
From source file:net.sourceforge.msscodefactory.v1_10.MSSBamRam.MSSBamRamAddressTable.java
public void deleteAddress(MSSBamAuthorization Authorization, MSSBamAddressBuff Buff) { final String S_ProcName = "MSSBamRamAddressTable.deleteAddress() "; MSSBamAddressPKey pkey = schema.getFactoryAddress().newPKey(); pkey.setRequiredAddressId(schema.nextAddressIdGen()); MSSBamAddressBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteAddress", "Existing record not found", "Address", pkey); }/*from w ww .jav a 2 s . c om*/ if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteAddress", pkey); } MSSBamAddressByContactIdxKey keyContactIdx = schema.getFactoryAddress().newContactIdxKey(); keyContactIdx.setRequiredContactId(existing.getRequiredContactId()); MSSBamAddressByUDescrIdxKey keyUDescrIdx = schema.getFactoryAddress().newUDescrIdxKey(); keyUDescrIdx.setRequiredContactId(existing.getRequiredContactId()); keyUDescrIdx.setRequiredDescription(existing.getRequiredDescription()); // Validate reverse foreign keys if (schema.getTableAddressTag().readDerivedByAddressIdx(Authorization, existing.getRequiredAddressId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteAddress", "Container", "AddressTagAddress", "AddressTag", pkey); } // Delete is valid SortedMap<MSSBamAddressPKey, MSSBamAddressBuff> subdict; dictByPKey.remove(pkey); subdict = dictByContactIdx.get(keyContactIdx); subdict.remove(pkey); dictByUDescrIdx.remove(keyUDescrIdx); }
From source file:net.sourceforge.msscodefactory.v1_10.MSSBamRam.MSSBamRamAddressTagTable.java
public void updateAddressTag(MSSBamAuthorization Authorization, MSSBamAddressTagBuff Buff) { MSSBamAddressTagPKey pkey = schema.getFactoryAddressTag().newPKey(); pkey.setRequiredAddressId(Buff.getRequiredAddressId()); pkey.setRequiredTagId(Buff.getRequiredTagId()); MSSBamAddressTagBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateAddressTag", "Existing record not found", "AddressTag", pkey); }/*from w ww .ja va 2 s.co m*/ if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateAddressTag", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); MSSBamAddressTagByAddressIdxKey existingKeyAddressIdx = schema.getFactoryAddressTag().newAddressIdxKey(); existingKeyAddressIdx.setRequiredAddressId(existing.getRequiredAddressId()); MSSBamAddressTagByAddressIdxKey newKeyAddressIdx = schema.getFactoryAddressTag().newAddressIdxKey(); newKeyAddressIdx.setRequiredAddressId(Buff.getRequiredAddressId()); MSSBamAddressTagByTagIdxKey existingKeyTagIdx = schema.getFactoryAddressTag().newTagIdxKey(); existingKeyTagIdx.setRequiredTagId(existing.getRequiredTagId()); MSSBamAddressTagByTagIdxKey newKeyTagIdx = schema.getFactoryAddressTag().newTagIdxKey(); newKeyTagIdx.setRequiredTagId(Buff.getRequiredTagId()); // Check unique indexes // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema.getTableAddress().readDerivedByIdIdx(Authorization, Buff.getRequiredAddressId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateAddressTag", "Container", "AddressTagAddress", "Address", null); } } } { boolean allNull = true; if (allNull) { if (null == schema.getTableTag().readDerivedByIdIdx(Authorization, Buff.getRequiredTagId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateAddressTag", "Lookup", "Tag", "Tag", null); } } } // Update is valid SortedMap<MSSBamAddressTagPKey, MSSBamAddressTagBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); subdict = dictByAddressIdx.get(existingKeyAddressIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByAddressIdx.containsKey(newKeyAddressIdx)) { subdict = dictByAddressIdx.get(newKeyAddressIdx); } else { subdict = new TreeMap<MSSBamAddressTagPKey, MSSBamAddressTagBuff>(); dictByAddressIdx.put(newKeyAddressIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByTagIdx.get(existingKeyTagIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByTagIdx.containsKey(newKeyTagIdx)) { subdict = dictByTagIdx.get(newKeyTagIdx); } else { subdict = new TreeMap<MSSBamAddressTagPKey, MSSBamAddressTagBuff>(); dictByTagIdx.put(newKeyTagIdx, subdict); } subdict.put(pkey, Buff); }
From source file:net.sourceforge.msscodefactory.v1_10.MSSBamRam.MSSBamRamAddressTagTable.java
public void deleteAddressTag(MSSBamAuthorization Authorization, MSSBamAddressTagBuff Buff) { final String S_ProcName = "MSSBamRamAddressTagTable.deleteAddressTag() "; MSSBamAddressTagPKey pkey = schema.getFactoryAddressTag().newPKey(); pkey.setRequiredAddressId(Buff.getRequiredAddressId()); pkey.setRequiredTagId(Buff.getRequiredTagId()); MSSBamAddressTagBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteAddressTag", "Existing record not found", "AddressTag", pkey); }/*from w ww.j av a2 s . c o m*/ if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteAddressTag", pkey); } MSSBamAddressTagByAddressIdxKey keyAddressIdx = schema.getFactoryAddressTag().newAddressIdxKey(); keyAddressIdx.setRequiredAddressId(existing.getRequiredAddressId()); MSSBamAddressTagByTagIdxKey keyTagIdx = schema.getFactoryAddressTag().newTagIdxKey(); keyTagIdx.setRequiredTagId(existing.getRequiredTagId()); // Validate reverse foreign keys // Delete is valid SortedMap<MSSBamAddressTagPKey, MSSBamAddressTagBuff> subdict; dictByPKey.remove(pkey); subdict = dictByAddressIdx.get(keyAddressIdx); subdict.remove(pkey); subdict = dictByTagIdx.get(keyTagIdx); subdict.remove(pkey); }
From source file:net.sourceforge.msscodefactory.v1_10.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 w w . ja v a 2s .c o m 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()); 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 = 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_10.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); }// w w w . ja v a 2s . 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()); 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.getTableChain().readDerivedByIdIdx(Authorization, existing.getRequiredId()) != null) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteAnyObj", "Superclass", "SuperClass", "Chain", pkey); } if (schema.getTableRelationCol().readDerivedByIdIdx(Authorization, existing.getRequiredId()) != null) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteAnyObj", "Superclass", "SuperClass", "RelationCol", 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 = dictByAuthorIdx.get(keyAuthorIdx); subdict.remove(pkey); dictByUNameIdx.remove(keyUNameIdx); }
From source file:net.sourceforge.msscodefactory.v1_10.MSSBamRam.MSSBamRamAttachmentTable.java
public void updateAttachment(MSSBamAuthorization Authorization, MSSBamAttachmentBuff Buff) { MSSBamAttachmentPKey pkey = schema.getFactoryAttachment().newPKey(); pkey.setRequiredAttachmentId(Buff.getRequiredAttachmentId()); MSSBamAttachmentBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateAttachment", "Existing record not found", "Attachment", pkey); }//from www . java2 s.co m if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateAttachment", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); MSSBamAttachmentByContactIdxKey existingKeyContactIdx = schema.getFactoryAttachment().newContactIdxKey(); existingKeyContactIdx.setRequiredContactId(existing.getRequiredContactId()); MSSBamAttachmentByContactIdxKey newKeyContactIdx = schema.getFactoryAttachment().newContactIdxKey(); newKeyContactIdx.setRequiredContactId(Buff.getRequiredContactId()); MSSBamAttachmentByUDescrIdxKey existingKeyUDescrIdx = schema.getFactoryAttachment().newUDescrIdxKey(); existingKeyUDescrIdx.setRequiredContactId(existing.getRequiredContactId()); existingKeyUDescrIdx.setRequiredDescription(existing.getRequiredDescription()); MSSBamAttachmentByUDescrIdxKey newKeyUDescrIdx = schema.getFactoryAttachment().newUDescrIdxKey(); newKeyUDescrIdx.setRequiredContactId(Buff.getRequiredContactId()); newKeyUDescrIdx.setRequiredDescription(Buff.getRequiredDescription()); MSSBamAttachmentByMimeTypeIdxKey existingKeyMimeTypeIdx = schema.getFactoryAttachment().newMimeTypeIdxKey(); existingKeyMimeTypeIdx.setOptionalMimeTypeId(existing.getOptionalMimeTypeId()); MSSBamAttachmentByMimeTypeIdxKey newKeyMimeTypeIdx = schema.getFactoryAttachment().newMimeTypeIdxKey(); newKeyMimeTypeIdx.setOptionalMimeTypeId(Buff.getOptionalMimeTypeId()); // Check unique indexes if (!existingKeyUDescrIdx.equals(newKeyUDescrIdx)) { if (dictByUDescrIdx.containsKey(newKeyUDescrIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "updateAttachment", "AttachmentUDescrIdx", newKeyUDescrIdx); } } // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema.getTableContact().readDerivedByIdIdx(Authorization, Buff.getRequiredContactId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateAttachment", "Container", "Contact", "Contact", null); } } } { boolean allNull = true; if (Buff.getOptionalMimeTypeId() != null) { allNull = false; } if (allNull) { if (null == schema.getTableMimeType().readDerivedByIdIdx(Authorization, Buff.getOptionalMimeTypeId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateAttachment", "Lookup", "MimeType", "MimeType", null); } } } // Update is valid SortedMap<MSSBamAttachmentPKey, MSSBamAttachmentBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); subdict = dictByContactIdx.get(existingKeyContactIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByContactIdx.containsKey(newKeyContactIdx)) { subdict = dictByContactIdx.get(newKeyContactIdx); } else { subdict = new TreeMap<MSSBamAttachmentPKey, MSSBamAttachmentBuff>(); dictByContactIdx.put(newKeyContactIdx, subdict); } subdict.put(pkey, Buff); dictByUDescrIdx.remove(existingKeyUDescrIdx); dictByUDescrIdx.put(newKeyUDescrIdx, Buff); subdict = dictByMimeTypeIdx.get(existingKeyMimeTypeIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByMimeTypeIdx.containsKey(newKeyMimeTypeIdx)) { subdict = dictByMimeTypeIdx.get(newKeyMimeTypeIdx); } else { subdict = new TreeMap<MSSBamAttachmentPKey, MSSBamAttachmentBuff>(); dictByMimeTypeIdx.put(newKeyMimeTypeIdx, subdict); } subdict.put(pkey, Buff); }
From source file:net.sourceforge.msscodefactory.v1_10.MSSBamRam.MSSBamRamAttachmentTable.java
public void deleteAttachment(MSSBamAuthorization Authorization, MSSBamAttachmentBuff Buff) { final String S_ProcName = "MSSBamRamAttachmentTable.deleteAttachment() "; MSSBamAttachmentPKey pkey = schema.getFactoryAttachment().newPKey(); pkey.setRequiredAttachmentId(schema.nextAttachmentIdGen()); MSSBamAttachmentBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteAttachment", "Existing record not found", "Attachment", pkey); }/*from w ww . ja va 2 s . co m*/ if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteAttachment", pkey); } MSSBamAttachmentByContactIdxKey keyContactIdx = schema.getFactoryAttachment().newContactIdxKey(); keyContactIdx.setRequiredContactId(existing.getRequiredContactId()); MSSBamAttachmentByUDescrIdxKey keyUDescrIdx = schema.getFactoryAttachment().newUDescrIdxKey(); keyUDescrIdx.setRequiredContactId(existing.getRequiredContactId()); keyUDescrIdx.setRequiredDescription(existing.getRequiredDescription()); MSSBamAttachmentByMimeTypeIdxKey keyMimeTypeIdx = schema.getFactoryAttachment().newMimeTypeIdxKey(); keyMimeTypeIdx.setOptionalMimeTypeId(existing.getOptionalMimeTypeId()); // Validate reverse foreign keys if (schema.getTableAttachmentTag().readDerivedByAttachmentIdx(Authorization, existing.getRequiredAttachmentId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteAttachment", "Container", "AttachmentTagAttachment", "AttachmentTag", pkey); } // Delete is valid SortedMap<MSSBamAttachmentPKey, MSSBamAttachmentBuff> subdict; dictByPKey.remove(pkey); subdict = dictByContactIdx.get(keyContactIdx); subdict.remove(pkey); dictByUDescrIdx.remove(keyUDescrIdx); subdict = dictByMimeTypeIdx.get(keyMimeTypeIdx); subdict.remove(pkey); }
From source file:net.sourceforge.msscodefactory.v1_10.MSSBamRam.MSSBamRamAttachmentTagTable.java
public void updateAttachmentTag(MSSBamAuthorization Authorization, MSSBamAttachmentTagBuff Buff) { MSSBamAttachmentTagPKey pkey = schema.getFactoryAttachmentTag().newPKey(); pkey.setRequiredAttachmentId(Buff.getRequiredAttachmentId()); pkey.setRequiredTagId(Buff.getRequiredTagId()); MSSBamAttachmentTagBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateAttachmentTag", "Existing record not found", "AttachmentTag", pkey); }/*www .ja va 2 s.c o m*/ if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateAttachmentTag", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); MSSBamAttachmentTagByAttachmentIdxKey existingKeyAttachmentIdx = schema.getFactoryAttachmentTag() .newAttachmentIdxKey(); existingKeyAttachmentIdx.setRequiredAttachmentId(existing.getRequiredAttachmentId()); MSSBamAttachmentTagByAttachmentIdxKey newKeyAttachmentIdx = schema.getFactoryAttachmentTag() .newAttachmentIdxKey(); newKeyAttachmentIdx.setRequiredAttachmentId(Buff.getRequiredAttachmentId()); MSSBamAttachmentTagByTagIdxKey existingKeyTagIdx = schema.getFactoryAttachmentTag().newTagIdxKey(); existingKeyTagIdx.setRequiredTagId(existing.getRequiredTagId()); MSSBamAttachmentTagByTagIdxKey newKeyTagIdx = schema.getFactoryAttachmentTag().newTagIdxKey(); newKeyTagIdx.setRequiredTagId(Buff.getRequiredTagId()); // Check unique indexes // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema.getTableAttachment().readDerivedByIdIdx(Authorization, Buff.getRequiredAttachmentId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateAttachmentTag", "Container", "AttachmentTagAttachment", "Attachment", null); } } } { boolean allNull = true; if (allNull) { if (null == schema.getTableTag().readDerivedByIdIdx(Authorization, Buff.getRequiredTagId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateAttachmentTag", "Lookup", "Tag", "Tag", null); } } } // Update is valid SortedMap<MSSBamAttachmentTagPKey, MSSBamAttachmentTagBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); subdict = dictByAttachmentIdx.get(existingKeyAttachmentIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByAttachmentIdx.containsKey(newKeyAttachmentIdx)) { subdict = dictByAttachmentIdx.get(newKeyAttachmentIdx); } else { subdict = new TreeMap<MSSBamAttachmentTagPKey, MSSBamAttachmentTagBuff>(); dictByAttachmentIdx.put(newKeyAttachmentIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByTagIdx.get(existingKeyTagIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByTagIdx.containsKey(newKeyTagIdx)) { subdict = dictByTagIdx.get(newKeyTagIdx); } else { subdict = new TreeMap<MSSBamAttachmentTagPKey, MSSBamAttachmentTagBuff>(); dictByTagIdx.put(newKeyTagIdx, subdict); } subdict.put(pkey, Buff); }