public CFSecurityClusterBuff readDerivedByIdIdx(CFSecurityAuthorization Authorization, long Id) {
    final String S_ProcName = "CFDbTestRamCluster.readDerivedByIdIdx() ";
    CFSecurityClusterPKey key = schema.getFactoryCluster().newPKey();
    key.setRequiredId(Id);

    CFSecurityClusterBuff buff;
    if (dictByPKey.containsKey(key)) {
      buff = dictByPKey.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 deleteClusterByIdIdx(
     CFSecurityAuthorization Authorization, CFSecurityClusterPKey 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 int nextSecFormIdGen(CFSecurityAuthorization Authorization, CFSecurityClusterPKey pkey) {
   int retval = nextSecFormIdGen(Authorization, pkey.getRequiredId());
   return (retval);
 }
 public void deleteClusterByIdIdx(CFSecurityAuthorization Authorization, long argId) {
   CFSecurityClusterPKey key = schema.getFactoryCluster().newPKey();
   key.setRequiredId(argId);
   deleteClusterByIdIdx(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 long nextHostNodeIdGen(CFSecurityAuthorization Authorization, CFSecurityClusterPKey pkey) {
   long retval = nextHostNodeIdGen(Authorization, pkey.getRequiredId());
   return (retval);
 }
  public void startElement(String uri, String localName, String qName, Attributes attrs)
      throws SAXException {
    CFBamXMsgSchemaMessageFormatter schemaFormatter = null;
    try {
      // Common XML Attributes
      String attrId = null;
      // Primary Key Attributes for Constant Enum support
      // Attribute Extraction
      String attrLocalName;
      int numAttrs;
      int idxAttr;
      final String S_ProcName = "startElement";
      final String S_LocalName = "LocalName";

      assert qName.equals("RqstClusterLock");

      CFBamXMsgRqstHandler xmsgRqstHandler = (CFBamXMsgRqstHandler) getParser();
      if (xmsgRqstHandler == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "getParser()");
      }

      schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();

      ICFBamSchemaObj schemaObj = xmsgRqstHandler.getSchemaObj();
      if (schemaObj == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "getParser().getSchemaObj()");
      }

      // Instantiate a PKey buffer for the parsed information
      CFSecurityClusterPKey pkey =
          ((ICFBamSchema) schemaObj.getBackingStore()).getFactoryCluster().newPKey();

      // Extract Attributes
      numAttrs = attrs.getLength();
      for (idxAttr = 0; idxAttr < numAttrs; idxAttr++) {
        attrLocalName = attrs.getLocalName(idxAttr);
        if (attrLocalName.equals("Id")) {
          if (attrId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrId = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("schemaLocation")) {
          // ignored
        } else {
          throw CFLib.getDefaultExceptionFactory()
              .newUnrecognizedAttributeException(
                  getClass(), S_ProcName, getParser().getLocationInfo(), attrLocalName);
        }
      }

      // Ensure that required attributes have values
      if ((attrId == null) || (attrId.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "Id");
      }

      // Get current context
      CFLibXmlCoreContext curContext = getParser().getCurContext();
      // Convert string attributes to native Java types
      // and apply the converted attributes to the editBuff.

      long natId;
      natId = Long.parseLong(attrId);
      pkey.setRequiredId(natId);

      pkey.setRequiredId(natId);
      // Lock the object
      ICFBamClusterObj locked =
          ((ICFBamClusterObj) schemaObj.getClusterTableObj().lockCluster(pkey));
      String response =
          schemaFormatter.formatRspnXmlPreamble()
              + "\n"
              + "\t"
              + CFBamXMsgClusterMessageFormatter.formatClusterRspnLocked(
                  "\n\t\t\t", locked.getClusterBuff())
              + "\n"
              + schemaFormatter.formatRspnXmlPostamble();
      ((CFBamXMsgRqstHandler) getParser()).appendResponse(response);
    } catch (RuntimeException e) {
      CFBamXMsgRqstHandler xmsgRqstHandler = ((CFBamXMsgRqstHandler) getParser());
      schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();
      String response =
          schemaFormatter.formatRspnXmlPreamble()
              + "\n"
              + "\t"
              + CFBamXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e)
              + "\n"
              + schemaFormatter.formatRspnXmlPostamble();
      xmsgRqstHandler.resetResponse();
      xmsgRqstHandler.appendResponse(response);
      xmsgRqstHandler.setCaughtException(true);
    } catch (Error e) {
      CFBamXMsgRqstHandler xmsgRqstHandler = ((CFBamXMsgRqstHandler) getParser());
      schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();
      String response =
          schemaFormatter.formatRspnXmlPreamble()
              + "\n"
              + "\t"
              + CFBamXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e)
              + "\n"
              + schemaFormatter.formatRspnXmlPostamble();
      xmsgRqstHandler.resetResponse();
      xmsgRqstHandler.appendResponse(response);
      xmsgRqstHandler.setCaughtException(true);
    }
  }
 public void deleteClusterByIdIdx(
     CFSecurityAuthorization Authorization, CFSecurityClusterPKey argKey) {
   deleteClusterByIdIdx(Authorization, argKey.getRequiredId());
 }