public void updateUuidDef(CFSecurityAuthorization Authorization, CFBamUuidDefBuff Buff) { schema.getTableAtom().updateAtom(Authorization, Buff); CFBamValuePKey pkey = schema.getFactoryValue().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredId(Buff.getRequiredId()); CFBamUuidDefBuff existing = dictByPKey.get(pkey); if (existing == null) { throw CFLib.getDefaultExceptionFactory() .newStaleCacheDetectedException( getClass(), "updateUuidDef", "Existing record not found", "UuidDef", pkey); } // Check unique indexes // Validate foreign keys { boolean allNull = true; if (allNull) { if (null == schema .getTableAtom() .readDerivedByIdIdx( Authorization, Buff.getRequiredTenantId(), Buff.getRequiredId())) { throw CFLib.getDefaultExceptionFactory() .newUnresolvedRelationException( getClass(), "updateUuidDef", "Superclass", "SuperClass", "Atom", null); } } } // Update is valid Map<CFBamValuePKey, CFBamUuidDefBuff> subdict; dictByPKey.remove(pkey); dictByPKey.put(pkey, Buff); }
public void createUuidDef(CFSecurityAuthorization Authorization, CFBamUuidDefBuff Buff) { final String S_ProcName = "createUuidDef"; schema.getTableAtom().createAtom(Authorization, Buff); CFBamValuePKey pkey = schema.getFactoryValue().newPKey(); pkey.setClassCode(Buff.getClassCode()); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredId(Buff.getRequiredId()); // Validate unique indexes if (dictByPKey.containsKey(pkey)) { throw CFLib.getDefaultExceptionFactory() .newPrimaryKeyNotNewException(getClass(), S_ProcName, pkey); } // Validate foreign keys { boolean allNull = true; allNull = false; allNull = false; if (!allNull) { if (null == schema .getTableAtom() .readDerivedByIdIdx( Authorization, Buff.getRequiredTenantId(), Buff.getRequiredId())) { throw CFLib.getDefaultExceptionFactory() .newUnresolvedRelationException( getClass(), S_ProcName, "Superclass", "SuperClass", "Atom", null); } } } // Proceed with adding the new record dictByPKey.put(pkey, Buff); }
public void deleteUuidDef(CFSecurityAuthorization Authorization, CFBamUuidDefBuff Buff) { final String S_ProcName = "CFBamRamUuidDefTable.deleteUuidDef() "; CFBamValuePKey pkey = schema.getFactoryValue().newPKey(); pkey.setRequiredTenantId(Buff.getRequiredTenantId()); pkey.setRequiredId(Buff.getRequiredId()); CFBamUuidDefBuff existing = dictByPKey.get(pkey); if (existing == null) { return; } if (existing.getRequiredRevision() != Buff.getRequiredRevision()) { throw CFLib.getDefaultExceptionFactory() .newCollisionDetectedException(getClass(), "deleteUuidDef", pkey); } // Validate reverse foreign keys if (schema .getTableUuidCol() .readDerivedByIdIdx( Authorization, existing.getRequiredTenantId(), existing.getRequiredId()) != null) { throw CFLib.getDefaultExceptionFactory() .newDependentsDetectedException( getClass(), "deleteUuidDef", "Superclass", "SuperClass", "UuidCol", pkey); } if (schema .getTableUuidType() .readDerivedByIdIdx( Authorization, existing.getRequiredTenantId(), existing.getRequiredId()) != null) { throw CFLib.getDefaultExceptionFactory() .newDependentsDetectedException( getClass(), "deleteUuidDef", "Superclass", "SuperClass", "UuidType", pkey); } // Delete is valid Map<CFBamValuePKey, CFBamUuidDefBuff> subdict; dictByPKey.remove(pkey); schema.getTableAtom().deleteAtom(Authorization, Buff); }