List of usage examples for java.util SortedMap remove
V remove(Object key);
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam.CFAccRamSubProjectTable.java
public void updateSubProject(CFAccAuthorization Authorization, CFAccSubProjectBuff Buff) { schema.getTableRealProject().updateRealProject(Authorization, Buff); CFAccDomainBasePKey pkey = schema.getFactoryDomainBase().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredId(Buff.getRequiredId()); CFAccSubProjectBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateSubProject", "Existing record not found", "SubProject", pkey); }//from w w w .j a va2 s .c om CFAccSubProjectByParentIdxKey existingKeyParentIdx = schema.getFactorySubProject().newParentIdxKey(); existingKeyParentIdx.setRequiredTenantId(existing.getRequiredTenantId()); existingKeyParentIdx.setRequiredParentProjectId(existing.getRequiredParentProjectId()); CFAccSubProjectByParentIdxKey newKeyParentIdx = schema.getFactorySubProject().newParentIdxKey(); newKeyParentIdx.setRequiredTenantId(Buff.getRequiredTenantId()); newKeyParentIdx.setRequiredParentProjectId(Buff.getRequiredParentProjectId()); CFAccSubProjectByNameIdxKey existingKeyNameIdx = schema.getFactorySubProject().newNameIdxKey(); existingKeyNameIdx.setRequiredTenantId(existing.getRequiredTenantId()); existingKeyNameIdx.setRequiredParentProjectId(existing.getRequiredParentProjectId()); existingKeyNameIdx.setRequiredName(existing.getRequiredName()); CFAccSubProjectByNameIdxKey newKeyNameIdx = schema.getFactorySubProject().newNameIdxKey(); newKeyNameIdx.setRequiredTenantId(Buff.getRequiredTenantId()); newKeyNameIdx.setRequiredParentProjectId(Buff.getRequiredParentProjectId()); newKeyNameIdx.setRequiredName(Buff.getRequiredName()); // Check unique indexes if (!existingKeyNameIdx.equals(newKeyNameIdx)) { if (dictByNameIdx.containsKey(newKeyNameIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "updateSubProject", "SubProjectNameIdx", newKeyNameIdx); } } // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema.getTableRealProject().readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId(), Buff.getRequiredId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateSubProject", "Superclass", "SuperClass", "RealProject", null); } } } { boolean allNull = true; if (allNull) { if (null == schema.getTableTopProject().readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId(), Buff.getRequiredParentProjectId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateSubProject", "Container", "ParentProject", "TopProject", null); } } } // Update is valid SortedMap<CFAccDomainBasePKey, CFAccSubProjectBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); subdict = dictByParentIdx.get(existingKeyParentIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByParentIdx.containsKey(newKeyParentIdx)) { subdict = dictByParentIdx.get(newKeyParentIdx); } else { subdict = new TreeMap<CFAccDomainBasePKey, CFAccSubProjectBuff>(); dictByParentIdx.put(newKeyParentIdx, subdict); } subdict.put(pkey, Buff); dictByNameIdx.remove(existingKeyNameIdx); dictByNameIdx.put(newKeyNameIdx, Buff); }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstRam.CFAstRamMajorVersionTable.java
public void updateMajorVersion(CFAstAuthorization Authorization, CFAstMajorVersionBuff Buff) { schema.getTableVersion().updateVersion(Authorization, Buff); CFAstDomainBasePKey pkey = schema.getFactoryDomainBase().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredId(Buff.getRequiredId()); CFAstMajorVersionBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateMajorVersion", "Existing record not found", "MajorVersion", pkey); }/*from w w w . j a va 2 s . c o m*/ CFAstMajorVersionByPPrjIdxKey existingKeyPPrjIdx = schema.getFactoryMajorVersion().newPPrjIdxKey(); existingKeyPPrjIdx.setRequiredTenantId(existing.getRequiredTenantId()); existingKeyPPrjIdx.setRequiredParentProjectId(existing.getRequiredParentProjectId()); CFAstMajorVersionByPPrjIdxKey newKeyPPrjIdx = schema.getFactoryMajorVersion().newPPrjIdxKey(); newKeyPPrjIdx.setRequiredTenantId(Buff.getRequiredTenantId()); newKeyPPrjIdx.setRequiredParentProjectId(Buff.getRequiredParentProjectId()); CFAstMajorVersionByNameIdxKey existingKeyNameIdx = schema.getFactoryMajorVersion().newNameIdxKey(); existingKeyNameIdx.setRequiredTenantId(existing.getRequiredTenantId()); existingKeyNameIdx.setRequiredParentProjectId(existing.getRequiredParentProjectId()); existingKeyNameIdx.setRequiredName(existing.getRequiredName()); CFAstMajorVersionByNameIdxKey newKeyNameIdx = schema.getFactoryMajorVersion().newNameIdxKey(); newKeyNameIdx.setRequiredTenantId(Buff.getRequiredTenantId()); newKeyNameIdx.setRequiredParentProjectId(Buff.getRequiredParentProjectId()); newKeyNameIdx.setRequiredName(Buff.getRequiredName()); // Check unique indexes if (!existingKeyNameIdx.equals(newKeyNameIdx)) { if (dictByNameIdx.containsKey(newKeyNameIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "updateMajorVersion", "MajorVersionNameIdx", newKeyNameIdx); } } // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema.getTableVersion().readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId(), Buff.getRequiredId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateMajorVersion", "Superclass", "SuperClass", "Version", null); } } } { boolean allNull = true; if (allNull) { if (null == schema.getTableRealProject().readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId(), Buff.getRequiredParentProjectId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateMajorVersion", "Container", "ParentProject", "RealProject", null); } } } // Update is valid SortedMap<CFAstDomainBasePKey, CFAstMajorVersionBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); subdict = dictByPPrjIdx.get(existingKeyPPrjIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByPPrjIdx.containsKey(newKeyPPrjIdx)) { subdict = dictByPPrjIdx.get(newKeyPPrjIdx); } else { subdict = new TreeMap<CFAstDomainBasePKey, CFAstMajorVersionBuff>(); dictByPPrjIdx.put(newKeyPPrjIdx, subdict); } subdict.put(pkey, Buff); dictByNameIdx.remove(existingKeyNameIdx); dictByNameIdx.put(newKeyNameIdx, Buff); }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstRam.CFAstRamSubProjectTable.java
public void updateSubProject(CFAstAuthorization Authorization, CFAstSubProjectBuff Buff) { schema.getTableRealProject().updateRealProject(Authorization, Buff); CFAstDomainBasePKey pkey = schema.getFactoryDomainBase().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredId(Buff.getRequiredId()); CFAstSubProjectBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateSubProject", "Existing record not found", "SubProject", pkey); }/*from w ww .jav a2 s. c o m*/ CFAstSubProjectByParentIdxKey existingKeyParentIdx = schema.getFactorySubProject().newParentIdxKey(); existingKeyParentIdx.setRequiredTenantId(existing.getRequiredTenantId()); existingKeyParentIdx.setRequiredParentProjectId(existing.getRequiredParentProjectId()); CFAstSubProjectByParentIdxKey newKeyParentIdx = schema.getFactorySubProject().newParentIdxKey(); newKeyParentIdx.setRequiredTenantId(Buff.getRequiredTenantId()); newKeyParentIdx.setRequiredParentProjectId(Buff.getRequiredParentProjectId()); CFAstSubProjectByNameIdxKey existingKeyNameIdx = schema.getFactorySubProject().newNameIdxKey(); existingKeyNameIdx.setRequiredTenantId(existing.getRequiredTenantId()); existingKeyNameIdx.setRequiredParentProjectId(existing.getRequiredParentProjectId()); existingKeyNameIdx.setRequiredName(existing.getRequiredName()); CFAstSubProjectByNameIdxKey newKeyNameIdx = schema.getFactorySubProject().newNameIdxKey(); newKeyNameIdx.setRequiredTenantId(Buff.getRequiredTenantId()); newKeyNameIdx.setRequiredParentProjectId(Buff.getRequiredParentProjectId()); newKeyNameIdx.setRequiredName(Buff.getRequiredName()); // Check unique indexes if (!existingKeyNameIdx.equals(newKeyNameIdx)) { if (dictByNameIdx.containsKey(newKeyNameIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "updateSubProject", "SubProjectNameIdx", newKeyNameIdx); } } // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema.getTableRealProject().readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId(), Buff.getRequiredId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateSubProject", "Superclass", "SuperClass", "RealProject", null); } } } { boolean allNull = true; if (allNull) { if (null == schema.getTableTopProject().readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId(), Buff.getRequiredParentProjectId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateSubProject", "Container", "ParentProject", "TopProject", null); } } } // Update is valid SortedMap<CFAstDomainBasePKey, CFAstSubProjectBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); subdict = dictByParentIdx.get(existingKeyParentIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByParentIdx.containsKey(newKeyParentIdx)) { subdict = dictByParentIdx.get(newKeyParentIdx); } else { subdict = new TreeMap<CFAstDomainBasePKey, CFAstSubProjectBuff>(); dictByParentIdx.put(newKeyParentIdx, subdict); } subdict.put(pkey, Buff); dictByNameIdx.remove(existingKeyNameIdx); dictByNameIdx.put(newKeyNameIdx, Buff); }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam.CFAccRamTopProjectTable.java
public void updateTopProject(CFAccAuthorization Authorization, CFAccTopProjectBuff Buff) { schema.getTableRealProject().updateRealProject(Authorization, Buff); CFAccDomainBasePKey pkey = schema.getFactoryDomainBase().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredId(Buff.getRequiredId()); CFAccTopProjectBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateTopProject", "Existing record not found", "TopProject", pkey); }//from ww w. j a va2 s . com CFAccTopProjectByDomainIdxKey existingKeyDomainIdx = schema.getFactoryTopProject().newDomainIdxKey(); existingKeyDomainIdx.setRequiredTenantId(existing.getRequiredTenantId()); existingKeyDomainIdx.setRequiredDomainId(existing.getRequiredDomainId()); CFAccTopProjectByDomainIdxKey newKeyDomainIdx = schema.getFactoryTopProject().newDomainIdxKey(); newKeyDomainIdx.setRequiredTenantId(Buff.getRequiredTenantId()); newKeyDomainIdx.setRequiredDomainId(Buff.getRequiredDomainId()); CFAccTopProjectByNameIdxKey existingKeyNameIdx = schema.getFactoryTopProject().newNameIdxKey(); existingKeyNameIdx.setRequiredTenantId(existing.getRequiredTenantId()); existingKeyNameIdx.setRequiredDomainId(existing.getRequiredDomainId()); existingKeyNameIdx.setRequiredName(existing.getRequiredName()); CFAccTopProjectByNameIdxKey newKeyNameIdx = schema.getFactoryTopProject().newNameIdxKey(); newKeyNameIdx.setRequiredTenantId(Buff.getRequiredTenantId()); newKeyNameIdx.setRequiredDomainId(Buff.getRequiredDomainId()); newKeyNameIdx.setRequiredName(Buff.getRequiredName()); // Check unique indexes if (!existingKeyNameIdx.equals(newKeyNameIdx)) { if (dictByNameIdx.containsKey(newKeyNameIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "updateTopProject", "TopProjectNameIdx", newKeyNameIdx); } } // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema.getTableRealProject().readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId(), Buff.getRequiredId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateTopProject", "Superclass", "SuperClass", "RealProject", null); } } } { boolean allNull = true; if (allNull) { if (null == schema.getTableDomainBase().readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId(), Buff.getRequiredDomainId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateTopProject", "Container", "Domain", "DomainBase", null); } } } // Update is valid SortedMap<CFAccDomainBasePKey, CFAccTopProjectBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); subdict = dictByDomainIdx.get(existingKeyDomainIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByDomainIdx.containsKey(newKeyDomainIdx)) { subdict = dictByDomainIdx.get(newKeyDomainIdx); } else { subdict = new TreeMap<CFAccDomainBasePKey, CFAccTopProjectBuff>(); dictByDomainIdx.put(newKeyDomainIdx, subdict); } subdict.put(pkey, Buff); dictByNameIdx.remove(existingKeyNameIdx); dictByNameIdx.put(newKeyNameIdx, Buff); }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstRam.CFAstRamTopProjectTable.java
public void updateTopProject(CFAstAuthorization Authorization, CFAstTopProjectBuff Buff) { schema.getTableRealProject().updateRealProject(Authorization, Buff); CFAstDomainBasePKey pkey = schema.getFactoryDomainBase().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredId(Buff.getRequiredId()); CFAstTopProjectBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateTopProject", "Existing record not found", "TopProject", pkey); }//w ww.ja va 2s . c o m CFAstTopProjectByDomainIdxKey existingKeyDomainIdx = schema.getFactoryTopProject().newDomainIdxKey(); existingKeyDomainIdx.setRequiredTenantId(existing.getRequiredTenantId()); existingKeyDomainIdx.setRequiredDomainId(existing.getRequiredDomainId()); CFAstTopProjectByDomainIdxKey newKeyDomainIdx = schema.getFactoryTopProject().newDomainIdxKey(); newKeyDomainIdx.setRequiredTenantId(Buff.getRequiredTenantId()); newKeyDomainIdx.setRequiredDomainId(Buff.getRequiredDomainId()); CFAstTopProjectByNameIdxKey existingKeyNameIdx = schema.getFactoryTopProject().newNameIdxKey(); existingKeyNameIdx.setRequiredTenantId(existing.getRequiredTenantId()); existingKeyNameIdx.setRequiredDomainId(existing.getRequiredDomainId()); existingKeyNameIdx.setRequiredName(existing.getRequiredName()); CFAstTopProjectByNameIdxKey newKeyNameIdx = schema.getFactoryTopProject().newNameIdxKey(); newKeyNameIdx.setRequiredTenantId(Buff.getRequiredTenantId()); newKeyNameIdx.setRequiredDomainId(Buff.getRequiredDomainId()); newKeyNameIdx.setRequiredName(Buff.getRequiredName()); // Check unique indexes if (!existingKeyNameIdx.equals(newKeyNameIdx)) { if (dictByNameIdx.containsKey(newKeyNameIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "updateTopProject", "TopProjectNameIdx", newKeyNameIdx); } } // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema.getTableRealProject().readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId(), Buff.getRequiredId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateTopProject", "Superclass", "SuperClass", "RealProject", null); } } } { boolean allNull = true; if (allNull) { if (null == schema.getTableDomainBase().readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId(), Buff.getRequiredDomainId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateTopProject", "Container", "Domain", "DomainBase", null); } } } // Update is valid SortedMap<CFAstDomainBasePKey, CFAstTopProjectBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); subdict = dictByDomainIdx.get(existingKeyDomainIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByDomainIdx.containsKey(newKeyDomainIdx)) { subdict = dictByDomainIdx.get(newKeyDomainIdx); } else { subdict = new TreeMap<CFAstDomainBasePKey, CFAstTopProjectBuff>(); dictByDomainIdx.put(newKeyDomainIdx, subdict); } subdict.put(pkey, Buff); dictByNameIdx.remove(existingKeyNameIdx); dictByNameIdx.put(newKeyNameIdx, Buff); }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam.CFAccRamPhoneTable.java
public void deletePhone(CFAccAuthorization Authorization, CFAccPhoneBuff Buff) { final String S_ProcName = "CFAccRamPhoneTable.deletePhone() "; CFAccPhonePKey pkey = schema.getFactoryPhone().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredPhoneId(Buff.getRequiredPhoneId()); CFAccPhoneBuff existing = dictByPKey.get(pkey); if (existing == null) { return;// w w w . j a v a 2 s . c om } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deletePhone", pkey); } CFAccPhoneByTenantIdxKey keyTenantIdx = schema.getFactoryPhone().newTenantIdxKey(); keyTenantIdx.setRequiredTenantId(existing.getRequiredTenantId()); CFAccPhoneByContactIdxKey keyContactIdx = schema.getFactoryPhone().newContactIdxKey(); keyContactIdx.setRequiredTenantId(existing.getRequiredTenantId()); keyContactIdx.setRequiredContactId(existing.getRequiredContactId()); CFAccPhoneByUDescrIdxKey keyUDescrIdx = schema.getFactoryPhone().newUDescrIdxKey(); keyUDescrIdx.setRequiredTenantId(existing.getRequiredTenantId()); keyUDescrIdx.setRequiredContactId(existing.getRequiredContactId()); keyUDescrIdx.setRequiredDescription(existing.getRequiredDescription()); CFAccPhoneByUPhoneNumberIdxKey keyUPhoneNumberIdx = schema.getFactoryPhone().newUPhoneNumberIdxKey(); keyUPhoneNumberIdx.setRequiredTenantId(existing.getRequiredTenantId()); keyUPhoneNumberIdx.setRequiredContactId(existing.getRequiredContactId()); keyUPhoneNumberIdx.setRequiredPhoneNumber(existing.getRequiredPhoneNumber()); // Validate reverse foreign keys // Delete is valid schema.getTablePhoneTag().deletePhoneTagByPhoneIdx(Authorization, Buff.getRequiredTenantId(), Buff.getRequiredPhoneId()); SortedMap<CFAccPhonePKey, CFAccPhoneBuff> subdict; dictByPKey.remove(pkey); subdict = dictByTenantIdx.get(keyTenantIdx); subdict.remove(pkey); subdict = dictByContactIdx.get(keyContactIdx); subdict.remove(pkey); dictByUDescrIdx.remove(keyUDescrIdx); dictByUPhoneNumberIdx.remove(keyUPhoneNumberIdx); }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam.CFAccRamSecSessionTable.java
public void updateSecSession(CFAccAuthorization Authorization, CFAccSecSessionBuff Buff) { CFAccSecSessionPKey pkey = schema.getFactorySecSession().newPKey(); pkey.setRequiredSecSessionId(Buff.getRequiredSecSessionId()); CFAccSecSessionBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateSecSession", "Existing record not found", "SecSession", pkey); }/* ww w. ja v a2 s.c om*/ if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateSecSession", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); CFAccSecSessionBySecUserIdxKey existingKeySecUserIdx = schema.getFactorySecSession().newSecUserIdxKey(); existingKeySecUserIdx.setRequiredSecUserId(existing.getRequiredSecUserId()); CFAccSecSessionBySecUserIdxKey newKeySecUserIdx = schema.getFactorySecSession().newSecUserIdxKey(); newKeySecUserIdx.setRequiredSecUserId(Buff.getRequiredSecUserId()); CFAccSecSessionByStartIdxKey existingKeyStartIdx = schema.getFactorySecSession().newStartIdxKey(); existingKeyStartIdx.setRequiredSecUserId(existing.getRequiredSecUserId()); existingKeyStartIdx.setRequiredStart(existing.getRequiredStart()); CFAccSecSessionByStartIdxKey newKeyStartIdx = schema.getFactorySecSession().newStartIdxKey(); newKeyStartIdx.setRequiredSecUserId(Buff.getRequiredSecUserId()); newKeyStartIdx.setRequiredStart(Buff.getRequiredStart()); CFAccSecSessionByFinishIdxKey existingKeyFinishIdx = schema.getFactorySecSession().newFinishIdxKey(); existingKeyFinishIdx.setRequiredSecUserId(existing.getRequiredSecUserId()); existingKeyFinishIdx.setOptionalFinish(existing.getOptionalFinish()); CFAccSecSessionByFinishIdxKey newKeyFinishIdx = schema.getFactorySecSession().newFinishIdxKey(); newKeyFinishIdx.setRequiredSecUserId(Buff.getRequiredSecUserId()); newKeyFinishIdx.setOptionalFinish(Buff.getOptionalFinish()); // Check unique indexes if (!existingKeyStartIdx.equals(newKeyStartIdx)) { if (dictByStartIdx.containsKey(newKeyStartIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "updateSecSession", "SessionStartIdx", newKeyStartIdx); } } // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema.getTableSecUser().readDerivedByIdIdx(Authorization, Buff.getRequiredSecUserId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateSecSession", "Container", "SecSessionUser", "SecUser", null); } } } // Update is valid SortedMap<CFAccSecSessionPKey, CFAccSecSessionBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); subdict = dictBySecUserIdx.get(existingKeySecUserIdx); if (subdict != null) { subdict.remove(pkey); } if (dictBySecUserIdx.containsKey(newKeySecUserIdx)) { subdict = dictBySecUserIdx.get(newKeySecUserIdx); } else { subdict = new TreeMap<CFAccSecSessionPKey, CFAccSecSessionBuff>(); dictBySecUserIdx.put(newKeySecUserIdx, subdict); } subdict.put(pkey, Buff); dictByStartIdx.remove(existingKeyStartIdx); dictByStartIdx.put(newKeyStartIdx, Buff); subdict = dictByFinishIdx.get(existingKeyFinishIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByFinishIdx.containsKey(newKeyFinishIdx)) { subdict = dictByFinishIdx.get(newKeyFinishIdx); } else { subdict = new TreeMap<CFAccSecSessionPKey, CFAccSecSessionBuff>(); dictByFinishIdx.put(newKeyFinishIdx, subdict); } subdict.put(pkey, Buff); }
From source file:net.sourceforge.msscodefactory.cfasterisk.v2_0.CFAstRam.CFAstRamSecSessionTable.java
public void updateSecSession(CFAstAuthorization Authorization, CFAstSecSessionBuff Buff) { CFAstSecSessionPKey pkey = schema.getFactorySecSession().newPKey(); pkey.setRequiredSecSessionId(Buff.getRequiredSecSessionId()); CFAstSecSessionBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateSecSession", "Existing record not found", "SecSession", pkey); }/*w w w . j av a2 s.co m*/ if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateSecSession", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); CFAstSecSessionBySecUserIdxKey existingKeySecUserIdx = schema.getFactorySecSession().newSecUserIdxKey(); existingKeySecUserIdx.setRequiredSecUserId(existing.getRequiredSecUserId()); CFAstSecSessionBySecUserIdxKey newKeySecUserIdx = schema.getFactorySecSession().newSecUserIdxKey(); newKeySecUserIdx.setRequiredSecUserId(Buff.getRequiredSecUserId()); CFAstSecSessionByStartIdxKey existingKeyStartIdx = schema.getFactorySecSession().newStartIdxKey(); existingKeyStartIdx.setRequiredSecUserId(existing.getRequiredSecUserId()); existingKeyStartIdx.setRequiredStart(existing.getRequiredStart()); CFAstSecSessionByStartIdxKey newKeyStartIdx = schema.getFactorySecSession().newStartIdxKey(); newKeyStartIdx.setRequiredSecUserId(Buff.getRequiredSecUserId()); newKeyStartIdx.setRequiredStart(Buff.getRequiredStart()); CFAstSecSessionByFinishIdxKey existingKeyFinishIdx = schema.getFactorySecSession().newFinishIdxKey(); existingKeyFinishIdx.setRequiredSecUserId(existing.getRequiredSecUserId()); existingKeyFinishIdx.setOptionalFinish(existing.getOptionalFinish()); CFAstSecSessionByFinishIdxKey newKeyFinishIdx = schema.getFactorySecSession().newFinishIdxKey(); newKeyFinishIdx.setRequiredSecUserId(Buff.getRequiredSecUserId()); newKeyFinishIdx.setOptionalFinish(Buff.getOptionalFinish()); // Check unique indexes if (!existingKeyStartIdx.equals(newKeyStartIdx)) { if (dictByStartIdx.containsKey(newKeyStartIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "updateSecSession", "SessionStartIdx", newKeyStartIdx); } } // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema.getTableSecUser().readDerivedByIdIdx(Authorization, Buff.getRequiredSecUserId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateSecSession", "Container", "SecSessionUser", "SecUser", null); } } } // Update is valid SortedMap<CFAstSecSessionPKey, CFAstSecSessionBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); subdict = dictBySecUserIdx.get(existingKeySecUserIdx); if (subdict != null) { subdict.remove(pkey); } if (dictBySecUserIdx.containsKey(newKeySecUserIdx)) { subdict = dictBySecUserIdx.get(newKeySecUserIdx); } else { subdict = new TreeMap<CFAstSecSessionPKey, CFAstSecSessionBuff>(); dictBySecUserIdx.put(newKeySecUserIdx, subdict); } subdict.put(pkey, Buff); dictByStartIdx.remove(existingKeyStartIdx); dictByStartIdx.put(newKeyStartIdx, Buff); subdict = dictByFinishIdx.get(existingKeyFinishIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByFinishIdx.containsKey(newKeyFinishIdx)) { subdict = dictByFinishIdx.get(newKeyFinishIdx); } else { subdict = new TreeMap<CFAstSecSessionPKey, CFAstSecSessionBuff>(); dictByFinishIdx.put(newKeyFinishIdx, subdict); } subdict.put(pkey, Buff); }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam.CFAccRamAddressTable.java
public void deleteAddress(CFAccAuthorization Authorization, CFAccAddressBuff Buff) { final String S_ProcName = "CFAccRamAddressTable.deleteAddress() "; CFAccAddressPKey pkey = schema.getFactoryAddress().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredAddressId(Buff.getRequiredAddressId()); CFAccAddressBuff existing = dictByPKey.get(pkey); if (existing == null) { return;/* ww w . j a va2 s . c om*/ } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteAddress", pkey); } CFAccAddressByTenantIdxKey keyTenantIdx = schema.getFactoryAddress().newTenantIdxKey(); keyTenantIdx.setRequiredTenantId(existing.getRequiredTenantId()); CFAccAddressByContactIdxKey keyContactIdx = schema.getFactoryAddress().newContactIdxKey(); keyContactIdx.setRequiredTenantId(existing.getRequiredTenantId()); keyContactIdx.setRequiredContactId(existing.getRequiredContactId()); CFAccAddressByUDescrIdxKey keyUDescrIdx = schema.getFactoryAddress().newUDescrIdxKey(); keyUDescrIdx.setRequiredTenantId(existing.getRequiredTenantId()); keyUDescrIdx.setRequiredContactId(existing.getRequiredContactId()); keyUDescrIdx.setRequiredDescription(existing.getRequiredDescription()); CFAccAddressByCountryIdxKey keyCountryIdx = schema.getFactoryAddress().newCountryIdxKey(); keyCountryIdx.setOptionalCountryId(existing.getOptionalCountryId()); // Validate reverse foreign keys // Delete is valid schema.getTableAddressTag().deleteAddressTagByAddressIdx(Authorization, Buff.getRequiredTenantId(), Buff.getRequiredAddressId()); SortedMap<CFAccAddressPKey, CFAccAddressBuff> subdict; dictByPKey.remove(pkey); subdict = dictByTenantIdx.get(keyTenantIdx); subdict.remove(pkey); subdict = dictByContactIdx.get(keyContactIdx); subdict.remove(pkey); dictByUDescrIdx.remove(keyUDescrIdx); subdict = dictByCountryIdx.get(keyCountryIdx); subdict.remove(pkey); }
From source file:net.sourceforge.msscodefactory.cfacc.v2_0.CFAccRam.CFAccRamTenantTable.java
public void updateTenant(CFAccAuthorization Authorization, CFAccTenantBuff Buff) { CFAccTenantPKey pkey = schema.getFactoryTenant().newPKey(); pkey.setRequiredId(Buff.getRequiredId()); CFAccTenantBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateTenant", "Existing record not found", "Tenant", pkey); }//from ww w. j a v a2s . co m if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateTenant", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); CFAccTenantByClusterIdxKey existingKeyClusterIdx = schema.getFactoryTenant().newClusterIdxKey(); existingKeyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId()); CFAccTenantByClusterIdxKey newKeyClusterIdx = schema.getFactoryTenant().newClusterIdxKey(); newKeyClusterIdx.setRequiredClusterId(Buff.getRequiredClusterId()); CFAccTenantByUNameIdxKey existingKeyUNameIdx = schema.getFactoryTenant().newUNameIdxKey(); existingKeyUNameIdx.setRequiredClusterId(existing.getRequiredClusterId()); existingKeyUNameIdx.setRequiredTenantName(existing.getRequiredTenantName()); CFAccTenantByUNameIdxKey newKeyUNameIdx = schema.getFactoryTenant().newUNameIdxKey(); newKeyUNameIdx.setRequiredClusterId(Buff.getRequiredClusterId()); newKeyUNameIdx.setRequiredTenantName(Buff.getRequiredTenantName()); // Check unique indexes if (!existingKeyUNameIdx.equals(newKeyUNameIdx)) { if (dictByUNameIdx.containsKey(newKeyUNameIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "updateTenant", "TenantUNameIdx", newKeyUNameIdx); } } // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema.getTableCluster().readDerivedByIdIdx(Authorization, Buff.getRequiredClusterId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateTenant", "Container", "TenantCluster", "Cluster", null); } } } // Update is valid SortedMap<CFAccTenantPKey, CFAccTenantBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); subdict = dictByClusterIdx.get(existingKeyClusterIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByClusterIdx.containsKey(newKeyClusterIdx)) { subdict = dictByClusterIdx.get(newKeyClusterIdx); } else { subdict = new TreeMap<CFAccTenantPKey, CFAccTenantBuff>(); dictByClusterIdx.put(newKeyClusterIdx, subdict); } subdict.put(pkey, Buff); dictByUNameIdx.remove(existingKeyUNameIdx); dictByUNameIdx.put(newKeyUNameIdx, Buff); }