public boolean equals(Object obj) {
   if (obj == null) {
     return (false);
   } else if (obj instanceof CFSecurityTenantByUNameIdxKey) {
     CFSecurityTenantByUNameIdxKey rhs = (CFSecurityTenantByUNameIdxKey) obj;
     if (getRequiredClusterId() != rhs.getRequiredClusterId()) {
       return (false);
     }
     if (!getRequiredTenantName().equals(rhs.getRequiredTenantName())) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFSecurityTenantBuff) {
     CFSecurityTenantBuff rhs = (CFSecurityTenantBuff) obj;
     if (getRequiredClusterId() != rhs.getRequiredClusterId()) {
       return (false);
     }
     if (!getRequiredTenantName().equals(rhs.getRequiredTenantName())) {
       return (false);
     }
     return (true);
   } else {
     return (false);
   }
 }
 public ICFSecurityTenantObj readTenantByUNameIdx(
     long ClusterId, String TenantName, boolean forceRead) {
   if (indexByUNameIdx == null) {
     indexByUNameIdx = new HashMap<CFSecurityTenantByUNameIdxKey, ICFSecurityTenantObj>();
   }
   CFSecurityTenantByUNameIdxKey key =
       ((ICFSecuritySchema) schema.getBackingStore()).getFactoryTenant().newUNameIdxKey();
   key.setRequiredClusterId(ClusterId);
   key.setRequiredTenantName(TenantName);
   ICFSecurityTenantObj obj = null;
   if ((!forceRead) && indexByUNameIdx.containsKey(key)) {
     obj = indexByUNameIdx.get(key);
   } else {
     CFSecurityTenantBuff buff =
         ((ICFSecuritySchema) schema.getBackingStore())
             .getTableTenant()
             .readDerivedByUNameIdx(schema.getAuthorization(), ClusterId, TenantName);
     if (buff != null) {
       obj = schema.getTenantTableObj().newInstance();
       obj.setPKey(((ICFSecuritySchema) schema.getBackingStore()).getFactoryTenant().newPKey());
       obj.setBuff(buff);
       obj = (ICFSecurityTenantObj) obj.realize();
     } else if (schema.getCacheMisses()) {
       indexByUNameIdx.put(key, null);
     }
   }
   return (obj);
 }
  public void forgetTenantByUNameIdx(long ClusterId, String TenantName) {
    if (indexByUNameIdx == null) {
      return;
    }
    CFSecurityTenantByUNameIdxKey key =
        ((ICFSecuritySchema) schema.getBackingStore()).getFactoryTenant().newUNameIdxKey();
    key.setRequiredClusterId(ClusterId);
    key.setRequiredTenantName(TenantName);
    if (indexByUNameIdx.containsKey(key)) {
      ICFSecurityTenantObj probed = indexByUNameIdx.get(key);
      if (probed != null) {
        probed.forget(true);
      }

      indexByUNameIdx.remove(key);
    }
  }
 public void deleteTenantByUNameIdx(long ClusterId, String TenantName) {
   if (indexByUNameIdx == null) {
     indexByUNameIdx = new HashMap<CFSecurityTenantByUNameIdxKey, ICFSecurityTenantObj>();
   }
   CFSecurityTenantByUNameIdxKey key =
       ((ICFSecuritySchema) schema.getBackingStore()).getFactoryTenant().newUNameIdxKey();
   key.setRequiredClusterId(ClusterId);
   key.setRequiredTenantName(TenantName);
   ICFSecurityTenantObj obj = null;
   if (indexByUNameIdx.containsKey(key)) {
     obj = indexByUNameIdx.get(key);
     ((ICFSecuritySchema) schema.getBackingStore())
         .getTableTenant()
         .deleteTenantByUNameIdx(schema.getAuthorization(), ClusterId, TenantName);
     obj.forget(true);
   } else {
     ((ICFSecuritySchema) schema.getBackingStore())
         .getTableTenant()
         .deleteTenantByUNameIdx(schema.getAuthorization(), ClusterId, TenantName);
   }
 }
  public void forgetTenant(ICFSecurityTenantObj Obj, boolean forgetSubObjects) {
    ICFSecurityTenantObj obj = Obj;
    CFSecurityTenantPKey pkey = obj.getPKey();
    if (members.containsKey(pkey)) {
      ICFSecurityTenantObj keepObj = members.get(pkey);
      // Detach object from alternate, duplicate, all and PKey indexes

      if (indexByClusterIdx != null) {
        CFSecurityTenantByClusterIdxKey keyClusterIdx =
            ((ICFSecuritySchema) schema.getBackingStore()).getFactoryTenant().newClusterIdxKey();
        keyClusterIdx.setRequiredClusterId(keepObj.getRequiredClusterId());
        Map<CFSecurityTenantPKey, ICFSecurityTenantObj> mapClusterIdx =
            indexByClusterIdx.get(keyClusterIdx);
        if (mapClusterIdx != null) {
          mapClusterIdx.remove(keepObj.getPKey());
        }
      }

      if (indexByUNameIdx != null) {
        CFSecurityTenantByUNameIdxKey keyUNameIdx =
            ((ICFSecuritySchema) schema.getBackingStore()).getFactoryTenant().newUNameIdxKey();
        keyUNameIdx.setRequiredClusterId(keepObj.getRequiredClusterId());
        keyUNameIdx.setRequiredTenantName(keepObj.getRequiredTenantName());
        indexByUNameIdx.remove(keyUNameIdx);
      }

      if (allTenant != null) {
        allTenant.remove(keepObj.getPKey());
      }
      members.remove(pkey);
      if (forgetSubObjects) {
        ((ICFSecuritySchemaObj) schema)
            .getTSecGroupTableObj()
            .forgetTSecGroupByTenantIdx(keepObj.getRequiredId());
      }
    }
  }
 public int compareTo(Object obj) {
   if (obj == null) {
     return (1);
   } else if (obj instanceof CFSecurityTenantByUNameIdxKey) {
     CFSecurityTenantByUNameIdxKey rhs = (CFSecurityTenantByUNameIdxKey) obj;
     if (getRequiredClusterId() < rhs.getRequiredClusterId()) {
       return (-1);
     } else if (getRequiredClusterId() > rhs.getRequiredClusterId()) {
       return (1);
     }
     {
       int cmp = getRequiredTenantName().compareTo(rhs.getRequiredTenantName());
       if (cmp != 0) {
         return (cmp);
       }
     }
     return (0);
   } else if (obj instanceof CFSecurityTenantBuff) {
     CFSecurityTenantBuff rhs = (CFSecurityTenantBuff) obj;
     if (getRequiredClusterId() < rhs.getRequiredClusterId()) {
       return (-1);
     } else if (getRequiredClusterId() > rhs.getRequiredClusterId()) {
       return (1);
     }
     {
       int cmp = getRequiredTenantName().compareTo(rhs.getRequiredTenantName());
       if (cmp != 0) {
         return (cmp);
       }
     }
     return (0);
   } else {
     throw CFLib.getDefaultExceptionFactory()
         .newUnsupportedClassException(getClass(), "compareTo", "obj", obj, null);
   }
 }
 public void deleteTenantByUNameIdx(
     CFSecurityAuthorization Authorization, CFSecurityTenantByUNameIdxKey argKey) {
   deleteTenantByUNameIdx(
       Authorization, argKey.getRequiredClusterId(), argKey.getRequiredTenantName());
 }
  public ICFSecurityTenantObj realizeTenant(ICFSecurityTenantObj Obj) {
    ICFSecurityTenantObj obj = Obj;
    CFSecurityTenantPKey pkey = obj.getPKey();
    ICFSecurityTenantObj keepObj = null;
    if (members.containsKey(pkey) && (null != members.get(pkey))) {
      ICFSecurityTenantObj 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 (indexByClusterIdx != null) {
        CFSecurityTenantByClusterIdxKey keyClusterIdx =
            ((ICFSecuritySchema) schema.getBackingStore()).getFactoryTenant().newClusterIdxKey();
        keyClusterIdx.setRequiredClusterId(keepObj.getRequiredClusterId());
        Map<CFSecurityTenantPKey, ICFSecurityTenantObj> mapClusterIdx =
            indexByClusterIdx.get(keyClusterIdx);
        if (mapClusterIdx != null) {
          mapClusterIdx.remove(keepObj.getPKey());
        }
      }

      if (indexByUNameIdx != null) {
        CFSecurityTenantByUNameIdxKey keyUNameIdx =
            ((ICFSecuritySchema) schema.getBackingStore()).getFactoryTenant().newUNameIdxKey();
        keyUNameIdx.setRequiredClusterId(keepObj.getRequiredClusterId());
        keyUNameIdx.setRequiredTenantName(keepObj.getRequiredTenantName());
        indexByUNameIdx.remove(keyUNameIdx);
      }

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

      if (indexByClusterIdx != null) {
        CFSecurityTenantByClusterIdxKey keyClusterIdx =
            ((ICFSecuritySchema) schema.getBackingStore()).getFactoryTenant().newClusterIdxKey();
        keyClusterIdx.setRequiredClusterId(keepObj.getRequiredClusterId());
        Map<CFSecurityTenantPKey, ICFSecurityTenantObj> mapClusterIdx =
            indexByClusterIdx.get(keyClusterIdx);
        if (mapClusterIdx != null) {
          mapClusterIdx.put(keepObj.getPKey(), keepObj);
        }
      }

      if (indexByUNameIdx != null) {
        CFSecurityTenantByUNameIdxKey keyUNameIdx =
            ((ICFSecuritySchema) schema.getBackingStore()).getFactoryTenant().newUNameIdxKey();
        keyUNameIdx.setRequiredClusterId(keepObj.getRequiredClusterId());
        keyUNameIdx.setRequiredTenantName(keepObj.getRequiredTenantName());
        indexByUNameIdx.put(keyUNameIdx, keepObj);
      }
      if (allTenant != null) {
        allTenant.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 (allTenant != null) {
        allTenant.put(keepObj.getPKey(), keepObj);
      }

      if (indexByClusterIdx != null) {
        CFSecurityTenantByClusterIdxKey keyClusterIdx =
            ((ICFSecuritySchema) schema.getBackingStore()).getFactoryTenant().newClusterIdxKey();
        keyClusterIdx.setRequiredClusterId(keepObj.getRequiredClusterId());
        Map<CFSecurityTenantPKey, ICFSecurityTenantObj> mapClusterIdx =
            indexByClusterIdx.get(keyClusterIdx);
        if (mapClusterIdx != null) {
          mapClusterIdx.put(keepObj.getPKey(), keepObj);
        }
      }

      if (indexByUNameIdx != null) {
        CFSecurityTenantByUNameIdxKey keyUNameIdx =
            ((ICFSecuritySchema) schema.getBackingStore()).getFactoryTenant().newUNameIdxKey();
        keyUNameIdx.setRequiredClusterId(keepObj.getRequiredClusterId());
        keyUNameIdx.setRequiredTenantName(keepObj.getRequiredTenantName());
        indexByUNameIdx.put(keyUNameIdx, keepObj);
      }
    }
    return (keepObj);
  }
  public int compareTo(Object obj) {
    if (obj == null) {
      return (-1);
    } else if (obj instanceof CFSecurityTenantBuff) {
      CFSecurityTenantBuff rhs = (CFSecurityTenantBuff) 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 (getRequiredClusterId() < rhs.getRequiredClusterId()) {
        return (-1);
      } else if (getRequiredClusterId() > rhs.getRequiredClusterId()) {
        return (1);
      }
      if (getRequiredId() < rhs.getRequiredId()) {
        return (-1);
      } else if (getRequiredId() > rhs.getRequiredId()) {
        return (1);
      }
      {
        int cmp = getRequiredTenantName().compareTo(rhs.getRequiredTenantName());
        if (cmp != 0) {
          return (cmp);
        }
      }
      return (0);
    } else if (obj instanceof CFSecurityTenantPKey) {
      CFSecurityTenantPKey rhs = (CFSecurityTenantPKey) obj;
      if (getRequiredId() < rhs.getRequiredId()) {
        return (-1);
      } else if (getRequiredId() > rhs.getRequiredId()) {
        return (1);
      }
      return (0);
    } else if (obj instanceof CFSecurityTenantHPKey) {
      CFSecurityTenantHPKey rhs = (CFSecurityTenantHPKey) 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 CFSecurityTenantHBuff) {
      CFSecurityTenantHBuff rhs = (CFSecurityTenantHBuff) obj;
      int retval = 0;
      if (getRequiredClusterId() < rhs.getRequiredClusterId()) {
        return (-1);
      } else if (getRequiredClusterId() > rhs.getRequiredClusterId()) {
        return (1);
      }
      if (getRequiredId() < rhs.getRequiredId()) {
        return (-1);
      } else if (getRequiredId() > rhs.getRequiredId()) {
        return (1);
      }
      {
        int cmp = getRequiredTenantName().compareTo(rhs.getRequiredTenantName());
        if (cmp != 0) {
          return (cmp);
        }
      }
      return (0);
    } else if (obj instanceof CFSecurityTenantByClusterIdxKey) {
      CFSecurityTenantByClusterIdxKey rhs = (CFSecurityTenantByClusterIdxKey) obj;

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

      if (getRequiredClusterId() < rhs.getRequiredClusterId()) {
        return (-1);
      } else if (getRequiredClusterId() > rhs.getRequiredClusterId()) {
        return (1);
      }
      {
        int cmp = getRequiredTenantName().compareTo(rhs.getRequiredTenantName());
        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 CFSecurityTenantBuff) {
     CFSecurityTenantBuff rhs = (CFSecurityTenantBuff) 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 (getRequiredClusterId() != rhs.getRequiredClusterId()) {
       return (false);
     }
     if (getRequiredId() != rhs.getRequiredId()) {
       return (false);
     }
     if (!getRequiredTenantName().equals(rhs.getRequiredTenantName())) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFSecurityTenantPKey) {
     CFSecurityTenantPKey rhs = (CFSecurityTenantPKey) obj;
     if (getRequiredId() != rhs.getRequiredId()) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFSecurityTenantHBuff) {
     CFSecurityTenantHBuff rhs = (CFSecurityTenantHBuff) obj;
     if (getRequiredClusterId() != rhs.getRequiredClusterId()) {
       return (false);
     }
     if (getRequiredId() != rhs.getRequiredId()) {
       return (false);
     }
     if (!getRequiredTenantName().equals(rhs.getRequiredTenantName())) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFSecurityTenantHPKey) {
     CFSecurityTenantHPKey rhs = (CFSecurityTenantHPKey) obj;
     if (getRequiredId() != rhs.getRequiredId()) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFSecurityTenantByClusterIdxKey) {
     CFSecurityTenantByClusterIdxKey rhs = (CFSecurityTenantByClusterIdxKey) obj;
     if (getRequiredClusterId() != rhs.getRequiredClusterId()) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFSecurityTenantByUNameIdxKey) {
     CFSecurityTenantByUNameIdxKey rhs = (CFSecurityTenantByUNameIdxKey) obj;
     if (getRequiredClusterId() != rhs.getRequiredClusterId()) {
       return (false);
     }
     if (!getRequiredTenantName().equals(rhs.getRequiredTenantName())) {
       return (false);
     }
     return (true);
   } else {
     boolean retval = super.equals(obj);
     return (retval);
   }
 }