public boolean equals(Object obj) {
   if (obj == null) {
     return (false);
   } else if (obj instanceof CFDbTestNumberDefHBuff) {
     CFDbTestNumberDefHBuff rhs = (CFDbTestNumberDefHBuff) obj;
     if (!super.equals(obj)) {
       return (false);
     }
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     if (getRequiredId() != rhs.getRequiredId()) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFDbTestNumberDefBuff) {
     CFDbTestNumberDefBuff rhs = (CFDbTestNumberDefBuff) obj;
     if (!super.equals(obj)) {
       return (false);
     }
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     if (getRequiredId() != rhs.getRequiredId()) {
       return (false);
     }
     return (true);
   } else {
     return (super.equals(obj));
   }
 }
  public void deleteNumberDef(CFSecurityAuthorization Authorization, CFDbTestNumberDefBuff Buff) {
    final String S_ProcName = "CFDbTestRamNumberDefTable.deleteNumberDef() ";
    CFDbTestValuePKey pkey = schema.getFactoryValue().newPKey();
    pkey.setRequiredTenantId(Buff.getRequiredTenantId());
    pkey.setRequiredId(Buff.getRequiredId());
    CFDbTestNumberDefBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
      return;
    }
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
      throw CFLib.getDefaultExceptionFactory()
          .newCollisionDetectedException(getClass(), "deleteNumberDef", pkey);
    }

    // Validate reverse foreign keys

    if (schema
            .getTableNumberCol()
            .readDerivedByIdIdx(
                Authorization, existing.getRequiredTenantId(), existing.getRequiredId())
        != null) {
      throw CFLib.getDefaultExceptionFactory()
          .newDependentsDetectedException(
              getClass(), "deleteNumberDef", "Superclass", "SuperClass", "NumberCol", pkey);
    }

    if (schema
            .getTableNumberType()
            .readDerivedByIdIdx(
                Authorization, existing.getRequiredTenantId(), existing.getRequiredId())
        != null) {
      throw CFLib.getDefaultExceptionFactory()
          .newDependentsDetectedException(
              getClass(), "deleteNumberDef", "Superclass", "SuperClass", "NumberType", pkey);
    }

    // Delete is valid

    Map<CFDbTestValuePKey, CFDbTestNumberDefBuff> subdict;

    dictByPKey.remove(pkey);

    schema.getTableAtom().deleteAtom(Authorization, Buff);
  }
  public void updateNumberDef(CFSecurityAuthorization Authorization, CFDbTestNumberDefBuff Buff) {
    schema.getTableAtom().updateAtom(Authorization, Buff);
    CFDbTestValuePKey pkey = schema.getFactoryValue().newPKey();
    pkey.setRequiredTenantId(Buff.getRequiredTenantId());
    pkey.setRequiredId(Buff.getRequiredId());
    CFDbTestNumberDefBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
      throw CFLib.getDefaultExceptionFactory()
          .newStaleCacheDetectedException(
              getClass(), "updateNumberDef", "Existing record not found", "NumberDef", 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(), "updateNumberDef", "Superclass", "SuperClass", "Atom", null);
        }
      }
    }

    // Update is valid

    Map<CFDbTestValuePKey, CFDbTestNumberDefBuff> subdict;

    dictByPKey.remove(pkey);
    dictByPKey.put(pkey, Buff);
  }
  public void createNumberDef(CFSecurityAuthorization Authorization, CFDbTestNumberDefBuff Buff) {
    final String S_ProcName = "createNumberDef";
    schema.getTableAtom().createAtom(Authorization, Buff);
    CFDbTestValuePKey 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);
  }