List of usage examples for java.util SortedMap remove
V remove(Object key);
From source file:net.sourceforge.msscodefactory.v1_10.MSSBamRam.MSSBamRamSecGroupMemberTable.java
public void deleteSecGroupMember(MSSBamAuthorization Authorization, MSSBamSecGroupMemberBuff Buff) { final String S_ProcName = "MSSBamRamSecGroupMemberTable.deleteSecGroupMember() "; MSSBamSecGroupMemberPKey pkey = schema.getFactorySecGroupMember().newPKey(); pkey.setRequiredSecGroupMemberId(schema.nextSecGroupMemberIdGen()); MSSBamSecGroupMemberBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteSecGroupMember", "Existing record not found", "SecGroupMember", pkey); }//from w w w . j ava 2s .co m if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteSecGroupMember", pkey); } MSSBamSecGroupMemberByGroupIdxKey keyGroupIdx = schema.getFactorySecGroupMember().newGroupIdxKey(); keyGroupIdx.setRequiredSecGroupId(existing.getRequiredSecGroupId()); MSSBamSecGroupMemberByUserIdxKey keyUserIdx = schema.getFactorySecGroupMember().newUserIdxKey(); keyUserIdx.setRequiredSecUserId(existing.getRequiredSecUserId()); MSSBamSecGroupMemberByUUserIdxKey keyUUserIdx = schema.getFactorySecGroupMember().newUUserIdxKey(); keyUUserIdx.setRequiredSecGroupId(existing.getRequiredSecGroupId()); keyUUserIdx.setRequiredSecUserId(existing.getRequiredSecUserId()); // Validate reverse foreign keys // Delete is valid SortedMap<MSSBamSecGroupMemberPKey, MSSBamSecGroupMemberBuff> subdict; dictByPKey.remove(pkey); subdict = dictByGroupIdx.get(keyGroupIdx); subdict.remove(pkey); subdict = dictByUserIdx.get(keyUserIdx); subdict.remove(pkey); dictByUUserIdx.remove(keyUUserIdx); }
From source file:net.sourceforge.msscodefactory.v1_10.MSSBamRam.MSSBamRamSecGroupTable.java
public void updateSecGroup(MSSBamAuthorization Authorization, MSSBamSecGroupBuff Buff) { MSSBamSecGroupPKey pkey = schema.getFactorySecGroup().newPKey(); pkey.setRequiredSecGroupId(Buff.getRequiredSecGroupId()); MSSBamSecGroupBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateSecGroup", "Existing record not found", "SecGroup", pkey); }/*from w w w . ja va2 s . com*/ if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateSecGroup", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); MSSBamSecGroupByClusterIdxKey existingKeyClusterIdx = schema.getFactorySecGroup().newClusterIdxKey(); existingKeyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId()); MSSBamSecGroupByClusterIdxKey newKeyClusterIdx = schema.getFactorySecGroup().newClusterIdxKey(); newKeyClusterIdx.setRequiredClusterId(Buff.getRequiredClusterId()); MSSBamSecGroupByUNameIdxKey existingKeyUNameIdx = schema.getFactorySecGroup().newUNameIdxKey(); existingKeyUNameIdx.setRequiredClusterId(existing.getRequiredClusterId()); existingKeyUNameIdx.setRequiredName(existing.getRequiredName()); MSSBamSecGroupByUNameIdxKey newKeyUNameIdx = schema.getFactorySecGroup().newUNameIdxKey(); newKeyUNameIdx.setRequiredClusterId(Buff.getRequiredClusterId()); newKeyUNameIdx.setRequiredName(Buff.getRequiredName()); // Check unique indexes if (!existingKeyUNameIdx.equals(newKeyUNameIdx)) { if (dictByUNameIdx.containsKey(newKeyUNameIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "updateSecGroup", "SecGroupUNameIdx", newKeyUNameIdx); } } // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema.getTableCluster().readDerivedByIdIdx(Authorization, Buff.getRequiredClusterId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateSecGroup", "Container", "SecGroupCluster", "Cluster", null); } } } // Update is valid SortedMap<MSSBamSecGroupPKey, MSSBamSecGroupBuff> 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<MSSBamSecGroupPKey, MSSBamSecGroupBuff>(); dictByClusterIdx.put(newKeyClusterIdx, subdict); } subdict.put(pkey, Buff); dictByUNameIdx.remove(existingKeyUNameIdx); dictByUNameIdx.put(newKeyUNameIdx, Buff); }
From source file:net.sourceforge.msscodefactory.v1_10.MSSBamRam.MSSBamRamSecGroupTable.java
public void deleteSecGroup(MSSBamAuthorization Authorization, MSSBamSecGroupBuff Buff) { final String S_ProcName = "MSSBamRamSecGroupTable.deleteSecGroup() "; MSSBamSecGroupPKey pkey = schema.getFactorySecGroup().newPKey(); pkey.setRequiredSecGroupId(schema.nextSecGroupIdGen()); MSSBamSecGroupBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteSecGroup", "Existing record not found", "SecGroup", pkey); }//from w ww . j a va2 s . c om if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteSecGroup", pkey); } MSSBamSecGroupByClusterIdxKey keyClusterIdx = schema.getFactorySecGroup().newClusterIdxKey(); keyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId()); MSSBamSecGroupByUNameIdxKey keyUNameIdx = schema.getFactorySecGroup().newUNameIdxKey(); keyUNameIdx.setRequiredClusterId(existing.getRequiredClusterId()); keyUNameIdx.setRequiredName(existing.getRequiredName()); // Validate reverse foreign keys if (schema.getTableSecGroupForm().readDerivedByGroupIdx(Authorization, existing.getRequiredSecGroupId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSecGroup", "Container", "SecGroupFormGroup", "SecGroupForm", pkey); } if (schema.getTableSecGroupInclude().readDerivedByGroupIdx(Authorization, existing.getRequiredSecGroupId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSecGroup", "Container", "SecGroupIncludeGroup", "SecGroupInclude", pkey); } if (schema.getTableSecGroupInclude().readDerivedByIncludeIdx(Authorization, existing.getRequiredSecGroupId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSecGroup", "Lookup", "SecGroupIncludeSubGroup", "SecGroupInclude", pkey); } if (schema.getTableSecGroupMember().readDerivedByGroupIdx(Authorization, existing.getRequiredSecGroupId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSecGroup", "Container", "SecGroupMemberGroup", "SecGroupMember", pkey); } // Delete is valid SortedMap<MSSBamSecGroupPKey, MSSBamSecGroupBuff> subdict; dictByPKey.remove(pkey); subdict = dictByClusterIdx.get(keyClusterIdx); subdict.remove(pkey); dictByUNameIdx.remove(keyUNameIdx); }
From source file:net.sourceforge.msscodefactory.v1_10.MSSBamRam.MSSBamRamSecSessionTable.java
public void updateSecSession(MSSBamAuthorization Authorization, MSSBamSecSessionBuff Buff) { MSSBamSecSessionPKey pkey = schema.getFactorySecSession().newPKey(); pkey.setRequiredSecSessionId(Buff.getRequiredSecSessionId()); MSSBamSecSessionBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateSecSession", "Existing record not found", "SecSession", pkey); }//from w w w . j a va2 s . co m if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateSecSession", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); MSSBamSecSessionByX509IdxKey existingKeyX509Idx = schema.getFactorySecSession().newX509IdxKey(); existingKeyX509Idx.setRequiredX509CertStr(existing.getRequiredX509CertStr()); MSSBamSecSessionByX509IdxKey newKeyX509Idx = schema.getFactorySecSession().newX509IdxKey(); newKeyX509Idx.setRequiredX509CertStr(Buff.getRequiredX509CertStr()); MSSBamSecSessionBySecUserIdxKey existingKeySecUserIdx = schema.getFactorySecSession().newSecUserIdxKey(); existingKeySecUserIdx.setRequiredSecUserId(existing.getRequiredSecUserId()); MSSBamSecSessionBySecUserIdxKey newKeySecUserIdx = schema.getFactorySecSession().newSecUserIdxKey(); newKeySecUserIdx.setRequiredSecUserId(Buff.getRequiredSecUserId()); MSSBamSecSessionByStartIdxKey existingKeyStartIdx = schema.getFactorySecSession().newStartIdxKey(); existingKeyStartIdx.setRequiredSecUserId(existing.getRequiredSecUserId()); existingKeyStartIdx.setRequiredStart(existing.getRequiredStart()); MSSBamSecSessionByStartIdxKey newKeyStartIdx = schema.getFactorySecSession().newStartIdxKey(); newKeyStartIdx.setRequiredSecUserId(Buff.getRequiredSecUserId()); newKeyStartIdx.setRequiredStart(Buff.getRequiredStart()); MSSBamSecSessionByFinishIdxKey existingKeyFinishIdx = schema.getFactorySecSession().newFinishIdxKey(); existingKeyFinishIdx.setRequiredSecUserId(existing.getRequiredSecUserId()); existingKeyFinishIdx.setOptionalFinish(existing.getOptionalFinish()); MSSBamSecSessionByFinishIdxKey newKeyFinishIdx = schema.getFactorySecSession().newFinishIdxKey(); newKeyFinishIdx.setRequiredSecUserId(Buff.getRequiredSecUserId()); newKeyFinishIdx.setOptionalFinish(Buff.getOptionalFinish()); // Check unique indexes if (!existingKeyX509Idx.equals(newKeyX509Idx)) { if (dictByX509Idx.containsKey(newKeyX509Idx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "updateSecSession", "SessionX509Idx", newKeyX509Idx); } } 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<MSSBamSecSessionPKey, MSSBamSecSessionBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); dictByX509Idx.remove(existingKeyX509Idx); dictByX509Idx.put(newKeyX509Idx, Buff); subdict = dictBySecUserIdx.get(existingKeySecUserIdx); if (subdict != null) { subdict.remove(pkey); } if (dictBySecUserIdx.containsKey(newKeySecUserIdx)) { subdict = dictBySecUserIdx.get(newKeySecUserIdx); } else { subdict = new TreeMap<MSSBamSecSessionPKey, MSSBamSecSessionBuff>(); 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<MSSBamSecSessionPKey, MSSBamSecSessionBuff>(); dictByFinishIdx.put(newKeyFinishIdx, subdict); } subdict.put(pkey, Buff); }
From source file:net.sourceforge.msscodefactory.v1_10.MSSBamRam.MSSBamRamSecSessionTable.java
public void deleteSecSession(MSSBamAuthorization Authorization, MSSBamSecSessionBuff Buff) { final String S_ProcName = "MSSBamRamSecSessionTable.deleteSecSession() "; MSSBamSecSessionPKey pkey = schema.getFactorySecSession().newPKey(); pkey.setRequiredSecSessionId(schema.nextSecSessionIdGen()); MSSBamSecSessionBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteSecSession", "Existing record not found", "SecSession", pkey); }/*from ww w . j av a 2 s . c o m*/ if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteSecSession", pkey); } MSSBamSecSessionByX509IdxKey keyX509Idx = schema.getFactorySecSession().newX509IdxKey(); keyX509Idx.setRequiredX509CertStr(existing.getRequiredX509CertStr()); MSSBamSecSessionBySecUserIdxKey keySecUserIdx = schema.getFactorySecSession().newSecUserIdxKey(); keySecUserIdx.setRequiredSecUserId(existing.getRequiredSecUserId()); MSSBamSecSessionByStartIdxKey keyStartIdx = schema.getFactorySecSession().newStartIdxKey(); keyStartIdx.setRequiredSecUserId(existing.getRequiredSecUserId()); keyStartIdx.setRequiredStart(existing.getRequiredStart()); MSSBamSecSessionByFinishIdxKey keyFinishIdx = schema.getFactorySecSession().newFinishIdxKey(); keyFinishIdx.setRequiredSecUserId(existing.getRequiredSecUserId()); keyFinishIdx.setOptionalFinish(existing.getOptionalFinish()); // Validate reverse foreign keys // Delete is valid SortedMap<MSSBamSecSessionPKey, MSSBamSecSessionBuff> subdict; dictByPKey.remove(pkey); dictByX509Idx.remove(keyX509Idx); subdict = dictBySecUserIdx.get(keySecUserIdx); subdict.remove(pkey); dictByStartIdx.remove(keyStartIdx); subdict = dictByFinishIdx.get(keyFinishIdx); subdict.remove(pkey); }
From source file:net.sourceforge.msscodefactory.v1_10.MSSBamRam.MSSBamRamSecUserTable.java
public void updateSecUser(MSSBamAuthorization Authorization, MSSBamSecUserBuff Buff) { MSSBamSecUserPKey pkey = schema.getFactorySecUser().newPKey(); pkey.setRequiredSecUserId(Buff.getRequiredSecUserId()); MSSBamSecUserBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateSecUser", "Existing record not found", "SecUser", pkey); }//from ww w . j a v a2 s . co m if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateSecUser", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); MSSBamSecUserByClusterIdxKey existingKeyClusterIdx = schema.getFactorySecUser().newClusterIdxKey(); existingKeyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId()); MSSBamSecUserByClusterIdxKey newKeyClusterIdx = schema.getFactorySecUser().newClusterIdxKey(); newKeyClusterIdx.setRequiredClusterId(Buff.getRequiredClusterId()); MSSBamSecUserByUEMailIdxKey existingKeyUEMailIdx = schema.getFactorySecUser().newUEMailIdxKey(); existingKeyUEMailIdx.setRequiredClusterId(existing.getRequiredClusterId()); existingKeyUEMailIdx.setRequiredEMailAddress(existing.getRequiredEMailAddress()); MSSBamSecUserByUEMailIdxKey newKeyUEMailIdx = schema.getFactorySecUser().newUEMailIdxKey(); newKeyUEMailIdx.setRequiredClusterId(Buff.getRequiredClusterId()); newKeyUEMailIdx.setRequiredEMailAddress(Buff.getRequiredEMailAddress()); // Check unique indexes if (!existingKeyUEMailIdx.equals(newKeyUEMailIdx)) { if (dictByUEMailIdx.containsKey(newKeyUEMailIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "updateSecUser", "SecUserUEMailAddrIdx", newKeyUEMailIdx); } } // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema.getTableCluster().readDerivedByIdIdx(Authorization, Buff.getRequiredClusterId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateSecUser", "Container", "SecUserCluster", "Cluster", null); } } } // Update is valid SortedMap<MSSBamSecUserPKey, MSSBamSecUserBuff> 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<MSSBamSecUserPKey, MSSBamSecUserBuff>(); dictByClusterIdx.put(newKeyClusterIdx, subdict); } subdict.put(pkey, Buff); dictByUEMailIdx.remove(existingKeyUEMailIdx); dictByUEMailIdx.put(newKeyUEMailIdx, Buff); }
From source file:net.sourceforge.msscodefactory.v1_10.MSSBamRam.MSSBamRamSecUserTable.java
public void deleteSecUser(MSSBamAuthorization Authorization, MSSBamSecUserBuff Buff) { final String S_ProcName = "MSSBamRamSecUserTable.deleteSecUser() "; MSSBamSecUserPKey pkey = schema.getFactorySecUser().newPKey(); pkey.setRequiredSecUserId(schema.nextSecUserIdGen()); MSSBamSecUserBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteSecUser", "Existing record not found", "SecUser", pkey); }//from www. j av a 2 s. com if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteSecUser", pkey); } MSSBamSecUserByClusterIdxKey keyClusterIdx = schema.getFactorySecUser().newClusterIdxKey(); keyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId()); MSSBamSecUserByUEMailIdxKey keyUEMailIdx = schema.getFactorySecUser().newUEMailIdxKey(); keyUEMailIdx.setRequiredClusterId(existing.getRequiredClusterId()); keyUEMailIdx.setRequiredEMailAddress(existing.getRequiredEMailAddress()); // Validate reverse foreign keys if (schema.getTableSecGroupMember().readDerivedByUserIdx(Authorization, existing.getRequiredSecUserId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSecUser", "Lookup", "SecGroupMemberUser", "SecGroupMember", pkey); } if (schema.getTableSecSession().readDerivedBySecUserIdx(Authorization, existing.getRequiredSecUserId()).length > 0) { throw CFLib.getDefaultExceptionFactory().newDependentsDetectedException(getClass(), "deleteSecUser", "Container", "SecSessionUser", "SecSession", pkey); } // Delete is valid SortedMap<MSSBamSecUserPKey, MSSBamSecUserBuff> subdict; dictByPKey.remove(pkey); subdict = dictByClusterIdx.get(keyClusterIdx); subdict.remove(pkey); dictByUEMailIdx.remove(keyUEMailIdx); }
From source file:net.sourceforge.msscodefactory.v1_10.MSSBamRam.MSSBamRamServiceTable.java
public void updateService(MSSBamAuthorization Authorization, MSSBamServiceBuff Buff) { MSSBamServicePKey pkey = schema.getFactoryService().newPKey(); pkey.setRequiredServiceId(Buff.getRequiredServiceId()); MSSBamServiceBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateService", "Existing record not found", "Service", pkey); }//from w ww . ja v a 2 s. c o m if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "updateService", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); MSSBamServiceByHostIdxKey existingKeyHostIdx = schema.getFactoryService().newHostIdxKey(); existingKeyHostIdx.setRequiredHostNodeId(existing.getRequiredHostNodeId()); MSSBamServiceByHostIdxKey newKeyHostIdx = schema.getFactoryService().newHostIdxKey(); newKeyHostIdx.setRequiredHostNodeId(Buff.getRequiredHostNodeId()); MSSBamServiceByTypeIdxKey existingKeyTypeIdx = schema.getFactoryService().newTypeIdxKey(); existingKeyTypeIdx.setRequiredServiceTypeId(existing.getRequiredServiceTypeId()); MSSBamServiceByTypeIdxKey newKeyTypeIdx = schema.getFactoryService().newTypeIdxKey(); newKeyTypeIdx.setRequiredServiceTypeId(Buff.getRequiredServiceTypeId()); MSSBamServiceByUTypeIdxKey existingKeyUTypeIdx = schema.getFactoryService().newUTypeIdxKey(); existingKeyUTypeIdx.setRequiredHostNodeId(existing.getRequiredHostNodeId()); existingKeyUTypeIdx.setRequiredServiceTypeId(existing.getRequiredServiceTypeId()); MSSBamServiceByUTypeIdxKey newKeyUTypeIdx = schema.getFactoryService().newUTypeIdxKey(); newKeyUTypeIdx.setRequiredHostNodeId(Buff.getRequiredHostNodeId()); newKeyUTypeIdx.setRequiredServiceTypeId(Buff.getRequiredServiceTypeId()); MSSBamServiceByUHostPortIdxKey existingKeyUHostPortIdx = schema.getFactoryService().newUHostPortIdxKey(); existingKeyUHostPortIdx.setRequiredHostNodeId(existing.getRequiredHostNodeId()); existingKeyUHostPortIdx.setRequiredHostPort(existing.getRequiredHostPort()); MSSBamServiceByUHostPortIdxKey newKeyUHostPortIdx = schema.getFactoryService().newUHostPortIdxKey(); newKeyUHostPortIdx.setRequiredHostNodeId(Buff.getRequiredHostNodeId()); newKeyUHostPortIdx.setRequiredHostPort(Buff.getRequiredHostPort()); // Check unique indexes if (!existingKeyUTypeIdx.equals(newKeyUTypeIdx)) { if (dictByUTypeIdx.containsKey(newKeyUTypeIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "updateService", "ServiceUTypeIdx", newKeyUTypeIdx); } } if (!existingKeyUHostPortIdx.equals(newKeyUHostPortIdx)) { if (dictByUHostPortIdx.containsKey(newKeyUHostPortIdx)) { throw CFLib.getDefaultExceptionFactory().newUniqueIndexViolationException(getClass(), "updateService", "ServiceUHostPort", newKeyUHostPortIdx); } } // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema.getTableHostNode().readDerivedByIdIdx(Authorization, Buff.getRequiredHostNodeId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateService", "Container", "ServiceHost", "HostNode", null); } } } // Update is valid SortedMap<MSSBamServicePKey, MSSBamServiceBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); subdict = dictByHostIdx.get(existingKeyHostIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByHostIdx.containsKey(newKeyHostIdx)) { subdict = dictByHostIdx.get(newKeyHostIdx); } else { subdict = new TreeMap<MSSBamServicePKey, MSSBamServiceBuff>(); dictByHostIdx.put(newKeyHostIdx, subdict); } subdict.put(pkey, Buff); subdict = dictByTypeIdx.get(existingKeyTypeIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByTypeIdx.containsKey(newKeyTypeIdx)) { subdict = dictByTypeIdx.get(newKeyTypeIdx); } else { subdict = new TreeMap<MSSBamServicePKey, MSSBamServiceBuff>(); dictByTypeIdx.put(newKeyTypeIdx, subdict); } subdict.put(pkey, Buff); dictByUTypeIdx.remove(existingKeyUTypeIdx); dictByUTypeIdx.put(newKeyUTypeIdx, Buff); dictByUHostPortIdx.remove(existingKeyUHostPortIdx); dictByUHostPortIdx.put(newKeyUHostPortIdx, Buff); }
From source file:net.sourceforge.msscodefactory.v1_10.MSSBamRam.MSSBamRamServiceTable.java
public void deleteService(MSSBamAuthorization Authorization, MSSBamServiceBuff Buff) { final String S_ProcName = "MSSBamRamServiceTable.deleteService() "; MSSBamServicePKey pkey = schema.getFactoryService().newPKey(); pkey.setRequiredServiceId(schema.nextServiceIdGen()); MSSBamServiceBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "deleteService", "Existing record not found", "Service", pkey); }/*from w ww .jav a 2 s .c om*/ if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory().newCollisionDetectedException(getClass(), "deleteService", pkey); } MSSBamServiceByHostIdxKey keyHostIdx = schema.getFactoryService().newHostIdxKey(); keyHostIdx.setRequiredHostNodeId(existing.getRequiredHostNodeId()); MSSBamServiceByTypeIdxKey keyTypeIdx = schema.getFactoryService().newTypeIdxKey(); keyTypeIdx.setRequiredServiceTypeId(existing.getRequiredServiceTypeId()); MSSBamServiceByUTypeIdxKey keyUTypeIdx = schema.getFactoryService().newUTypeIdxKey(); keyUTypeIdx.setRequiredHostNodeId(existing.getRequiredHostNodeId()); keyUTypeIdx.setRequiredServiceTypeId(existing.getRequiredServiceTypeId()); MSSBamServiceByUHostPortIdxKey keyUHostPortIdx = schema.getFactoryService().newUHostPortIdxKey(); keyUHostPortIdx.setRequiredHostNodeId(existing.getRequiredHostNodeId()); keyUHostPortIdx.setRequiredHostPort(existing.getRequiredHostPort()); // Validate reverse foreign keys // Delete is valid SortedMap<MSSBamServicePKey, MSSBamServiceBuff> subdict; dictByPKey.remove(pkey); subdict = dictByHostIdx.get(keyHostIdx); subdict.remove(pkey); subdict = dictByTypeIdx.get(keyTypeIdx); subdict.remove(pkey); dictByUTypeIdx.remove(keyUTypeIdx); dictByUHostPortIdx.remove(keyUHostPortIdx); }
From source file:net.sourceforge.msscodefactory.v1_10.MSSBamRam.MSSBamRamTableBlobTable.java
public void updateTableBlob(MSSBamAuthorization Authorization, MSSBamTableBlobBuff Buff) { MSSBamAnyObjPKey pkey = schema.getFactoryAnyObj().newPKey(); pkey.setRequiredId(Buff.getRequiredId()); MSSBamTableBlobBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory().newStaleCacheDetectedException(getClass(), "updateTableBlob", "Existing record not found", "TableBlob", pkey); }/*from ww w. j a va 2 s . c o m*/ MSSBamTableBlobByContainerIdxKey existingKeyContainerIdx = schema.getFactoryTableBlob() .newContainerIdxKey(); existingKeyContainerIdx.setRequiredContainerId(existing.getRequiredContainerId()); MSSBamTableBlobByContainerIdxKey newKeyContainerIdx = schema.getFactoryTableBlob().newContainerIdxKey(); newKeyContainerIdx.setRequiredContainerId(Buff.getRequiredContainerId()); // Check unique indexes // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema.getTableBlobDef().readDerivedByIdIdx(Authorization, Buff.getRequiredId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateTableBlob", "Superclass", "SuperClass", "BlobDef", null); } } } { boolean allNull = true; if (allNull) { if (null == schema.getTableTable().readDerivedByIdIdx(Authorization, Buff.getRequiredContainerId())) { throw CFLib.getDefaultExceptionFactory().newUnresolvedRelationException(getClass(), "updateTableBlob", "Container", "CTable", "Table", null); } } } // Update is valid SortedMap<MSSBamAnyObjPKey, MSSBamTableBlobBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); subdict = dictByContainerIdx.get(existingKeyContainerIdx); if (subdict != null) { subdict.remove(pkey); } if (dictByContainerIdx.containsKey(newKeyContainerIdx)) { subdict = dictByContainerIdx.get(newKeyContainerIdx); } else { subdict = new TreeMap<MSSBamAnyObjPKey, MSSBamTableBlobBuff>(); dictByContainerIdx.put(newKeyContainerIdx, subdict); } subdict.put(pkey, Buff); }