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 deleteNumberDefByNextIdx(
     CFSecurityAuthorization Authorization, CFDbTestValueByNextIdxKey argKey) {
   final String S_ProcName = "deleteNumberDefByNextIdx";
   CFDbTestNumberDefBuff cur;
   LinkedList<CFDbTestNumberDefBuff> matchSet = new LinkedList<CFDbTestNumberDefBuff>();
   Iterator<CFDbTestNumberDefBuff> values = dictByPKey.values().iterator();
   while (values.hasNext()) {
     cur = values.next();
     if (argKey.equals(cur)) {
       matchSet.add(cur);
     }
   }
   Iterator<CFDbTestNumberDefBuff> iterMatch = matchSet.iterator();
   while (iterMatch.hasNext()) {
     cur = iterMatch.next();
     String subClassCode = cur.getClassCode();
     if ("NUMD".equals(subClassCode)) {
       schema.getTableNumberDef().deleteNumberDef(Authorization, cur);
     } else if ("NUMC".equals(subClassCode)) {
       schema.getTableNumberCol().deleteNumberCol(Authorization, (CFDbTestNumberColBuff) cur);
     } else if ("NUMT".equals(subClassCode)) {
       schema.getTableNumberType().deleteNumberType(Authorization, (CFDbTestNumberTypeBuff) cur);
     } else {
       throw CFLib.getDefaultExceptionFactory()
           .newUnsupportedClassException(
               getClass(),
               S_ProcName,
               "subClassCode",
               cur,
               "Instance of or subclass of NumberDef must not be \"" + subClassCode + "\"");
     }
   }
 }
 public CFDbTestNumberDefBuff lockBuff(
     CFSecurityAuthorization Authorization, CFDbTestValuePKey PKey) {
   final String S_ProcName = "lockBuff";
   CFDbTestNumberDefBuff buff = readDerived(Authorization, PKey);
   if ((buff != null) && (!buff.getClassCode().equals("NUMD"))) {
     buff = null;
   }
   return (buff);
 }
 public CFDbTestNumberDefBuff readBuffByUNameIdx(
     CFSecurityAuthorization Authorization, long TenantId, long ScopeId, String Name) {
   final String S_ProcName = "CFDbTestRamValue.readBuffByUNameIdx() ";
   CFDbTestNumberDefBuff buff = readDerivedByUNameIdx(Authorization, TenantId, ScopeId, Name);
   if ((buff != null) && buff.getClassCode().equals("VALU")) {
     return ((CFDbTestNumberDefBuff) buff);
   } else {
     return (null);
   }
 }
 public CFDbTestNumberDefBuff[] readAllBuff(CFSecurityAuthorization Authorization) {
   final String S_ProcName = "CFDbTestRamNumberDef.readAllBuff";
   CFDbTestNumberDefBuff buff;
   ArrayList<CFDbTestNumberDefBuff> filteredList = new ArrayList<CFDbTestNumberDefBuff>();
   CFDbTestNumberDefBuff[] buffList = readAllDerived(Authorization);
   for (int idx = 0; idx < buffList.length; idx++) {
     buff = buffList[idx];
     if ((buff != null) && buff.getClassCode().equals("NUMD")) {
       filteredList.add(buff);
     }
   }
   return (filteredList.toArray(new CFDbTestNumberDefBuff[0]));
 }
 public CFDbTestNumberDefBuff[] readBuffByNextIdx(
     CFSecurityAuthorization Authorization, Long NextTenantId, Long NextId) {
   final String S_ProcName = "CFDbTestRamValue.readBuffByNextIdx() ";
   CFDbTestNumberDefBuff buff;
   ArrayList<CFDbTestNumberDefBuff> filteredList = new ArrayList<CFDbTestNumberDefBuff>();
   CFDbTestNumberDefBuff[] buffList = readDerivedByNextIdx(Authorization, NextTenantId, NextId);
   for (int idx = 0; idx < buffList.length; idx++) {
     buff = buffList[idx];
     if ((buff != null) && buff.getClassCode().equals("VALU")) {
       filteredList.add((CFDbTestNumberDefBuff) buff);
     }
   }
   return (filteredList.toArray(new CFDbTestNumberDefBuff[0]));
 }
  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);
  }