public CFSecurityClusterBuff readDerivedByUDescrIdx(
      CFSecurityAuthorization Authorization, String Description) {
    final String S_ProcName = "CFDbTestRamCluster.readDerivedByUDescrIdx";
    CFSecurityClusterByUDescrIdxKey key = schema.getFactoryCluster().newUDescrIdxKey();
    key.setRequiredDescription(Description);

    CFSecurityClusterBuff buff;
    if (dictByUDescrIdx.containsKey(key)) {
      buff = dictByUDescrIdx.get(key);
    } else {
      buff = null;
    }
    return (buff);
  }
  public void createCluster(CFSecurityAuthorization Authorization, CFSecurityClusterBuff Buff) {
    final String S_ProcName = "createCluster";
    CFSecurityClusterPKey pkey = schema.getFactoryCluster().newPKey();
    pkey.setRequiredId(schema.nextClusterIdGen());
    Buff.setRequiredId(pkey.getRequiredId());
    CFSecurityClusterByUDomainNameIdxKey keyUDomainNameIdx =
        schema.getFactoryCluster().newUDomainNameIdxKey();
    keyUDomainNameIdx.setRequiredFullDomainName(Buff.getRequiredFullDomainName());

    CFSecurityClusterByUDescrIdxKey keyUDescrIdx = schema.getFactoryCluster().newUDescrIdxKey();
    keyUDescrIdx.setRequiredDescription(Buff.getRequiredDescription());

    // Validate unique indexes

    if (dictByPKey.containsKey(pkey)) {
      throw CFLib.getDefaultExceptionFactory()
          .newPrimaryKeyNotNewException(getClass(), S_ProcName, pkey);
    }

    if (dictByUDomainNameIdx.containsKey(keyUDomainNameIdx)) {
      throw CFLib.getDefaultExceptionFactory()
          .newUniqueIndexViolationException(
              getClass(), S_ProcName, "ClusterUDomainNameIdx", keyUDomainNameIdx);
    }

    if (dictByUDescrIdx.containsKey(keyUDescrIdx)) {
      throw CFLib.getDefaultExceptionFactory()
          .newUniqueIndexViolationException(
              getClass(), S_ProcName, "ClusterUDescrNameIdx", keyUDescrIdx);
    }

    // Validate foreign keys

    // Proceed with adding the new record

    dictByPKey.put(pkey, Buff);

    dictByUDomainNameIdx.put(keyUDomainNameIdx, Buff);

    dictByUDescrIdx.put(keyUDescrIdx, Buff);
  }
  public void deleteCluster(CFSecurityAuthorization Authorization, CFSecurityClusterBuff Buff) {
    final String S_ProcName = "CFDbTestRamClusterTable.deleteCluster() ";
    CFSecurityClusterPKey pkey = schema.getFactoryCluster().newPKey();
    pkey.setRequiredId(Buff.getRequiredId());
    CFSecurityClusterBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
      return;
    }
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
      throw CFLib.getDefaultExceptionFactory()
          .newCollisionDetectedException(getClass(), "deleteCluster", pkey);
    }
    CFSecurityClusterByUDomainNameIdxKey keyUDomainNameIdx =
        schema.getFactoryCluster().newUDomainNameIdxKey();
    keyUDomainNameIdx.setRequiredFullDomainName(existing.getRequiredFullDomainName());

    CFSecurityClusterByUDescrIdxKey keyUDescrIdx = schema.getFactoryCluster().newUDescrIdxKey();
    keyUDescrIdx.setRequiredDescription(existing.getRequiredDescription());

    // Validate reverse foreign keys

    // Delete is valid

    schema.getTableHostNode().deleteHostNodeByClusterIdx(Authorization, Buff.getRequiredId());
    schema.getTableTenant().deleteTenantByClusterIdx(Authorization, Buff.getRequiredId());
    schema.getTableSecApp().deleteSecAppByClusterIdx(Authorization, Buff.getRequiredId());
    schema.getTableSecGroup().deleteSecGroupByClusterIdx(Authorization, Buff.getRequiredId());
    schema.getTableSysCluster().deleteSysClusterByClusterIdx(Authorization, Buff.getRequiredId());
    Map<CFSecurityClusterPKey, CFSecurityClusterBuff> subdict;

    dictByPKey.remove(pkey);

    dictByUDomainNameIdx.remove(keyUDomainNameIdx);

    dictByUDescrIdx.remove(keyUDescrIdx);
  }
 public void deleteClusterByUDescrIdx(
     CFSecurityAuthorization Authorization, CFSecurityClusterByUDescrIdxKey argKey) {
   CFSecurityClusterBuff cur;
   LinkedList<CFSecurityClusterBuff> matchSet = new LinkedList<CFSecurityClusterBuff>();
   Iterator<CFSecurityClusterBuff> values = dictByPKey.values().iterator();
   while (values.hasNext()) {
     cur = values.next();
     if (argKey.equals(cur)) {
       matchSet.add(cur);
     }
   }
   Iterator<CFSecurityClusterBuff> iterMatch = matchSet.iterator();
   while (iterMatch.hasNext()) {
     cur = iterMatch.next();
     deleteCluster(Authorization, cur);
   }
 }
  public int compareTo(Object obj) {
    if (obj == null) {
      return (-1);
    } else if (obj instanceof CFSecurityClusterBuff) {
      CFSecurityClusterBuff rhs = (CFSecurityClusterBuff) obj;
      int retval = 0;
      {
        int cmp = getCreatedByUserId().compareTo(rhs.getCreatedByUserId());
        if (cmp != 0) {
          return (cmp);
        }

        cmp = getCreatedAt().compareTo(rhs.getCreatedAt());
        if (cmp != 0) {
          return (cmp);
        }

        cmp = getUpdatedByUserId().compareTo(rhs.getUpdatedByUserId());
        if (cmp != 0) {
          return (cmp);
        }

        cmp = getUpdatedAt().compareTo(rhs.getUpdatedAt());
        if (cmp != 0) {
          return (cmp);
        }
      }
      if (getRequiredId() < rhs.getRequiredId()) {
        return (-1);
      } else if (getRequiredId() > rhs.getRequiredId()) {
        return (1);
      }
      {
        int cmp = getRequiredFullDomainName().compareTo(rhs.getRequiredFullDomainName());
        if (cmp != 0) {
          return (cmp);
        }
      }
      {
        int cmp = getRequiredDescription().compareTo(rhs.getRequiredDescription());
        if (cmp != 0) {
          return (cmp);
        }
      }
      return (0);
    } else if (obj instanceof CFSecurityClusterPKey) {
      CFSecurityClusterPKey rhs = (CFSecurityClusterPKey) obj;
      if (getRequiredId() < rhs.getRequiredId()) {
        return (-1);
      } else if (getRequiredId() > rhs.getRequiredId()) {
        return (1);
      }
      return (0);
    } else if (obj instanceof CFSecurityClusterHPKey) {
      CFSecurityClusterHPKey rhs = (CFSecurityClusterHPKey) obj;
      {
        int lhsRequiredRevision = getRequiredRevision();
        int rhsRequiredRevision = rhs.getRequiredRevision();
        if (lhsRequiredRevision < rhsRequiredRevision) {
          return (-1);
        } else if (lhsRequiredRevision > rhsRequiredRevision) {
          return (1);
        }
      }
      if (getRequiredId() < rhs.getRequiredId()) {
        return (-1);
      } else if (getRequiredId() > rhs.getRequiredId()) {
        return (1);
      }
      return (0);
    } else if (obj instanceof CFSecurityClusterHBuff) {
      CFSecurityClusterHBuff rhs = (CFSecurityClusterHBuff) obj;
      int retval = 0;
      if (getRequiredId() < rhs.getRequiredId()) {
        return (-1);
      } else if (getRequiredId() > rhs.getRequiredId()) {
        return (1);
      }
      {
        int cmp = getRequiredFullDomainName().compareTo(rhs.getRequiredFullDomainName());
        if (cmp != 0) {
          return (cmp);
        }
      }
      {
        int cmp = getRequiredDescription().compareTo(rhs.getRequiredDescription());
        if (cmp != 0) {
          return (cmp);
        }
      }
      return (0);
    } else if (obj instanceof CFSecurityClusterByUDomainNameIdxKey) {
      CFSecurityClusterByUDomainNameIdxKey rhs = (CFSecurityClusterByUDomainNameIdxKey) obj;

      {
        int cmp = getRequiredFullDomainName().compareTo(rhs.getRequiredFullDomainName());
        if (cmp != 0) {
          return (cmp);
        }
      }
      return (0);
    } else if (obj instanceof CFSecurityClusterByUDescrIdxKey) {
      CFSecurityClusterByUDescrIdxKey rhs = (CFSecurityClusterByUDescrIdxKey) obj;

      {
        int cmp = getRequiredDescription().compareTo(rhs.getRequiredDescription());
        if (cmp != 0) {
          return (cmp);
        }
      }
      return (0);
    } else {
      throw CFLib.getDefaultExceptionFactory()
          .newUnsupportedClassException(getClass(), "compareTo", "obj", obj, null);
    }
  }
 public boolean equals(Object obj) {
   if (obj == null) {
     return (false);
   } else if (obj instanceof CFSecurityClusterBuff) {
     CFSecurityClusterBuff rhs = (CFSecurityClusterBuff) obj;
     if (!getCreatedByUserId().equals(rhs.getCreatedByUserId())) {
       return (false);
     }
     if (!getCreatedAt().equals(rhs.getCreatedAt())) {
       return (false);
     }
     if (!getUpdatedByUserId().equals(rhs.getUpdatedByUserId())) {
       return (false);
     }
     if (!getUpdatedAt().equals(rhs.getUpdatedAt())) {
       return (false);
     }
     if (getRequiredId() != rhs.getRequiredId()) {
       return (false);
     }
     if (!getRequiredFullDomainName().equals(rhs.getRequiredFullDomainName())) {
       return (false);
     }
     if (!getRequiredDescription().equals(rhs.getRequiredDescription())) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFSecurityClusterPKey) {
     CFSecurityClusterPKey rhs = (CFSecurityClusterPKey) obj;
     if (getRequiredId() != rhs.getRequiredId()) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFSecurityClusterHBuff) {
     CFSecurityClusterHBuff rhs = (CFSecurityClusterHBuff) obj;
     if (getRequiredId() != rhs.getRequiredId()) {
       return (false);
     }
     if (!getRequiredFullDomainName().equals(rhs.getRequiredFullDomainName())) {
       return (false);
     }
     if (!getRequiredDescription().equals(rhs.getRequiredDescription())) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFSecurityClusterHPKey) {
     CFSecurityClusterHPKey rhs = (CFSecurityClusterHPKey) obj;
     if (getRequiredId() != rhs.getRequiredId()) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFSecurityClusterByUDomainNameIdxKey) {
     CFSecurityClusterByUDomainNameIdxKey rhs = (CFSecurityClusterByUDomainNameIdxKey) obj;
     if (!getRequiredFullDomainName().equals(rhs.getRequiredFullDomainName())) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFSecurityClusterByUDescrIdxKey) {
     CFSecurityClusterByUDescrIdxKey rhs = (CFSecurityClusterByUDescrIdxKey) obj;
     if (!getRequiredDescription().equals(rhs.getRequiredDescription())) {
       return (false);
     }
     return (true);
   } else {
     boolean retval = super.equals(obj);
     return (retval);
   }
 }
 public void deleteClusterByUDescrIdx(
     CFSecurityAuthorization Authorization, String argDescription) {
   CFSecurityClusterByUDescrIdxKey key = schema.getFactoryCluster().newUDescrIdxKey();
   key.setRequiredDescription(argDescription);
   deleteClusterByUDescrIdx(Authorization, key);
 }
  public void updateCluster(CFSecurityAuthorization Authorization, CFSecurityClusterBuff Buff) {
    CFSecurityClusterPKey pkey = schema.getFactoryCluster().newPKey();
    pkey.setRequiredId(Buff.getRequiredId());
    CFSecurityClusterBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
      throw CFLib.getDefaultExceptionFactory()
          .newStaleCacheDetectedException(
              getClass(), "updateCluster", "Existing record not found", "Cluster", pkey);
    }
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
      throw CFLib.getDefaultExceptionFactory()
          .newCollisionDetectedException(getClass(), "updateCluster", pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    CFSecurityClusterByUDomainNameIdxKey existingKeyUDomainNameIdx =
        schema.getFactoryCluster().newUDomainNameIdxKey();
    existingKeyUDomainNameIdx.setRequiredFullDomainName(existing.getRequiredFullDomainName());

    CFSecurityClusterByUDomainNameIdxKey newKeyUDomainNameIdx =
        schema.getFactoryCluster().newUDomainNameIdxKey();
    newKeyUDomainNameIdx.setRequiredFullDomainName(Buff.getRequiredFullDomainName());

    CFSecurityClusterByUDescrIdxKey existingKeyUDescrIdx =
        schema.getFactoryCluster().newUDescrIdxKey();
    existingKeyUDescrIdx.setRequiredDescription(existing.getRequiredDescription());

    CFSecurityClusterByUDescrIdxKey newKeyUDescrIdx = schema.getFactoryCluster().newUDescrIdxKey();
    newKeyUDescrIdx.setRequiredDescription(Buff.getRequiredDescription());

    // Check unique indexes

    if (!existingKeyUDomainNameIdx.equals(newKeyUDomainNameIdx)) {
      if (dictByUDomainNameIdx.containsKey(newKeyUDomainNameIdx)) {
        throw CFLib.getDefaultExceptionFactory()
            .newUniqueIndexViolationException(
                getClass(), "updateCluster", "ClusterUDomainNameIdx", newKeyUDomainNameIdx);
      }
    }

    if (!existingKeyUDescrIdx.equals(newKeyUDescrIdx)) {
      if (dictByUDescrIdx.containsKey(newKeyUDescrIdx)) {
        throw CFLib.getDefaultExceptionFactory()
            .newUniqueIndexViolationException(
                getClass(), "updateCluster", "ClusterUDescrNameIdx", newKeyUDescrIdx);
      }
    }

    // Validate foreign keys

    // Update is valid

    Map<CFSecurityClusterPKey, CFSecurityClusterBuff> subdict;

    dictByPKey.remove(pkey);
    dictByPKey.put(pkey, Buff);

    dictByUDomainNameIdx.remove(existingKeyUDomainNameIdx);
    dictByUDomainNameIdx.put(newKeyUDomainNameIdx, Buff);

    dictByUDescrIdx.remove(existingKeyUDescrIdx);
    dictByUDescrIdx.put(newKeyUDescrIdx, Buff);
  }
 public void deleteClusterByUDescrIdx(
     CFSecurityAuthorization Authorization, CFSecurityClusterByUDescrIdxKey argKey) {
   deleteClusterByUDescrIdx(Authorization, argKey.getRequiredDescription());
 }