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 lockBuff( CFSecurityAuthorization Authorization, CFDbTestLoaderBehaviourPKey PKey) { final String S_ProcName = "lockBuff"; CFDbTestLoaderBehaviourBuff buff = readDerived(Authorization, PKey); if ((buff != null) && (!buff.getClassCode().equals("LDBV"))) { buff = null; } return (buff); }
public CFDbTestLoaderBehaviourBuff readBuffByUNameIdx( CFSecurityAuthorization Authorization, String Name) { final String S_ProcName = "CFDbTestRamLoaderBehaviour.readBuffByUNameIdx() "; CFDbTestLoaderBehaviourBuff buff = readDerivedByUNameIdx(Authorization, Name); if ((buff != null) && buff.getClassCode().equals("LDBV")) { return ((CFDbTestLoaderBehaviourBuff) buff); } else { return (null); } }
public CFDbTestLoaderBehaviourBuff[] readAllBuff(CFSecurityAuthorization Authorization) { final String S_ProcName = "CFDbTestRamLoaderBehaviour.readAllBuff"; CFDbTestLoaderBehaviourBuff buff; ArrayList<CFDbTestLoaderBehaviourBuff> filteredList = new ArrayList<CFDbTestLoaderBehaviourBuff>(); CFDbTestLoaderBehaviourBuff[] buffList = readAllDerived(Authorization); for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; if ((buff != null) && buff.getClassCode().equals("LDBV")) { filteredList.add(buff); } } return (filteredList.toArray(new CFDbTestLoaderBehaviourBuff[0])); }
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); }