public void createCluster(CFSecurityAuthorization Authorization, CFSecurityClusterBuff Buff) { final String S_ProcName = "createCluster"; CFSecurityClusterPKey pkey = schema.getFactoryCluster().newPKey(); pkey.setRequiredId(schema.nextClusterIdGen()); Buff.setRequiredId(pkey.getRequiredId()); CFSecurityClusterByUDomainNameIdxKey keyUDomainNameIdx = schema.getFactoryCluster().newUDomainNameIdxKey(); keyUDomainNameIdx.setRequiredFullDomainName(Buff.getRequiredFullDomainName()); CFSecurityClusterByUDescrIdxKey keyUDescrIdx = schema.getFactoryCluster().newUDescrIdxKey(); keyUDescrIdx.setRequiredDescription(Buff.getRequiredDescription()); // Validate unique indexes if (dictByPKey.containsKey(pkey)) { throw CFLib.getDefaultExceptionFactory() .newPrimaryKeyNotNewException(getClass(), S_ProcName, pkey); } if (dictByUDomainNameIdx.containsKey(keyUDomainNameIdx)) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, "ClusterUDomainNameIdx", keyUDomainNameIdx); } if (dictByUDescrIdx.containsKey(keyUDescrIdx)) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, "ClusterUDescrNameIdx", keyUDescrIdx); } // Validate foreign keys // Proceed with adding the new record dictByPKey.put(pkey, Buff); dictByUDomainNameIdx.put(keyUDomainNameIdx, Buff); dictByUDescrIdx.put(keyUDescrIdx, Buff); }
public CFSecurityClusterBuff readDerivedByIdIdx(CFSecurityAuthorization Authorization, long Id) { final String S_ProcName = "CFDbTestRamCluster.readDerivedByIdIdx() "; CFSecurityClusterPKey key = schema.getFactoryCluster().newPKey(); key.setRequiredId(Id); CFSecurityClusterBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (buff); }
public CFSecurityClusterBuff readDerivedByUDescrIdx( CFSecurityAuthorization Authorization, String Description) { final String S_ProcName = "CFDbTestRamCluster.readDerivedByUDescrIdx"; CFSecurityClusterByUDescrIdxKey key = schema.getFactoryCluster().newUDescrIdxKey(); key.setRequiredDescription(Description); CFSecurityClusterBuff buff; if (dictByUDescrIdx.containsKey(key)) { buff = dictByUDescrIdx.get(key); } else { buff = null; } return (buff); }
public void deleteCluster(CFSecurityAuthorization Authorization, CFSecurityClusterBuff Buff) { final String S_ProcName = "CFDbTestRamClusterTable.deleteCluster() "; CFSecurityClusterPKey pkey = schema.getFactoryCluster().newPKey(); pkey.setRequiredId(Buff.getRequiredId()); CFSecurityClusterBuff existing = dictByPKey.get(pkey); if (existing == null) { return; } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException(getClass(), "deleteCluster", pkey); } CFSecurityClusterByUDomainNameIdxKey keyUDomainNameIdx = schema.getFactoryCluster().newUDomainNameIdxKey(); keyUDomainNameIdx.setRequiredFullDomainName(existing.getRequiredFullDomainName()); CFSecurityClusterByUDescrIdxKey keyUDescrIdx = schema.getFactoryCluster().newUDescrIdxKey(); keyUDescrIdx.setRequiredDescription(existing.getRequiredDescription()); // Validate reverse foreign keys // Delete is valid schema.getTableHostNode().deleteHostNodeByClusterIdx(Authorization, Buff.getRequiredId()); schema.getTableTenant().deleteTenantByClusterIdx(Authorization, Buff.getRequiredId()); schema.getTableSecApp().deleteSecAppByClusterIdx(Authorization, Buff.getRequiredId()); schema.getTableSecGroup().deleteSecGroupByClusterIdx(Authorization, Buff.getRequiredId()); schema.getTableSysCluster().deleteSysClusterByClusterIdx(Authorization, Buff.getRequiredId()); Map<CFSecurityClusterPKey, CFSecurityClusterBuff> subdict; dictByPKey.remove(pkey); dictByUDomainNameIdx.remove(keyUDomainNameIdx); dictByUDescrIdx.remove(keyUDescrIdx); }
public void deleteClusterByUDescrIdx( CFSecurityAuthorization Authorization, String argDescription) { CFSecurityClusterByUDescrIdxKey key = schema.getFactoryCluster().newUDescrIdxKey(); key.setRequiredDescription(argDescription); deleteClusterByUDescrIdx(Authorization, key); }
public void deleteClusterByUDomainNameIdx( CFSecurityAuthorization Authorization, String argFullDomainName) { CFSecurityClusterByUDomainNameIdxKey key = schema.getFactoryCluster().newUDomainNameIdxKey(); key.setRequiredFullDomainName(argFullDomainName); deleteClusterByUDomainNameIdx(Authorization, key); }
public void deleteClusterByIdIdx(CFSecurityAuthorization Authorization, long argId) { CFSecurityClusterPKey key = schema.getFactoryCluster().newPKey(); key.setRequiredId(argId); deleteClusterByIdIdx(Authorization, key); }
public void updateCluster(CFSecurityAuthorization Authorization, CFSecurityClusterBuff Buff) { CFSecurityClusterPKey pkey = schema.getFactoryCluster().newPKey(); pkey.setRequiredId(Buff.getRequiredId()); CFSecurityClusterBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory() .newStaleCacheDetectedException( getClass(), "updateCluster", "Existing record not found", "Cluster", pkey); } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException(getClass(), "updateCluster", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); CFSecurityClusterByUDomainNameIdxKey existingKeyUDomainNameIdx = schema.getFactoryCluster().newUDomainNameIdxKey(); existingKeyUDomainNameIdx.setRequiredFullDomainName(existing.getRequiredFullDomainName()); CFSecurityClusterByUDomainNameIdxKey newKeyUDomainNameIdx = schema.getFactoryCluster().newUDomainNameIdxKey(); newKeyUDomainNameIdx.setRequiredFullDomainName(Buff.getRequiredFullDomainName()); CFSecurityClusterByUDescrIdxKey existingKeyUDescrIdx = schema.getFactoryCluster().newUDescrIdxKey(); existingKeyUDescrIdx.setRequiredDescription(existing.getRequiredDescription()); CFSecurityClusterByUDescrIdxKey newKeyUDescrIdx = schema.getFactoryCluster().newUDescrIdxKey(); newKeyUDescrIdx.setRequiredDescription(Buff.getRequiredDescription()); // Check unique indexes if (!existingKeyUDomainNameIdx.equals(newKeyUDomainNameIdx)) { if (dictByUDomainNameIdx.containsKey(newKeyUDomainNameIdx)) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), "updateCluster", "ClusterUDomainNameIdx", newKeyUDomainNameIdx); } } if (!existingKeyUDescrIdx.equals(newKeyUDescrIdx)) { if (dictByUDescrIdx.containsKey(newKeyUDescrIdx)) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), "updateCluster", "ClusterUDescrNameIdx", newKeyUDescrIdx); } } // Validate foreign keys // Update is valid Map<CFSecurityClusterPKey, CFSecurityClusterBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); dictByUDomainNameIdx.remove(existingKeyUDomainNameIdx); dictByUDomainNameIdx.put(newKeyUDomainNameIdx, Buff); dictByUDescrIdx.remove(existingKeyUDescrIdx); dictByUDescrIdx.put(newKeyUDescrIdx, Buff); }