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 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 readDerived( CFSecurityAuthorization Authorization, CFDbTestLoaderBehaviourPKey PKey) { final String S_ProcName = "CFDbTestRamLoaderBehaviour.readDerived"; CFDbTestLoaderBehaviourPKey key = schema.getFactoryLoaderBehaviour().newPKey(); key.setRequiredId(PKey.getRequiredId()); CFDbTestLoaderBehaviourBuff buff; if (dictByPKey.containsKey(key)) { buff = dictByPKey.get(key); } else { buff = null; } return (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 deleteLoaderBehaviourByIdIdx( CFSecurityAuthorization Authorization, CFDbTestLoaderBehaviourPKey argKey) { CFDbTestLoaderBehaviourBuff cur; LinkedList<CFDbTestLoaderBehaviourBuff> matchSet = new LinkedList<CFDbTestLoaderBehaviourBuff>(); Iterator<CFDbTestLoaderBehaviourBuff> values = dictByPKey.values().iterator(); while (values.hasNext()) { cur = values.next(); if (argKey.equals(cur)) { matchSet.add(cur); } } Iterator<CFDbTestLoaderBehaviourBuff> iterMatch = matchSet.iterator(); while (iterMatch.hasNext()) { cur = iterMatch.next(); deleteLoaderBehaviour(Authorization, cur); } }
public void deleteLoaderBehaviourByIdIdx( CFSecurityAuthorization Authorization, ICFDbTestSchema.LoaderBehaviourEnum argId) { CFDbTestLoaderBehaviourPKey key = schema.getFactoryLoaderBehaviour().newPKey(); key.setRequiredId(argId); deleteLoaderBehaviourByIdIdx(Authorization, key); }