public void deleteTSecGroupMemberByUUserIdx(long TenantId, int TSecGroupId, UUID SecUserId) {
   if (indexByUUserIdx == null) {
     indexByUUserIdx =
         new HashMap<CFSecurityTSecGroupMemberByUUserIdxKey, ICFSecurityTSecGroupMemberObj>();
   }
   CFSecurityTSecGroupMemberByUUserIdxKey key =
       ((ICFCrmSchema) schema.getBackingStore()).getFactoryTSecGroupMember().newUUserIdxKey();
   key.setRequiredTenantId(TenantId);
   key.setRequiredTSecGroupId(TSecGroupId);
   key.setRequiredSecUserId(SecUserId);
   ICFSecurityTSecGroupMemberObj obj = null;
   if (indexByUUserIdx.containsKey(key)) {
     obj = indexByUUserIdx.get(key);
     ((ICFCrmSchema) schema.getBackingStore())
         .getTableTSecGroupMember()
         .deleteTSecGroupMemberByUUserIdx(
             schema.getAuthorization(), TenantId, TSecGroupId, SecUserId);
     obj.forget(true);
   } else {
     ((ICFCrmSchema) schema.getBackingStore())
         .getTableTSecGroupMember()
         .deleteTSecGroupMemberByUUserIdx(
             schema.getAuthorization(), TenantId, TSecGroupId, SecUserId);
   }
 }
 public ICFSecurityTSecGroupMemberObj readTSecGroupMemberByUUserIdx(
     long TenantId, int TSecGroupId, UUID SecUserId, boolean forceRead) {
   if (indexByUUserIdx == null) {
     indexByUUserIdx =
         new HashMap<CFSecurityTSecGroupMemberByUUserIdxKey, ICFSecurityTSecGroupMemberObj>();
   }
   CFSecurityTSecGroupMemberByUUserIdxKey key =
       ((ICFCrmSchema) schema.getBackingStore()).getFactoryTSecGroupMember().newUUserIdxKey();
   key.setRequiredTenantId(TenantId);
   key.setRequiredTSecGroupId(TSecGroupId);
   key.setRequiredSecUserId(SecUserId);
   ICFSecurityTSecGroupMemberObj obj = null;
   if ((!forceRead) && indexByUUserIdx.containsKey(key)) {
     obj = indexByUUserIdx.get(key);
   } else {
     CFSecurityTSecGroupMemberBuff buff =
         ((ICFCrmSchema) schema.getBackingStore())
             .getTableTSecGroupMember()
             .readDerivedByUUserIdx(schema.getAuthorization(), TenantId, TSecGroupId, SecUserId);
     if (buff != null) {
       obj = schema.getTSecGroupMemberTableObj().newInstance();
       obj.setPKey(
           ((ICFCrmSchema) schema.getBackingStore()).getFactoryTSecGroupMember().newPKey());
       obj.setBuff(buff);
       obj = (ICFSecurityTSecGroupMemberObj) obj.realize();
     } else if (schema.getCacheMisses()) {
       indexByUUserIdx.put(key, null);
     }
   }
   return (obj);
 }
  public void forgetTSecGroupMember(ICFSecurityTSecGroupMemberObj Obj, boolean forgetSubObjects) {
    ICFSecurityTSecGroupMemberObj obj = Obj;
    CFSecurityTSecGroupMemberPKey pkey = obj.getPKey();
    if (members.containsKey(pkey)) {
      ICFSecurityTSecGroupMemberObj keepObj = members.get(pkey);
      // Detach object from alternate, duplicate, all and PKey indexes

      if (indexByTenantIdx != null) {
        CFSecurityTSecGroupMemberByTenantIdxKey keyTenantIdx =
            ((ICFCrmSchema) schema.getBackingStore()).getFactoryTSecGroupMember().newTenantIdxKey();
        keyTenantIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        Map<CFSecurityTSecGroupMemberPKey, ICFSecurityTSecGroupMemberObj> mapTenantIdx =
            indexByTenantIdx.get(keyTenantIdx);
        if (mapTenantIdx != null) {
          mapTenantIdx.remove(keepObj.getPKey());
        }
      }

      if (indexByGroupIdx != null) {
        CFSecurityTSecGroupMemberByGroupIdxKey keyGroupIdx =
            ((ICFCrmSchema) schema.getBackingStore()).getFactoryTSecGroupMember().newGroupIdxKey();
        keyGroupIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        keyGroupIdx.setRequiredTSecGroupId(keepObj.getRequiredTSecGroupId());
        Map<CFSecurityTSecGroupMemberPKey, ICFSecurityTSecGroupMemberObj> mapGroupIdx =
            indexByGroupIdx.get(keyGroupIdx);
        if (mapGroupIdx != null) {
          mapGroupIdx.remove(keepObj.getPKey());
        }
      }

      if (indexByUserIdx != null) {
        CFSecurityTSecGroupMemberByUserIdxKey keyUserIdx =
            ((ICFCrmSchema) schema.getBackingStore()).getFactoryTSecGroupMember().newUserIdxKey();
        keyUserIdx.setRequiredSecUserId(keepObj.getRequiredSecUserId());
        Map<CFSecurityTSecGroupMemberPKey, ICFSecurityTSecGroupMemberObj> mapUserIdx =
            indexByUserIdx.get(keyUserIdx);
        if (mapUserIdx != null) {
          mapUserIdx.remove(keepObj.getPKey());
        }
      }

      if (indexByUUserIdx != null) {
        CFSecurityTSecGroupMemberByUUserIdxKey keyUUserIdx =
            ((ICFCrmSchema) schema.getBackingStore()).getFactoryTSecGroupMember().newUUserIdxKey();
        keyUUserIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        keyUUserIdx.setRequiredTSecGroupId(keepObj.getRequiredTSecGroupId());
        keyUUserIdx.setRequiredSecUserId(keepObj.getRequiredSecUserId());
        indexByUUserIdx.remove(keyUUserIdx);
      }

      if (allTSecGroupMember != null) {
        allTSecGroupMember.remove(keepObj.getPKey());
      }
      members.remove(pkey);
      if (forgetSubObjects) {}
    }
  }
 public void deleteTSecGroupMemberByUUserIdx(
     CFSecurityAuthorization Authorization,
     long argTenantId,
     int argTSecGroupId,
     UUID argSecUserId) {
   CFSecurityTSecGroupMemberByUUserIdxKey key =
       schema.getFactoryTSecGroupMember().newUUserIdxKey();
   key.setRequiredTenantId(argTenantId);
   key.setRequiredTSecGroupId(argTSecGroupId);
   key.setRequiredSecUserId(argSecUserId);
   deleteTSecGroupMemberByUUserIdx(Authorization, key);
 }
  public void deleteTSecGroupMember(
      CFSecurityAuthorization Authorization, CFSecurityTSecGroupMemberBuff Buff) {
    final String S_ProcName = "CFSecurityRamTSecGroupMemberTable.deleteTSecGroupMember() ";
    CFSecurityTSecGroupMemberPKey pkey = schema.getFactoryTSecGroupMember().newPKey();
    pkey.setRequiredTenantId(Buff.getRequiredTenantId());
    pkey.setRequiredTSecGroupMemberId(Buff.getRequiredTSecGroupMemberId());
    CFSecurityTSecGroupMemberBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
      return;
    }
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
      throw CFLib.getDefaultExceptionFactory()
          .newCollisionDetectedException(getClass(), "deleteTSecGroupMember", pkey);
    }
    CFSecurityTSecGroupMemberByTenantIdxKey keyTenantIdx =
        schema.getFactoryTSecGroupMember().newTenantIdxKey();
    keyTenantIdx.setRequiredTenantId(existing.getRequiredTenantId());

    CFSecurityTSecGroupMemberByGroupIdxKey keyGroupIdx =
        schema.getFactoryTSecGroupMember().newGroupIdxKey();
    keyGroupIdx.setRequiredTenantId(existing.getRequiredTenantId());
    keyGroupIdx.setRequiredTSecGroupId(existing.getRequiredTSecGroupId());

    CFSecurityTSecGroupMemberByUserIdxKey keyUserIdx =
        schema.getFactoryTSecGroupMember().newUserIdxKey();
    keyUserIdx.setRequiredSecUserId(existing.getRequiredSecUserId());

    CFSecurityTSecGroupMemberByUUserIdxKey keyUUserIdx =
        schema.getFactoryTSecGroupMember().newUUserIdxKey();
    keyUUserIdx.setRequiredTenantId(existing.getRequiredTenantId());
    keyUUserIdx.setRequiredTSecGroupId(existing.getRequiredTSecGroupId());
    keyUUserIdx.setRequiredSecUserId(existing.getRequiredSecUserId());

    // Validate reverse foreign keys

    // Delete is valid

    Map<CFSecurityTSecGroupMemberPKey, CFSecurityTSecGroupMemberBuff> subdict;

    dictByPKey.remove(pkey);

    subdict = dictByTenantIdx.get(keyTenantIdx);
    subdict.remove(pkey);

    subdict = dictByGroupIdx.get(keyGroupIdx);
    subdict.remove(pkey);

    subdict = dictByUserIdx.get(keyUserIdx);
    subdict.remove(pkey);

    dictByUUserIdx.remove(keyUUserIdx);
  }
  public CFSecurityTSecGroupMemberBuff readDerivedByUUserIdx(
      CFSecurityAuthorization Authorization, long TenantId, int TSecGroupId, UUID SecUserId) {
    final String S_ProcName = "CFSecurityRamTSecGroupMember.readDerivedByUUserIdx";
    CFSecurityTSecGroupMemberByUUserIdxKey key =
        schema.getFactoryTSecGroupMember().newUUserIdxKey();
    key.setRequiredTenantId(TenantId);
    key.setRequiredTSecGroupId(TSecGroupId);
    key.setRequiredSecUserId(SecUserId);

    CFSecurityTSecGroupMemberBuff buff;
    if (dictByUUserIdx.containsKey(key)) {
      buff = dictByUUserIdx.get(key);
    } else {
      buff = null;
    }
    return (buff);
  }
  public void forgetTSecGroupMemberByUUserIdx(long TenantId, int TSecGroupId, UUID SecUserId) {
    if (indexByUUserIdx == null) {
      return;
    }
    CFSecurityTSecGroupMemberByUUserIdxKey key =
        ((ICFCrmSchema) schema.getBackingStore()).getFactoryTSecGroupMember().newUUserIdxKey();
    key.setRequiredTenantId(TenantId);
    key.setRequiredTSecGroupId(TSecGroupId);
    key.setRequiredSecUserId(SecUserId);
    if (indexByUUserIdx.containsKey(key)) {
      ICFSecurityTSecGroupMemberObj probed = indexByUUserIdx.get(key);
      if (probed != null) {
        probed.forget(true);
      }

      indexByUUserIdx.remove(key);
    }
  }
 public void deleteTSecGroupMemberByUUserIdx(
     CFSecurityAuthorization Authorization, CFSecurityTSecGroupMemberByUUserIdxKey argKey) {
   CFSecurityTSecGroupMemberBuff cur;
   LinkedList<CFSecurityTSecGroupMemberBuff> matchSet =
       new LinkedList<CFSecurityTSecGroupMemberBuff>();
   Iterator<CFSecurityTSecGroupMemberBuff> values = dictByPKey.values().iterator();
   while (values.hasNext()) {
     cur = values.next();
     if (argKey.equals(cur)) {
       matchSet.add(cur);
     }
   }
   Iterator<CFSecurityTSecGroupMemberBuff> iterMatch = matchSet.iterator();
   while (iterMatch.hasNext()) {
     cur = iterMatch.next();
     deleteTSecGroupMember(Authorization, cur);
   }
 }
  public void createTSecGroupMember(
      CFSecurityAuthorization Authorization, CFSecurityTSecGroupMemberBuff Buff) {
    final String S_ProcName = "createTSecGroupMember";
    CFSecurityTSecGroupMemberPKey pkey = schema.getFactoryTSecGroupMember().newPKey();
    pkey.setRequiredTenantId(Buff.getRequiredTenantId());
    pkey.setRequiredTSecGroupMemberId(
        ((CFSecurityRamTenantTable) schema.getTableTenant())
            .nextTSecGroupMemberIdGen(Authorization, Buff.getRequiredTenantId()));
    Buff.setRequiredTenantId(pkey.getRequiredTenantId());
    Buff.setRequiredTSecGroupMemberId(pkey.getRequiredTSecGroupMemberId());
    CFSecurityTSecGroupMemberByTenantIdxKey keyTenantIdx =
        schema.getFactoryTSecGroupMember().newTenantIdxKey();
    keyTenantIdx.setRequiredTenantId(Buff.getRequiredTenantId());

    CFSecurityTSecGroupMemberByGroupIdxKey keyGroupIdx =
        schema.getFactoryTSecGroupMember().newGroupIdxKey();
    keyGroupIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    keyGroupIdx.setRequiredTSecGroupId(Buff.getRequiredTSecGroupId());

    CFSecurityTSecGroupMemberByUserIdxKey keyUserIdx =
        schema.getFactoryTSecGroupMember().newUserIdxKey();
    keyUserIdx.setRequiredSecUserId(Buff.getRequiredSecUserId());

    CFSecurityTSecGroupMemberByUUserIdxKey keyUUserIdx =
        schema.getFactoryTSecGroupMember().newUUserIdxKey();
    keyUUserIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    keyUUserIdx.setRequiredTSecGroupId(Buff.getRequiredTSecGroupId());
    keyUUserIdx.setRequiredSecUserId(Buff.getRequiredSecUserId());

    // Validate unique indexes

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

    if (dictByUUserIdx.containsKey(keyUUserIdx)) {
      throw CFLib.getDefaultExceptionFactory()
          .newUniqueIndexViolationException(
              getClass(), S_ProcName, "TSecGroupMemberUUserIdx", keyUUserIdx);
    }

    // Validate foreign keys

    {
      boolean allNull = true;
      allNull = false;
      if (!allNull) {
        if (null
            == schema
                .getTableTenant()
                .readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId())) {
          throw CFLib.getDefaultExceptionFactory()
              .newUnresolvedRelationException(
                  getClass(), S_ProcName, "Owner", "TSecGroupMemberTenant", "Tenant", null);
        }
      }
    }

    {
      boolean allNull = true;
      allNull = false;
      allNull = false;
      if (!allNull) {
        if (null
            == schema
                .getTableTSecGroup()
                .readDerivedByIdIdx(
                    Authorization, Buff.getRequiredTenantId(), Buff.getRequiredTSecGroupId())) {
          throw CFLib.getDefaultExceptionFactory()
              .newUnresolvedRelationException(
                  getClass(), S_ProcName, "Container", "TSecGroupMemberGroup", "TSecGroup", null);
        }
      }
    }

    // Proceed with adding the new record

    dictByPKey.put(pkey, Buff);

    Map<CFSecurityTSecGroupMemberPKey, CFSecurityTSecGroupMemberBuff> subdictTenantIdx;
    if (dictByTenantIdx.containsKey(keyTenantIdx)) {
      subdictTenantIdx = dictByTenantIdx.get(keyTenantIdx);
    } else {
      subdictTenantIdx =
          new HashMap<CFSecurityTSecGroupMemberPKey, CFSecurityTSecGroupMemberBuff>();
      dictByTenantIdx.put(keyTenantIdx, subdictTenantIdx);
    }
    subdictTenantIdx.put(pkey, Buff);

    Map<CFSecurityTSecGroupMemberPKey, CFSecurityTSecGroupMemberBuff> subdictGroupIdx;
    if (dictByGroupIdx.containsKey(keyGroupIdx)) {
      subdictGroupIdx = dictByGroupIdx.get(keyGroupIdx);
    } else {
      subdictGroupIdx = new HashMap<CFSecurityTSecGroupMemberPKey, CFSecurityTSecGroupMemberBuff>();
      dictByGroupIdx.put(keyGroupIdx, subdictGroupIdx);
    }
    subdictGroupIdx.put(pkey, Buff);

    Map<CFSecurityTSecGroupMemberPKey, CFSecurityTSecGroupMemberBuff> subdictUserIdx;
    if (dictByUserIdx.containsKey(keyUserIdx)) {
      subdictUserIdx = dictByUserIdx.get(keyUserIdx);
    } else {
      subdictUserIdx = new HashMap<CFSecurityTSecGroupMemberPKey, CFSecurityTSecGroupMemberBuff>();
      dictByUserIdx.put(keyUserIdx, subdictUserIdx);
    }
    subdictUserIdx.put(pkey, Buff);

    dictByUUserIdx.put(keyUUserIdx, Buff);
  }
  public void updateTSecGroupMember(
      CFSecurityAuthorization Authorization, CFSecurityTSecGroupMemberBuff Buff) {
    CFSecurityTSecGroupMemberPKey pkey = schema.getFactoryTSecGroupMember().newPKey();
    pkey.setRequiredTenantId(Buff.getRequiredTenantId());
    pkey.setRequiredTSecGroupMemberId(Buff.getRequiredTSecGroupMemberId());
    CFSecurityTSecGroupMemberBuff existing = dictByPKey.get(pkey);
    if (existing == null) {
      throw CFLib.getDefaultExceptionFactory()
          .newStaleCacheDetectedException(
              getClass(),
              "updateTSecGroupMember",
              "Existing record not found",
              "TSecGroupMember",
              pkey);
    }
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
      throw CFLib.getDefaultExceptionFactory()
          .newCollisionDetectedException(getClass(), "updateTSecGroupMember", pkey);
    }
    Buff.setRequiredRevision(Buff.getRequiredRevision() + 1);
    CFSecurityTSecGroupMemberByTenantIdxKey existingKeyTenantIdx =
        schema.getFactoryTSecGroupMember().newTenantIdxKey();
    existingKeyTenantIdx.setRequiredTenantId(existing.getRequiredTenantId());

    CFSecurityTSecGroupMemberByTenantIdxKey newKeyTenantIdx =
        schema.getFactoryTSecGroupMember().newTenantIdxKey();
    newKeyTenantIdx.setRequiredTenantId(Buff.getRequiredTenantId());

    CFSecurityTSecGroupMemberByGroupIdxKey existingKeyGroupIdx =
        schema.getFactoryTSecGroupMember().newGroupIdxKey();
    existingKeyGroupIdx.setRequiredTenantId(existing.getRequiredTenantId());
    existingKeyGroupIdx.setRequiredTSecGroupId(existing.getRequiredTSecGroupId());

    CFSecurityTSecGroupMemberByGroupIdxKey newKeyGroupIdx =
        schema.getFactoryTSecGroupMember().newGroupIdxKey();
    newKeyGroupIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    newKeyGroupIdx.setRequiredTSecGroupId(Buff.getRequiredTSecGroupId());

    CFSecurityTSecGroupMemberByUserIdxKey existingKeyUserIdx =
        schema.getFactoryTSecGroupMember().newUserIdxKey();
    existingKeyUserIdx.setRequiredSecUserId(existing.getRequiredSecUserId());

    CFSecurityTSecGroupMemberByUserIdxKey newKeyUserIdx =
        schema.getFactoryTSecGroupMember().newUserIdxKey();
    newKeyUserIdx.setRequiredSecUserId(Buff.getRequiredSecUserId());

    CFSecurityTSecGroupMemberByUUserIdxKey existingKeyUUserIdx =
        schema.getFactoryTSecGroupMember().newUUserIdxKey();
    existingKeyUUserIdx.setRequiredTenantId(existing.getRequiredTenantId());
    existingKeyUUserIdx.setRequiredTSecGroupId(existing.getRequiredTSecGroupId());
    existingKeyUUserIdx.setRequiredSecUserId(existing.getRequiredSecUserId());

    CFSecurityTSecGroupMemberByUUserIdxKey newKeyUUserIdx =
        schema.getFactoryTSecGroupMember().newUUserIdxKey();
    newKeyUUserIdx.setRequiredTenantId(Buff.getRequiredTenantId());
    newKeyUUserIdx.setRequiredTSecGroupId(Buff.getRequiredTSecGroupId());
    newKeyUUserIdx.setRequiredSecUserId(Buff.getRequiredSecUserId());

    // Check unique indexes

    if (!existingKeyUUserIdx.equals(newKeyUUserIdx)) {
      if (dictByUUserIdx.containsKey(newKeyUUserIdx)) {
        throw CFLib.getDefaultExceptionFactory()
            .newUniqueIndexViolationException(
                getClass(), "updateTSecGroupMember", "TSecGroupMemberUUserIdx", newKeyUUserIdx);
      }
    }

    // Validate foreign keys

    {
      boolean allNull = true;

      if (allNull) {
        if (null
            == schema
                .getTableTenant()
                .readDerivedByIdIdx(Authorization, Buff.getRequiredTenantId())) {
          throw CFLib.getDefaultExceptionFactory()
              .newUnresolvedRelationException(
                  getClass(),
                  "updateTSecGroupMember",
                  "Owner",
                  "TSecGroupMemberTenant",
                  "Tenant",
                  null);
        }
      }
    }

    {
      boolean allNull = true;

      if (allNull) {
        if (null
            == schema
                .getTableTSecGroup()
                .readDerivedByIdIdx(
                    Authorization, Buff.getRequiredTenantId(), Buff.getRequiredTSecGroupId())) {
          throw CFLib.getDefaultExceptionFactory()
              .newUnresolvedRelationException(
                  getClass(),
                  "updateTSecGroupMember",
                  "Container",
                  "TSecGroupMemberGroup",
                  "TSecGroup",
                  null);
        }
      }
    }

    // Update is valid

    Map<CFSecurityTSecGroupMemberPKey, CFSecurityTSecGroupMemberBuff> subdict;

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

    subdict = dictByTenantIdx.get(existingKeyTenantIdx);
    if (subdict != null) {
      subdict.remove(pkey);
    }
    if (dictByTenantIdx.containsKey(newKeyTenantIdx)) {
      subdict = dictByTenantIdx.get(newKeyTenantIdx);
    } else {
      subdict = new HashMap<CFSecurityTSecGroupMemberPKey, CFSecurityTSecGroupMemberBuff>();
      dictByTenantIdx.put(newKeyTenantIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictByGroupIdx.get(existingKeyGroupIdx);
    if (subdict != null) {
      subdict.remove(pkey);
    }
    if (dictByGroupIdx.containsKey(newKeyGroupIdx)) {
      subdict = dictByGroupIdx.get(newKeyGroupIdx);
    } else {
      subdict = new HashMap<CFSecurityTSecGroupMemberPKey, CFSecurityTSecGroupMemberBuff>();
      dictByGroupIdx.put(newKeyGroupIdx, subdict);
    }
    subdict.put(pkey, Buff);

    subdict = dictByUserIdx.get(existingKeyUserIdx);
    if (subdict != null) {
      subdict.remove(pkey);
    }
    if (dictByUserIdx.containsKey(newKeyUserIdx)) {
      subdict = dictByUserIdx.get(newKeyUserIdx);
    } else {
      subdict = new HashMap<CFSecurityTSecGroupMemberPKey, CFSecurityTSecGroupMemberBuff>();
      dictByUserIdx.put(newKeyUserIdx, subdict);
    }
    subdict.put(pkey, Buff);

    dictByUUserIdx.remove(existingKeyUUserIdx);
    dictByUUserIdx.put(newKeyUUserIdx, Buff);
  }
  public ICFSecurityTSecGroupMemberObj realizeTSecGroupMember(ICFSecurityTSecGroupMemberObj Obj) {
    ICFSecurityTSecGroupMemberObj obj = Obj;
    CFSecurityTSecGroupMemberPKey pkey = obj.getPKey();
    ICFSecurityTSecGroupMemberObj keepObj = null;
    if (members.containsKey(pkey) && (null != members.get(pkey))) {
      ICFSecurityTSecGroupMemberObj existingObj = members.get(pkey);
      keepObj = existingObj;

      /*
       *	We always rebind the data because if we're being called, some index has
       *	been updated and is refreshing it's data, which may or may not have changed
       */

      // Detach object from alternate and duplicate indexes, leave PKey alone

      if (indexByTenantIdx != null) {
        CFSecurityTSecGroupMemberByTenantIdxKey keyTenantIdx =
            ((ICFCrmSchema) schema.getBackingStore()).getFactoryTSecGroupMember().newTenantIdxKey();
        keyTenantIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        Map<CFSecurityTSecGroupMemberPKey, ICFSecurityTSecGroupMemberObj> mapTenantIdx =
            indexByTenantIdx.get(keyTenantIdx);
        if (mapTenantIdx != null) {
          mapTenantIdx.remove(keepObj.getPKey());
        }
      }

      if (indexByGroupIdx != null) {
        CFSecurityTSecGroupMemberByGroupIdxKey keyGroupIdx =
            ((ICFCrmSchema) schema.getBackingStore()).getFactoryTSecGroupMember().newGroupIdxKey();
        keyGroupIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        keyGroupIdx.setRequiredTSecGroupId(keepObj.getRequiredTSecGroupId());
        Map<CFSecurityTSecGroupMemberPKey, ICFSecurityTSecGroupMemberObj> mapGroupIdx =
            indexByGroupIdx.get(keyGroupIdx);
        if (mapGroupIdx != null) {
          mapGroupIdx.remove(keepObj.getPKey());
        }
      }

      if (indexByUserIdx != null) {
        CFSecurityTSecGroupMemberByUserIdxKey keyUserIdx =
            ((ICFCrmSchema) schema.getBackingStore()).getFactoryTSecGroupMember().newUserIdxKey();
        keyUserIdx.setRequiredSecUserId(keepObj.getRequiredSecUserId());
        Map<CFSecurityTSecGroupMemberPKey, ICFSecurityTSecGroupMemberObj> mapUserIdx =
            indexByUserIdx.get(keyUserIdx);
        if (mapUserIdx != null) {
          mapUserIdx.remove(keepObj.getPKey());
        }
      }

      if (indexByUUserIdx != null) {
        CFSecurityTSecGroupMemberByUUserIdxKey keyUUserIdx =
            ((ICFCrmSchema) schema.getBackingStore()).getFactoryTSecGroupMember().newUUserIdxKey();
        keyUUserIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        keyUUserIdx.setRequiredTSecGroupId(keepObj.getRequiredTSecGroupId());
        keyUUserIdx.setRequiredSecUserId(keepObj.getRequiredSecUserId());
        indexByUUserIdx.remove(keyUUserIdx);
      }

      keepObj.setBuff(Obj.getBuff());
      // Attach new object to alternate and duplicate indexes -- PKey stay stable

      if (indexByTenantIdx != null) {
        CFSecurityTSecGroupMemberByTenantIdxKey keyTenantIdx =
            ((ICFCrmSchema) schema.getBackingStore()).getFactoryTSecGroupMember().newTenantIdxKey();
        keyTenantIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        Map<CFSecurityTSecGroupMemberPKey, ICFSecurityTSecGroupMemberObj> mapTenantIdx =
            indexByTenantIdx.get(keyTenantIdx);
        if (mapTenantIdx != null) {
          mapTenantIdx.put(keepObj.getPKey(), keepObj);
        }
      }

      if (indexByGroupIdx != null) {
        CFSecurityTSecGroupMemberByGroupIdxKey keyGroupIdx =
            ((ICFCrmSchema) schema.getBackingStore()).getFactoryTSecGroupMember().newGroupIdxKey();
        keyGroupIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        keyGroupIdx.setRequiredTSecGroupId(keepObj.getRequiredTSecGroupId());
        Map<CFSecurityTSecGroupMemberPKey, ICFSecurityTSecGroupMemberObj> mapGroupIdx =
            indexByGroupIdx.get(keyGroupIdx);
        if (mapGroupIdx != null) {
          mapGroupIdx.put(keepObj.getPKey(), keepObj);
        }
      }

      if (indexByUserIdx != null) {
        CFSecurityTSecGroupMemberByUserIdxKey keyUserIdx =
            ((ICFCrmSchema) schema.getBackingStore()).getFactoryTSecGroupMember().newUserIdxKey();
        keyUserIdx.setRequiredSecUserId(keepObj.getRequiredSecUserId());
        Map<CFSecurityTSecGroupMemberPKey, ICFSecurityTSecGroupMemberObj> mapUserIdx =
            indexByUserIdx.get(keyUserIdx);
        if (mapUserIdx != null) {
          mapUserIdx.put(keepObj.getPKey(), keepObj);
        }
      }

      if (indexByUUserIdx != null) {
        CFSecurityTSecGroupMemberByUUserIdxKey keyUUserIdx =
            ((ICFCrmSchema) schema.getBackingStore()).getFactoryTSecGroupMember().newUUserIdxKey();
        keyUUserIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        keyUUserIdx.setRequiredTSecGroupId(keepObj.getRequiredTSecGroupId());
        keyUUserIdx.setRequiredSecUserId(keepObj.getRequiredSecUserId());
        indexByUUserIdx.put(keyUUserIdx, keepObj);
      }
      if (allTSecGroupMember != null) {
        allTSecGroupMember.put(keepObj.getPKey(), keepObj);
      }
    } else {
      keepObj = obj;
      keepObj.setIsNew(false);
      // Attach new object to PKey, all, alternate, and duplicate indexes
      members.put(keepObj.getPKey(), keepObj);
      if (allTSecGroupMember != null) {
        allTSecGroupMember.put(keepObj.getPKey(), keepObj);
      }

      if (indexByTenantIdx != null) {
        CFSecurityTSecGroupMemberByTenantIdxKey keyTenantIdx =
            ((ICFCrmSchema) schema.getBackingStore()).getFactoryTSecGroupMember().newTenantIdxKey();
        keyTenantIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        Map<CFSecurityTSecGroupMemberPKey, ICFSecurityTSecGroupMemberObj> mapTenantIdx =
            indexByTenantIdx.get(keyTenantIdx);
        if (mapTenantIdx != null) {
          mapTenantIdx.put(keepObj.getPKey(), keepObj);
        }
      }

      if (indexByGroupIdx != null) {
        CFSecurityTSecGroupMemberByGroupIdxKey keyGroupIdx =
            ((ICFCrmSchema) schema.getBackingStore()).getFactoryTSecGroupMember().newGroupIdxKey();
        keyGroupIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        keyGroupIdx.setRequiredTSecGroupId(keepObj.getRequiredTSecGroupId());
        Map<CFSecurityTSecGroupMemberPKey, ICFSecurityTSecGroupMemberObj> mapGroupIdx =
            indexByGroupIdx.get(keyGroupIdx);
        if (mapGroupIdx != null) {
          mapGroupIdx.put(keepObj.getPKey(), keepObj);
        }
      }

      if (indexByUserIdx != null) {
        CFSecurityTSecGroupMemberByUserIdxKey keyUserIdx =
            ((ICFCrmSchema) schema.getBackingStore()).getFactoryTSecGroupMember().newUserIdxKey();
        keyUserIdx.setRequiredSecUserId(keepObj.getRequiredSecUserId());
        Map<CFSecurityTSecGroupMemberPKey, ICFSecurityTSecGroupMemberObj> mapUserIdx =
            indexByUserIdx.get(keyUserIdx);
        if (mapUserIdx != null) {
          mapUserIdx.put(keepObj.getPKey(), keepObj);
        }
      }

      if (indexByUUserIdx != null) {
        CFSecurityTSecGroupMemberByUUserIdxKey keyUUserIdx =
            ((ICFCrmSchema) schema.getBackingStore()).getFactoryTSecGroupMember().newUUserIdxKey();
        keyUUserIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        keyUUserIdx.setRequiredTSecGroupId(keepObj.getRequiredTSecGroupId());
        keyUUserIdx.setRequiredSecUserId(keepObj.getRequiredSecUserId());
        indexByUUserIdx.put(keyUUserIdx, keepObj);
      }
    }
    return (keepObj);
  }
  public int compareTo(Object obj) {
    if (obj == null) {
      return (-1);
    } else if (obj instanceof CFSecurityTSecGroupMemberBuff) {
      CFSecurityTSecGroupMemberBuff rhs = (CFSecurityTSecGroupMemberBuff) obj;
      int retval = super.compareTo(rhs);
      if (retval != 0) {
        return (retval);
      }
      return (0);
    } else if (obj instanceof CFSecurityTSecGroupMemberByTenantIdxKey) {
      CFSecurityTSecGroupMemberByTenantIdxKey rhs = (CFSecurityTSecGroupMemberByTenantIdxKey) obj;

      if (getRequiredTenantId() < rhs.getRequiredTenantId()) {
        return (-1);
      } else if (getRequiredTenantId() > rhs.getRequiredTenantId()) {
        return (1);
      }
      return (0);
    } else if (obj instanceof CFSecurityTSecGroupMemberByGroupIdxKey) {
      CFSecurityTSecGroupMemberByGroupIdxKey rhs = (CFSecurityTSecGroupMemberByGroupIdxKey) obj;

      if (getRequiredTenantId() < rhs.getRequiredTenantId()) {
        return (-1);
      } else if (getRequiredTenantId() > rhs.getRequiredTenantId()) {
        return (1);
      }
      if (getRequiredTSecGroupId() < rhs.getRequiredTSecGroupId()) {
        return (-1);
      } else if (getRequiredTSecGroupId() > rhs.getRequiredTSecGroupId()) {
        return (1);
      }
      return (0);
    } else if (obj instanceof CFSecurityTSecGroupMemberByUserIdxKey) {
      CFSecurityTSecGroupMemberByUserIdxKey rhs = (CFSecurityTSecGroupMemberByUserIdxKey) obj;

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

      if (getRequiredTenantId() < rhs.getRequiredTenantId()) {
        return (-1);
      } else if (getRequiredTenantId() > rhs.getRequiredTenantId()) {
        return (1);
      }
      if (getRequiredTSecGroupId() < rhs.getRequiredTSecGroupId()) {
        return (-1);
      } else if (getRequiredTSecGroupId() > rhs.getRequiredTSecGroupId()) {
        return (1);
      }
      {
        int cmp = getRequiredSecUserId().compareTo(rhs.getRequiredSecUserId());
        if (cmp != 0) {
          return (cmp);
        }
      }
      return (0);
    } else if (obj instanceof CFSecurityTSecGroupMemberHBuff) {
      CFSecurityTSecGroupMemberHBuff rhs = (CFSecurityTSecGroupMemberHBuff) obj;

      int retval = 0;
      {
        long lhsAuditClusterId = getAuditClusterId();
        long rhsAuditClusterId = rhs.getAuditClusterId();
        if (lhsAuditClusterId < rhsAuditClusterId) {
          return (-1);
        } else if (lhsAuditClusterId > rhsAuditClusterId) {
          return (1);
        }
      }
      {
        Calendar lhsAuditStamp = getAuditStamp();
        Calendar rhsAuditStamp = rhs.getAuditStamp();
        if (lhsAuditStamp == null) {
          if (rhsAuditStamp != null) {
            return (-1);
          }
        } else if (rhsAuditStamp == null) {
          return (1);
        } else {
          int cmpstat = lhsAuditStamp.compareTo(rhsAuditStamp);
          if (cmpstat != 0) {
            return (cmpstat);
          }
        }
      }
      {
        short lhsAuditActionId = getAuditActionId();
        short rhsAuditActionId = rhs.getAuditActionId();
        if (lhsAuditActionId < rhsAuditActionId) {
          return (-1);
        } else if (lhsAuditActionId > rhsAuditActionId) {
          return (1);
        }
      }
      {
        int lhsRequiredRevision = getRequiredRevision();
        int rhsRequiredRevision = rhs.getRequiredRevision();
        if (lhsRequiredRevision < rhsRequiredRevision) {
          return (-1);
        } else if (lhsRequiredRevision > rhsRequiredRevision) {
          return (1);
        }
      }
      {
        UUID lhsAuditSessionId = getAuditSessionId();
        UUID rhsAuditSessionId = rhs.getAuditSessionId();
        if (lhsAuditSessionId == null) {
          if (rhsAuditSessionId != null) {
            return (-1);
          }
        } else if (rhsAuditSessionId == null) {
          return (1);
        } else {
          int cmpstat = lhsAuditSessionId.compareTo(rhsAuditSessionId);
          if (cmpstat != 0) {
            return (cmpstat);
          }
        }
      }
      {
        long lhsAuditClusterId = getAuditClusterId();
        long rhsAuditClusterId = rhs.getAuditClusterId();
        if (lhsAuditClusterId < rhsAuditClusterId) {
          return (-1);
        } else if (lhsAuditClusterId > rhsAuditClusterId) {
          return (1);
        }
      }
      {
        Calendar lhsAuditStamp = getAuditStamp();
        Calendar rhsAuditStamp = rhs.getAuditStamp();
        if (lhsAuditStamp == null) {
          if (rhsAuditStamp != null) {
            return (-1);
          }
        } else if (rhsAuditStamp == null) {
          return (1);
        } else {
          int cmpstat = lhsAuditStamp.compareTo(rhsAuditStamp);
          if (cmpstat != 0) {
            return (cmpstat);
          }
        }
      }
      {
        short lhsAuditActionId = getAuditActionId();
        short rhsAuditActionId = rhs.getAuditActionId();
        if (lhsAuditActionId < rhsAuditActionId) {
          return (-1);
        } else if (lhsAuditActionId > rhsAuditActionId) {
          return (1);
        }
      }
      {
        int lhsRequiredRevision = getRequiredRevision();
        int rhsRequiredRevision = rhs.getRequiredRevision();
        if (lhsRequiredRevision < rhsRequiredRevision) {
          return (-1);
        } else if (lhsRequiredRevision > rhsRequiredRevision) {
          return (1);
        }
      }
      {
        UUID lhsAuditSessionId = getAuditSessionId();
        UUID rhsAuditSessionId = rhs.getAuditSessionId();
        if (lhsAuditSessionId == null) {
          if (rhsAuditSessionId != null) {
            return (-1);
          }
        } else if (rhsAuditSessionId == null) {
          return (1);
        } else {
          int cmpstat = lhsAuditSessionId.compareTo(rhsAuditSessionId);
          if (cmpstat != 0) {
            return (cmpstat);
          }
        }
      }
      if (getRequiredTenantId() < rhs.getRequiredTenantId()) {
        return (-1);
      } else if (getRequiredTenantId() > rhs.getRequiredTenantId()) {
        return (1);
      }
      if (getRequiredTSecGroupMemberId() < rhs.getRequiredTSecGroupMemberId()) {
        return (-1);
      } else if (getRequiredTSecGroupMemberId() > rhs.getRequiredTSecGroupMemberId()) {
        return (1);
      }
      if (getRequiredTSecGroupId() < rhs.getRequiredTSecGroupId()) {
        return (-1);
      } else if (getRequiredTSecGroupId() > rhs.getRequiredTSecGroupId()) {
        return (1);
      }
      {
        int cmp = getRequiredSecUserId().compareTo(rhs.getRequiredSecUserId());
        if (cmp != 0) {
          return (cmp);
        }
      }
      return (0);
    } else if (obj instanceof CFSecurityTSecGroupMemberHPKey) {
      CFSecurityTSecGroupMemberHPKey rhs = (CFSecurityTSecGroupMemberHPKey) obj;
      {
        long lhsAuditClusterId = getAuditClusterId();
        long rhsAuditClusterId = rhs.getAuditClusterId();
        if (lhsAuditClusterId < rhsAuditClusterId) {
          return (-1);
        } else if (lhsAuditClusterId > rhsAuditClusterId) {
          return (1);
        }
      }
      {
        Calendar lhsAuditStamp = getAuditStamp();
        Calendar rhsAuditStamp = rhs.getAuditStamp();
        if (lhsAuditStamp == null) {
          if (rhsAuditStamp != null) {
            return (-1);
          }
        } else if (rhsAuditStamp == null) {
          return (1);
        } else {
          int cmpstat = lhsAuditStamp.compareTo(rhsAuditStamp);
          if (cmpstat != 0) {
            return (cmpstat);
          }
        }
      }
      {
        short lhsAuditActionId = getAuditActionId();
        short rhsAuditActionId = rhs.getAuditActionId();
        if (lhsAuditActionId < rhsAuditActionId) {
          return (-1);
        } else if (lhsAuditActionId > rhsAuditActionId) {
          return (1);
        }
      }
      {
        int lhsRequiredRevision = getRequiredRevision();
        int rhsRequiredRevision = rhs.getRequiredRevision();
        if (lhsRequiredRevision < rhsRequiredRevision) {
          return (-1);
        } else if (lhsRequiredRevision > rhsRequiredRevision) {
          return (1);
        }
      }
      {
        UUID lhsAuditSessionId = getAuditSessionId();
        UUID rhsAuditSessionId = rhs.getAuditSessionId();
        if (lhsAuditSessionId == null) {
          if (rhsAuditSessionId != null) {
            return (-1);
          }
        } else if (rhsAuditSessionId == null) {
          return (1);
        } else {
          int cmpstat = lhsAuditSessionId.compareTo(rhsAuditSessionId);
          if (cmpstat != 0) {
            return (cmpstat);
          }
        }
      }
      if (getRequiredTenantId() < rhs.getRequiredTenantId()) {
        return (-1);
      } else if (getRequiredTenantId() > rhs.getRequiredTenantId()) {
        return (1);
      }
      if (getRequiredTSecGroupMemberId() < rhs.getRequiredTSecGroupMemberId()) {
        return (-1);
      } else if (getRequiredTSecGroupMemberId() > rhs.getRequiredTSecGroupMemberId()) {
        return (1);
      }
      return (0);
    } else if (obj instanceof CFSecurityTSecGroupMemberPKey) {
      CFSecurityTSecGroupMemberPKey rhs = (CFSecurityTSecGroupMemberPKey) obj;
      if (getRequiredTenantId() < rhs.getRequiredTenantId()) {
        return (-1);
      } else if (getRequiredTenantId() > rhs.getRequiredTenantId()) {
        return (1);
      }
      if (getRequiredTSecGroupMemberId() < rhs.getRequiredTSecGroupMemberId()) {
        return (-1);
      } else if (getRequiredTSecGroupMemberId() > rhs.getRequiredTSecGroupMemberId()) {
        return (1);
      }
      return (0);
    } else if (obj instanceof CFSecurityHPKey) {
      CFSecurityHPKey rhs = (CFSecurityHPKey) obj;
      {
        int lhsRequiredRevision = getRequiredRevision();
        int rhsRequiredRevision = rhs.getRequiredRevision();
        if (lhsRequiredRevision < rhsRequiredRevision) {
          return (-1);
        } else if (lhsRequiredRevision > rhsRequiredRevision) {
          return (1);
        }
      }
      return (0);
    } else {
      return (super.compareTo(obj));
    }
  }
 public boolean equals(Object obj) {
   if (obj == null) {
     return (false);
   } else if (obj instanceof CFSecurityTSecGroupMemberHBuff) {
     CFSecurityTSecGroupMemberHBuff rhs = (CFSecurityTSecGroupMemberHBuff) obj;
     if (!super.equals(obj)) {
       return (false);
     }
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     if (getRequiredTSecGroupMemberId() != rhs.getRequiredTSecGroupMemberId()) {
       return (false);
     }
     if (getRequiredTSecGroupId() != rhs.getRequiredTSecGroupId()) {
       return (false);
     }
     if (!getRequiredSecUserId().equals(rhs.getRequiredSecUserId())) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFSecurityTSecGroupMemberBuff) {
     CFSecurityTSecGroupMemberBuff rhs = (CFSecurityTSecGroupMemberBuff) obj;
     if (!super.equals(obj)) {
       return (false);
     }
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     if (getRequiredTSecGroupMemberId() != rhs.getRequiredTSecGroupMemberId()) {
       return (false);
     }
     if (getRequiredTSecGroupId() != rhs.getRequiredTSecGroupId()) {
       return (false);
     }
     if (!getRequiredSecUserId().equals(rhs.getRequiredSecUserId())) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFSecurityTSecGroupMemberByTenantIdxKey) {
     CFSecurityTSecGroupMemberByTenantIdxKey rhs = (CFSecurityTSecGroupMemberByTenantIdxKey) obj;
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFSecurityTSecGroupMemberByGroupIdxKey) {
     CFSecurityTSecGroupMemberByGroupIdxKey rhs = (CFSecurityTSecGroupMemberByGroupIdxKey) obj;
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     if (getRequiredTSecGroupId() != rhs.getRequiredTSecGroupId()) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFSecurityTSecGroupMemberByUserIdxKey) {
     CFSecurityTSecGroupMemberByUserIdxKey rhs = (CFSecurityTSecGroupMemberByUserIdxKey) obj;
     if (!getRequiredSecUserId().equals(rhs.getRequiredSecUserId())) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFSecurityTSecGroupMemberByUUserIdxKey) {
     CFSecurityTSecGroupMemberByUUserIdxKey rhs = (CFSecurityTSecGroupMemberByUUserIdxKey) obj;
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     if (getRequiredTSecGroupId() != rhs.getRequiredTSecGroupId()) {
       return (false);
     }
     if (!getRequiredSecUserId().equals(rhs.getRequiredSecUserId())) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFSecurityTSecGroupMemberHPKey) {
     CFSecurityTSecGroupMemberHPKey rhs = (CFSecurityTSecGroupMemberHPKey) obj;
     {
       long lhsClusterId = getAuditClusterId();
       long rhsClusterId = rhs.getAuditClusterId();
       if (lhsClusterId != rhsClusterId) {
         return (false);
       }
     }
     {
       Calendar lhsAuditStamp = getAuditStamp();
       Calendar rhsAuditStamp = rhs.getAuditStamp();
       if (lhsAuditStamp != null) {
         if (rhsAuditStamp != null) {
           if (!lhsAuditStamp.equals(rhsAuditStamp)) {
             return (false);
           }
         } else {
           return (false);
         }
       } else {
         return (false);
       }
     }
     {
       short lhsActionId = getAuditActionId();
       short rhsActionId = rhs.getAuditActionId();
       if (lhsActionId != rhsActionId) {
         return (false);
       }
     }
     {
       int lhsRevision = getRequiredRevision();
       int rhsRevision = rhs.getRequiredRevision();
       if (lhsRevision != rhsRevision) {
         return (false);
       }
     }
     {
       UUID lhsAuditSessionId = getAuditSessionId();
       UUID rhsAuditSessionId = rhs.getAuditSessionId();
       if (lhsAuditSessionId != null) {
         if (rhsAuditSessionId != null) {
           if (!lhsAuditSessionId.equals(rhsAuditSessionId)) {
             return (false);
           }
         } else {
           return (false);
         }
       } else {
         return (false);
       }
     }
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     if (getRequiredTSecGroupMemberId() != rhs.getRequiredTSecGroupMemberId()) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFSecurityHPKey) {
     CFSecurityHPKey rhs = (CFSecurityHPKey) obj;
     {
       long lhsClusterId = getAuditClusterId();
       long rhsClusterId = rhs.getAuditClusterId();
       if (lhsClusterId != rhsClusterId) {
         return (false);
       }
     }
     {
       Calendar lhsAuditStamp = getAuditStamp();
       Calendar rhsAuditStamp = rhs.getAuditStamp();
       if (lhsAuditStamp != null) {
         if (rhsAuditStamp != null) {
           if (!lhsAuditStamp.equals(rhsAuditStamp)) {
             return (false);
           }
         } else {
           return (false);
         }
       } else {
         return (false);
       }
     }
     {
       short lhsActionId = getAuditActionId();
       short rhsActionId = rhs.getAuditActionId();
       if (lhsActionId != rhsActionId) {
         return (false);
       }
     }
     {
       int lhsRevision = getRequiredRevision();
       int rhsRevision = rhs.getRequiredRevision();
       if (lhsRevision != rhsRevision) {
         return (false);
       }
     }
     {
       UUID lhsAuditSessionId = getAuditSessionId();
       UUID rhsAuditSessionId = rhs.getAuditSessionId();
       if (lhsAuditSessionId != null) {
         if (rhsAuditSessionId != null) {
           if (!lhsAuditSessionId.equals(rhsAuditSessionId)) {
             return (false);
           }
         } else {
           return (false);
         }
       } else {
         return (false);
       }
     }
     return (true);
   } else if (obj instanceof CFSecurityTSecGroupMemberPKey) {
     CFSecurityTSecGroupMemberPKey rhs = (CFSecurityTSecGroupMemberPKey) obj;
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     if (getRequiredTSecGroupMemberId() != rhs.getRequiredTSecGroupMemberId()) {
       return (false);
     }
     return (true);
   } else {
     return (super.equals(obj));
   }
 }