public void deleteHostNodeByHostNameIdx(
     CFSecurityAuthorization Authorization, CFSecurityHostNodeByHostNameIdxKey argKey) {
   CFSecurityHostNodeBuff cur;
   LinkedList<CFSecurityHostNodeBuff> matchSet = new LinkedList<CFSecurityHostNodeBuff>();
   Iterator<CFSecurityHostNodeBuff> values = dictByPKey.values().iterator();
   while (values.hasNext()) {
     cur = values.next();
     if (argKey.equals(cur)) {
       matchSet.add(cur);
     }
   }
   Iterator<CFSecurityHostNodeBuff> iterMatch = matchSet.iterator();
   while (iterMatch.hasNext()) {
     cur = iterMatch.next();
     deleteHostNode(Authorization, cur);
   }
 }
  public void updateHostNode(CFSecurityAuthorization Authorization, CFSecurityHostNodeBuff Buff) {
    CFSecurityHostNodePKey pkey = schema.getFactoryHostNode().newPKey();
    pkey.setRequiredClusterId(Buff.getRequiredClusterId());
    pkey.setRequiredHostNodeId(Buff.getRequiredHostNodeId());
    CFSecurityHostNodeBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
      throw CFLib.getDefaultExceptionFactory()
          .newStaleCacheDetectedException(
              getClass(), "updateHostNode", "Existing record not found", "HostNode", pkey);
    }
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
      throw CFLib.getDefaultExceptionFactory()
          .newCollisionDetectedException(getClass(), "updateHostNode", pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    CFSecurityHostNodeByClusterIdxKey existingKeyClusterIdx =
        schema.getFactoryHostNode().newClusterIdxKey();
    existingKeyClusterIdx.setRequiredClusterId(existing.getRequiredClusterId());

    CFSecurityHostNodeByClusterIdxKey newKeyClusterIdx =
        schema.getFactoryHostNode().newClusterIdxKey();
    newKeyClusterIdx.setRequiredClusterId(Buff.getRequiredClusterId());

    CFSecurityHostNodeByUDescrIdxKey existingKeyUDescrIdx =
        schema.getFactoryHostNode().newUDescrIdxKey();
    existingKeyUDescrIdx.setRequiredClusterId(existing.getRequiredClusterId());
    existingKeyUDescrIdx.setRequiredDescription(existing.getRequiredDescription());

    CFSecurityHostNodeByUDescrIdxKey newKeyUDescrIdx =
        schema.getFactoryHostNode().newUDescrIdxKey();
    newKeyUDescrIdx.setRequiredClusterId(Buff.getRequiredClusterId());
    newKeyUDescrIdx.setRequiredDescription(Buff.getRequiredDescription());

    CFSecurityHostNodeByHostNameIdxKey existingKeyHostNameIdx =
        schema.getFactoryHostNode().newHostNameIdxKey();
    existingKeyHostNameIdx.setRequiredClusterId(existing.getRequiredClusterId());
    existingKeyHostNameIdx.setRequiredHostName(existing.getRequiredHostName());

    CFSecurityHostNodeByHostNameIdxKey newKeyHostNameIdx =
        schema.getFactoryHostNode().newHostNameIdxKey();
    newKeyHostNameIdx.setRequiredClusterId(Buff.getRequiredClusterId());
    newKeyHostNameIdx.setRequiredHostName(Buff.getRequiredHostName());

    // Check unique indexes

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

    if (!existingKeyHostNameIdx.equals(newKeyHostNameIdx)) {
      if (dictByHostNameIdx.containsKey(newKeyHostNameIdx)) {
        throw CFLib.getDefaultExceptionFactory()
            .newUniqueIndexViolationException(
                getClass(), "updateHostNode", "HostNodeUHostNameIdx", newKeyHostNameIdx);
      }
    }

    // Validate foreign keys

    {
      boolean allNull = true;

      if (allNull) {
        if (null
            == schema
                .getTableCluster()
                .readDerivedByIdIdx(Authorization, Buff.getRequiredClusterId())) {
          throw CFLib.getDefaultExceptionFactory()
              .newUnresolvedRelationException(
                  getClass(), "updateHostNode", "Container", "HostNodeCluster", "Cluster", null);
        }
      }
    }

    // Update is valid

    Map<CFSecurityHostNodePKey, CFSecurityHostNodeBuff> subdict;

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

    subdict = dictByClusterIdx.get(existingKeyClusterIdx);
    if (subdict != null) {
      subdict.remove(pkey);
    }
    if (dictByClusterIdx.containsKey(newKeyClusterIdx)) {
      subdict = dictByClusterIdx.get(newKeyClusterIdx);
    } else {
      subdict = new HashMap<CFSecurityHostNodePKey, CFSecurityHostNodeBuff>();
      dictByClusterIdx.put(newKeyClusterIdx, subdict);
    }
    subdict.put(pkey, Buff);

    dictByUDescrIdx.remove(existingKeyUDescrIdx);
    dictByUDescrIdx.put(newKeyUDescrIdx, Buff);

    dictByHostNameIdx.remove(existingKeyHostNameIdx);
    dictByHostNameIdx.put(newKeyHostNameIdx, Buff);
  }