public void createLoaderBehaviour( CFSecurityAuthorization Authorization, CFDbTestLoaderBehaviourBuff Buff) { final String S_ProcName = "createLoaderBehaviour"; CFDbTestLoaderBehaviourPKey pkey = schema.getFactoryLoaderBehaviour().newPKey(); pkey.setRequiredId(Buff.getRequiredId()); Buff.setRequiredId(pkey.getRequiredId()); CFDbTestLoaderBehaviourByUNameIdxKey keyUNameIdx = schema.getFactoryLoaderBehaviour().newUNameIdxKey(); keyUNameIdx.setRequiredName(Buff.getRequiredName()); // Validate unique indexes if (dictByPKey.containsKey(pkey)) { throw CFLib.getDefaultExceptionFactory() .newPrimaryKeyNotNewException(getClass(), S_ProcName, pkey); } if (dictByUNameIdx.containsKey(keyUNameIdx)) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), S_ProcName, "LoaderBehaviourUNameIdx", keyUNameIdx); } // Validate foreign keys // Proceed with adding the new record dictByPKey.put(pkey, Buff); dictByUNameIdx.put(keyUNameIdx, Buff); }
public void updateLoaderBehaviour( CFSecurityAuthorization Authorization, CFDbTestLoaderBehaviourBuff Buff) { CFDbTestLoaderBehaviourPKey pkey = schema.getFactoryLoaderBehaviour().newPKey(); pkey.setRequiredId(Buff.getRequiredId()); CFDbTestLoaderBehaviourBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory() .newStaleCacheDetectedException( getClass(), "updateLoaderBehaviour", "Existing record not found", "LoaderBehaviour", pkey); } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException(getClass(), "updateLoaderBehaviour", pkey); } Buff.setRequiredRevision(Buff.getRequiredRevision() + 1); CFDbTestLoaderBehaviourByUNameIdxKey existingKeyUNameIdx = schema.getFactoryLoaderBehaviour().newUNameIdxKey(); existingKeyUNameIdx.setRequiredName(existing.getRequiredName()); CFDbTestLoaderBehaviourByUNameIdxKey newKeyUNameIdx = schema.getFactoryLoaderBehaviour().newUNameIdxKey(); newKeyUNameIdx.setRequiredName(Buff.getRequiredName()); // Check unique indexes if (!existingKeyUNameIdx.equals(newKeyUNameIdx)) { if (dictByUNameIdx.containsKey(newKeyUNameIdx)) { throw CFLib.getDefaultExceptionFactory() .newUniqueIndexViolationException( getClass(), "updateLoaderBehaviour", "LoaderBehaviourUNameIdx", newKeyUNameIdx); } } // Validate foreign keys // Update is valid Map<CFDbTestLoaderBehaviourPKey, CFDbTestLoaderBehaviourBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); dictByUNameIdx.remove(existingKeyUNameIdx); dictByUNameIdx.put(newKeyUNameIdx, Buff); }
public void deleteLoaderBehaviour( CFSecurityAuthorization Authorization, CFDbTestLoaderBehaviourBuff Buff) { final String S_ProcName = "CFDbTestRamLoaderBehaviourTable.deleteLoaderBehaviour() "; CFDbTestLoaderBehaviourPKey pkey = schema.getFactoryLoaderBehaviour().newPKey(); pkey.setRequiredId(Buff.getRequiredId()); CFDbTestLoaderBehaviourBuff existing = dictByPKey.get(pkey); if (existing == null) { return; } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException(getClass(), "deleteLoaderBehaviour", pkey); } CFDbTestLoaderBehaviourByUNameIdxKey keyUNameIdx = schema.getFactoryLoaderBehaviour().newUNameIdxKey(); keyUNameIdx.setRequiredName(existing.getRequiredName()); // Validate reverse foreign keys // Delete is valid Map<CFDbTestLoaderBehaviourPKey, CFDbTestLoaderBehaviourBuff> subdict; dictByPKey.remove(pkey); dictByUNameIdx.remove(keyUNameIdx); }
public CFDbTestLoaderBehaviourBuff readDerivedByUNameIdx( CFSecurityAuthorization Authorization, String Name) { final String S_ProcName = "CFDbTestRamLoaderBehaviour.readDerivedByUNameIdx"; CFDbTestLoaderBehaviourByUNameIdxKey key = schema.getFactoryLoaderBehaviour().newUNameIdxKey(); key.setRequiredName(Name); CFDbTestLoaderBehaviourBuff buff; if (dictByUNameIdx.containsKey(key)) { buff = dictByUNameIdx.get(key); } else { buff = null; } return (buff); }
public void deleteLoaderBehaviourByUNameIdx( CFSecurityAuthorization Authorization, String argName) { CFDbTestLoaderBehaviourByUNameIdxKey key = schema.getFactoryLoaderBehaviour().newUNameIdxKey(); key.setRequiredName(argName); deleteLoaderBehaviourByUNameIdx(Authorization, key); }