public void deleteDelSubDep3ByIdIdx(
     CFBamAuthorization Authorization, long argTenantId, long argId) {
   CFBamScopePKey key = schema.getFactoryScope().newPKey();
   key.setRequiredTenantId(argTenantId);
   key.setRequiredId(argId);
   deleteDelSubDep3ByIdIdx(Authorization, key);
 }
 public void deleteClearTopDepByIdIdx(long TenantId, long Id) {
   CFBamScopePKey pkey = schema.getBackingStore().getFactoryScope().newPKey();
   pkey.setRequiredTenantId(TenantId);
   pkey.setRequiredId(Id);
   ICFBamScopeObj obj = readClearTopDep(pkey);
   if (obj != null) {
     ICFBamClearTopDepEditObj editObj = (ICFBamClearTopDepEditObj) obj.getEdit();
     boolean editStarted;
     if (editObj == null) {
       editObj = (ICFBamClearTopDepEditObj) obj.beginEdit();
       if (editObj != null) {
         editStarted = true;
       } else {
         editStarted = false;
       }
     } else {
       editStarted = false;
     }
     if (editObj != null) {
       editObj.delete();
       if (editStarted) {
         editObj.endEdit();
       }
     }
     obj.forget(true);
   }
 }
 public ICFBamClearTopDepObj readClearTopDepByIdIdx(long TenantId, long Id, boolean forceRead) {
   CFBamScopePKey pkey = schema.getBackingStore().getFactoryScope().newPKey();
   pkey.setRequiredTenantId(TenantId);
   pkey.setRequiredId(Id);
   ICFBamClearTopDepObj obj = readClearTopDep(pkey, forceRead);
   return (obj);
 }
 public CFBamDelSubDep3Buff lockDerived(CFBamAuthorization Authorization, CFBamScopePKey PKey) {
   final String S_ProcName = "CFBamRamDelSubDep3.readDerived() ";
   CFBamScopePKey key = schema.getFactoryScope().newPKey();
   key.setRequiredTenantId(PKey.getRequiredTenantId());
   key.setRequiredId(PKey.getRequiredId());
   CFBamDelSubDep3Buff buff;
   if (dictByPKey.containsKey(key)) {
     buff = dictByPKey.get(key);
   } else {
     buff = null;
   }
   return (buff);
 }
 public void forgetClearTopDepByIdIdx(long TenantId, long Id) {
   if (members == null) {
     return;
   }
   CFBamScopePKey key = schema.getBackingStore().getFactoryScope().newPKey();
   key.setRequiredTenantId(TenantId);
   key.setRequiredId(Id);
   if (members.containsKey(key)) {
     ICFBamClearTopDepObj probed = members.get(key);
     if (probed != null) {
       probed.forget(true);
     }
   }
 }
 public boolean equals(Object obj) {
   if (obj == null) {
     return (false);
   } else if (obj instanceof CFBamScopeHPKey) {
     CFBamScopeHPKey rhs = (CFBamScopeHPKey) obj;
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     if (getRequiredId() != rhs.getRequiredId()) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFBamScopePKey) {
     CFBamScopePKey rhs = (CFBamScopePKey) obj;
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     if (getRequiredId() != rhs.getRequiredId()) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFBamScopeHBuff) {
     CFBamScopeHBuff rhs = (CFBamScopeHBuff) obj;
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     if (getRequiredId() != rhs.getRequiredId()) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFBamScopeBuff) {
     CFBamScopeBuff rhs = (CFBamScopeBuff) obj;
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     if (getRequiredId() != rhs.getRequiredId()) {
       return (false);
     }
     return (true);
   } else {
     return (false);
   }
 }
  public void deleteDelSubDep3(CFBamAuthorization Authorization, CFBamDelSubDep3Buff Buff) {
    final String S_ProcName = "CFBamRamDelSubDep3Table.deleteDelSubDep3() ";
    CFBamScopePKey pkey = schema.getFactoryScope().newPKey();
    pkey.setRequiredTenantId(Buff.getRequiredTenantId());
    pkey.setRequiredId(Buff.getRequiredId());
    CFBamDelSubDep3Buff existing = dictByPKey.get(pkey);
    if (existing == null) {
      return;
    }
    if (existing.getRequiredRevision() != Buff.getRequiredRevision()) {
      throw CFLib.getDefaultExceptionFactory()
          .newCollisionDetectedException(getClass(), "deleteDelSubDep3", pkey);
    }
    CFBamDelSubDep3ByContDelDep2IdxKey keyContDelDep2Idx =
        schema.getFactoryDelSubDep3().newContDelDep2IdxKey();
    keyContDelDep2Idx.setRequiredContTenantId(existing.getRequiredContTenantId());
    keyContDelDep2Idx.setRequiredContDelDep2Id(existing.getRequiredContDelDep2Id());

    CFBamDelSubDep3ByUNameIdxKey keyUNameIdx = schema.getFactoryDelSubDep3().newUNameIdxKey();
    keyUNameIdx.setRequiredContTenantId(existing.getRequiredContTenantId());
    keyUNameIdx.setRequiredContDelDep2Id(existing.getRequiredContDelDep2Id());
    keyUNameIdx.setRequiredName(existing.getRequiredName());

    // Validate reverse foreign keys

    // Delete is valid

    Map<CFBamScopePKey, CFBamDelSubDep3Buff> subdict;

    dictByPKey.remove(pkey);

    subdict = dictByContDelDep2Idx.get(keyContDelDep2Idx);
    subdict.remove(pkey);

    dictByUNameIdx.remove(keyUNameIdx);

    schema.getTableDelDep().deleteDelDep(Authorization, Buff);
  }
 public ICFBamClearTopDepObj readClearTopDep(CFBamScopePKey pkey, boolean forceRead) {
   ICFBamClearTopDepObj obj = null;
   if ((!forceRead) && members.containsKey(pkey)) {
     obj = members.get(pkey);
   } else {
     CFBamClearTopDepBuff readBuff =
         schema
             .getBackingStore()
             .getTableClearTopDep()
             .readDerivedByIdIdx(
                 schema.getAuthorization(), pkey.getRequiredTenantId(), pkey.getRequiredId());
     if (readBuff != null) {
       obj =
           (ICFBamClearTopDepObj)
               schema.getScopeTableObj().constructByClassCode(readBuff.getClassCode());
       obj.setPKey(schema.getBackingStore().getFactoryScope().newPKey());
       obj.setBuff(readBuff);
       obj = (ICFBamClearTopDepObj) obj.realize();
     } else if (schema.getCacheMisses()) {
       members.put(pkey, null);
     }
   }
   return (obj);
 }
 public void deleteDelSubDep3ByIdIdx(CFBamAuthorization Authorization, CFBamScopePKey argKey) {
   CFBamDelSubDep3Buff cur;
   LinkedList<CFBamDelSubDep3Buff> matchSet = new LinkedList<CFBamDelSubDep3Buff>();
   Iterator<CFBamDelSubDep3Buff> values = dictByPKey.values().iterator();
   while (values.hasNext()) {
     cur = values.next();
     if (argKey.equals(cur)) {
       matchSet.add(cur);
     }
   }
   Iterator<CFBamDelSubDep3Buff> iterMatch = matchSet.iterator();
   while (iterMatch.hasNext()) {
     cur = iterMatch.next();
     deleteDelSubDep3(Authorization, cur);
   }
 }
  public int compareTo(Object obj) {
    if (obj == null) {
      return (-1);
    } else if (obj instanceof CFBamPopSubDep1Buff) {
      CFBamPopSubDep1Buff rhs = (CFBamPopSubDep1Buff) obj;
      int retval = super.compareTo(rhs);
      if (retval != 0) {
        return (retval);
      }
      if (getRequiredContTenantId() < rhs.getRequiredContTenantId()) {
        return (-1);
      } else if (getRequiredContTenantId() > rhs.getRequiredContTenantId()) {
        return (1);
      }
      if (getRequiredContPopTopDepId() < rhs.getRequiredContPopTopDepId()) {
        return (-1);
      } else if (getRequiredContPopTopDepId() > rhs.getRequiredContPopTopDepId()) {
        return (1);
      }
      {
        int cmp = getRequiredName().compareTo(rhs.getRequiredName());
        if (cmp != 0) {
          return (cmp);
        }
      }
      return (0);
    } else if (obj instanceof CFBamScopePKey) {
      CFBamScopePKey rhs = (CFBamScopePKey) obj;
      if (getRequiredTenantId() < rhs.getRequiredTenantId()) {
        return (-1);
      } else if (getRequiredTenantId() > rhs.getRequiredTenantId()) {
        return (1);
      }
      if (getRequiredId() < rhs.getRequiredId()) {
        return (-1);
      } else if (getRequiredId() > rhs.getRequiredId()) {
        return (1);
      }
      return (0);
    } else if (obj instanceof CFBamScopeHPKey) {
      CFBamScopeHPKey rhs = (CFBamScopeHPKey) obj;
      {
        int lhsRequiredRevision = getRequiredRevision();
        int rhsRequiredRevision = rhs.getRequiredRevision();
        if (lhsRequiredRevision < rhsRequiredRevision) {
          return (-1);
        } else if (lhsRequiredRevision > rhsRequiredRevision) {
          return (1);
        }
      }
      if (getRequiredTenantId() < rhs.getRequiredTenantId()) {
        return (-1);
      } else if (getRequiredTenantId() > rhs.getRequiredTenantId()) {
        return (1);
      }
      if (getRequiredId() < rhs.getRequiredId()) {
        return (-1);
      } else if (getRequiredId() > rhs.getRequiredId()) {
        return (1);
      }
      return (0);
    } else if (obj instanceof CFBamPopSubDep1HBuff) {
      CFBamPopSubDep1HBuff rhs = (CFBamPopSubDep1HBuff) obj;
      int retval = super.compareTo(rhs);
      if (retval != 0) {
        return (retval);
      }
      if (getRequiredContTenantId() < rhs.getRequiredContTenantId()) {
        return (-1);
      } else if (getRequiredContTenantId() > rhs.getRequiredContTenantId()) {
        return (1);
      }
      if (getRequiredContPopTopDepId() < rhs.getRequiredContPopTopDepId()) {
        return (-1);
      } else if (getRequiredContPopTopDepId() > rhs.getRequiredContPopTopDepId()) {
        return (1);
      }
      {
        int cmp = getRequiredName().compareTo(rhs.getRequiredName());
        if (cmp != 0) {
          return (cmp);
        }
      }
      return (0);
    } else if (obj instanceof CFBamPopSubDep1ByContPopTopIdxKey) {
      CFBamPopSubDep1ByContPopTopIdxKey rhs = (CFBamPopSubDep1ByContPopTopIdxKey) obj;

      if (getRequiredContTenantId() < rhs.getRequiredContTenantId()) {
        return (-1);
      } else if (getRequiredContTenantId() > rhs.getRequiredContTenantId()) {
        return (1);
      }
      if (getRequiredContPopTopDepId() < rhs.getRequiredContPopTopDepId()) {
        return (-1);
      } else if (getRequiredContPopTopDepId() > rhs.getRequiredContPopTopDepId()) {
        return (1);
      }
      return (0);
    } else if (obj instanceof CFBamPopSubDep1ByUNameIdxKey) {
      CFBamPopSubDep1ByUNameIdxKey rhs = (CFBamPopSubDep1ByUNameIdxKey) obj;

      if (getRequiredContTenantId() < rhs.getRequiredContTenantId()) {
        return (-1);
      } else if (getRequiredContTenantId() > rhs.getRequiredContTenantId()) {
        return (1);
      }
      if (getRequiredContPopTopDepId() < rhs.getRequiredContPopTopDepId()) {
        return (-1);
      } else if (getRequiredContPopTopDepId() > rhs.getRequiredContPopTopDepId()) {
        return (1);
      }
      {
        int cmp = getRequiredName().compareTo(rhs.getRequiredName());
        if (cmp != 0) {
          return (cmp);
        }
      }
      return (0);
    } else {
      int retval = super.compareTo(obj);
      return (retval);
    }
  }
 public boolean equals(Object obj) {
   if (obj == null) {
     return (false);
   } else if (obj instanceof CFBamPopSubDep1Buff) {
     CFBamPopSubDep1Buff rhs = (CFBamPopSubDep1Buff) obj;
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     if (getRequiredId() != rhs.getRequiredId()) {
       return (false);
     }
     if (getRequiredContTenantId() != rhs.getRequiredContTenantId()) {
       return (false);
     }
     if (getRequiredContPopTopDepId() != rhs.getRequiredContPopTopDepId()) {
       return (false);
     }
     if (!getRequiredName().equals(rhs.getRequiredName())) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFBamScopePKey) {
     CFBamScopePKey rhs = (CFBamScopePKey) obj;
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     if (getRequiredId() != rhs.getRequiredId()) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFBamPopSubDep1HBuff) {
     CFBamPopSubDep1HBuff rhs = (CFBamPopSubDep1HBuff) obj;
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     if (getRequiredId() != rhs.getRequiredId()) {
       return (false);
     }
     if (getRequiredContTenantId() != rhs.getRequiredContTenantId()) {
       return (false);
     }
     if (getRequiredContPopTopDepId() != rhs.getRequiredContPopTopDepId()) {
       return (false);
     }
     if (!getRequiredName().equals(rhs.getRequiredName())) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFBamScopeHPKey) {
     CFBamScopeHPKey rhs = (CFBamScopeHPKey) obj;
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     if (getRequiredId() != rhs.getRequiredId()) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFBamPopSubDep1ByContPopTopIdxKey) {
     CFBamPopSubDep1ByContPopTopIdxKey rhs = (CFBamPopSubDep1ByContPopTopIdxKey) obj;
     if (getRequiredContTenantId() != rhs.getRequiredContTenantId()) {
       return (false);
     }
     if (getRequiredContPopTopDepId() != rhs.getRequiredContPopTopDepId()) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFBamPopSubDep1ByUNameIdxKey) {
     CFBamPopSubDep1ByUNameIdxKey rhs = (CFBamPopSubDep1ByUNameIdxKey) obj;
     if (getRequiredContTenantId() != rhs.getRequiredContTenantId()) {
       return (false);
     }
     if (getRequiredContPopTopDepId() != rhs.getRequiredContPopTopDepId()) {
       return (false);
     }
     if (!getRequiredName().equals(rhs.getRequiredName())) {
       return (false);
     }
     return (true);
   } else {
     boolean retval = super.equals(obj);
     return (retval);
   }
 }
  public void createDelSubDep3(CFBamAuthorization Authorization, CFBamDelSubDep3Buff Buff) {
    final String S_ProcName = "createDelSubDep3";
    schema.getTableDelDep().createDelDep(Authorization, Buff);
    CFBamScopePKey pkey = schema.getFactoryScope().newPKey();
    pkey.setClassCode(Buff.getClassCode());
    pkey.setRequiredTenantId(Buff.getRequiredTenantId());
    pkey.setRequiredId(Buff.getRequiredId());
    CFBamDelSubDep3ByContDelDep2IdxKey keyContDelDep2Idx =
        schema.getFactoryDelSubDep3().newContDelDep2IdxKey();
    keyContDelDep2Idx.setRequiredContTenantId(Buff.getRequiredContTenantId());
    keyContDelDep2Idx.setRequiredContDelDep2Id(Buff.getRequiredContDelDep2Id());

    CFBamDelSubDep3ByUNameIdxKey keyUNameIdx = schema.getFactoryDelSubDep3().newUNameIdxKey();
    keyUNameIdx.setRequiredContTenantId(Buff.getRequiredContTenantId());
    keyUNameIdx.setRequiredContDelDep2Id(Buff.getRequiredContDelDep2Id());
    keyUNameIdx.setRequiredName(Buff.getRequiredName());

    // Validate unique indexes

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

    if (dictByUNameIdx.containsKey(keyUNameIdx)) {
      throw CFLib.getDefaultExceptionFactory()
          .newUniqueIndexViolationException(
              getClass(), S_ProcName, "DelSubDep3UNameIdx", keyUNameIdx);
    }

    // Validate foreign keys

    {
      boolean allNull = true;
      allNull = false;
      allNull = false;
      if (!allNull) {
        if (null
            == schema
                .getTableDelDep()
                .readDerivedByIdIdx(
                    Authorization, Buff.getRequiredTenantId(), Buff.getRequiredId())) {
          throw CFLib.getDefaultExceptionFactory()
              .newUnresolvedRelationException(
                  getClass(), S_ProcName, "Superclass", "SuperClass", "DelDep", null);
        }
      }
    }

    {
      boolean allNull = true;
      allNull = false;
      allNull = false;
      if (!allNull) {
        if (null
            == schema
                .getTableDelSubDep2()
                .readDerivedByIdIdx(
                    Authorization,
                    Buff.getRequiredContTenantId(),
                    Buff.getRequiredContDelDep2Id())) {
          throw CFLib.getDefaultExceptionFactory()
              .newUnresolvedRelationException(
                  getClass(), S_ProcName, "Container", "ContDelSubDep3", "DelSubDep2", null);
        }
      }
    }

    // Proceed with adding the new record

    dictByPKey.put(pkey, Buff);

    Map<CFBamScopePKey, CFBamDelSubDep3Buff> subdictContDelDep2Idx;
    if (dictByContDelDep2Idx.containsKey(keyContDelDep2Idx)) {
      subdictContDelDep2Idx = dictByContDelDep2Idx.get(keyContDelDep2Idx);
    } else {
      subdictContDelDep2Idx = new HashMap<CFBamScopePKey, CFBamDelSubDep3Buff>();
      dictByContDelDep2Idx.put(keyContDelDep2Idx, subdictContDelDep2Idx);
    }
    subdictContDelDep2Idx.put(pkey, Buff);

    dictByUNameIdx.put(keyUNameIdx, Buff);
  }
  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
      String attrTenantId = null;
      // Attribute Extraction
      String attrLocalName;
      int numAttrs;
      int idxAttr;
      final String S_ProcName = "startElement";
      final String S_LocalName = "LocalName";

      assert qName.equals("RqstClearSubDep1Lock");

      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
      CFBamScopePKey pkey =
          ((ICFBamSchema) schemaObj.getBackingStore()).getFactoryScope().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("TenantId")) {
          if (attrTenantId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrTenantId = 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 ((attrTenantId == null) || (attrTenantId.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "TenantId");
      }
      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 natTenantId;
      natTenantId = Long.parseLong(attrTenantId);
      pkey.setRequiredTenantId(natTenantId);

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

      pkey.setRequiredId(natId);
      // Lock the object
      ICFBamClearSubDep1Obj locked =
          ((ICFBamClearSubDep1Obj) schemaObj.getClearSubDep1TableObj().lockClearSubDep1(pkey));
      String response =
          schemaFormatter.formatRspnXmlPreamble()
              + "\n"
              + "\t"
              + CFBamXMsgClearSubDep1MessageFormatter.formatClearSubDep1RspnLocked(
                  "\n\t\t\t", locked.getClearSubDep1Buff())
              + "\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 boolean equals(Object obj) {
   if (obj == null) {
     return (false);
   } else if (obj instanceof CFBamServerProcBuff) {
     CFBamServerProcBuff rhs = (CFBamServerProcBuff) obj;
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     if (getRequiredId() != rhs.getRequiredId()) {
       return (false);
     }
     if (getOptionalDummy() != null) {
       if (rhs.getOptionalDummy() != null) {
         if (!getOptionalDummy().equals(rhs.getOptionalDummy())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalDummy() != null) {
         return (false);
       }
     }
     return (true);
   } else if (obj instanceof CFBamScopePKey) {
     CFBamScopePKey rhs = (CFBamScopePKey) obj;
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     if (getRequiredId() != rhs.getRequiredId()) {
       return (false);
     }
     return (true);
   } else if (obj instanceof CFBamServerProcHBuff) {
     CFBamServerProcHBuff rhs = (CFBamServerProcHBuff) obj;
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     if (getRequiredId() != rhs.getRequiredId()) {
       return (false);
     }
     if (getOptionalDummy() != null) {
       if (rhs.getOptionalDummy() != null) {
         if (!getOptionalDummy().equals(rhs.getOptionalDummy())) {
           return (false);
         }
       }
     } else {
       if (rhs.getOptionalDummy() != null) {
         return (false);
       }
     }
     return (true);
   } else if (obj instanceof CFBamScopeHPKey) {
     CFBamScopeHPKey rhs = (CFBamScopeHPKey) obj;
     if (getRequiredTenantId() != rhs.getRequiredTenantId()) {
       return (false);
     }
     if (getRequiredId() != rhs.getRequiredId()) {
       return (false);
     }
     return (true);
   } else {
     boolean retval = super.equals(obj);
     return (retval);
   }
 }
 public int compareTo(Object obj) {
   if (obj == null) {
     return (-1);
   } else if (obj instanceof CFBamServerProcBuff) {
     CFBamServerProcBuff rhs = (CFBamServerProcBuff) obj;
     int retval = super.compareTo(rhs);
     if (retval != 0) {
       return (retval);
     }
     if (getOptionalDummy() != null) {
       if (rhs.getOptionalDummy() != null) {
         int cmp = getOptionalDummy().compareTo(rhs.getOptionalDummy());
         if (cmp != 0) {
           return (cmp);
         }
       } else {
         return (1);
       }
     } else {
       if (rhs.getOptionalDummy() != null) {
         return (-1);
       }
     }
     return (0);
   } else if (obj instanceof CFBamScopePKey) {
     CFBamScopePKey rhs = (CFBamScopePKey) obj;
     if (getRequiredTenantId() < rhs.getRequiredTenantId()) {
       return (-1);
     } else if (getRequiredTenantId() > rhs.getRequiredTenantId()) {
       return (1);
     }
     if (getRequiredId() < rhs.getRequiredId()) {
       return (-1);
     } else if (getRequiredId() > rhs.getRequiredId()) {
       return (1);
     }
     return (0);
   } else if (obj instanceof CFBamScopeHPKey) {
     CFBamScopeHPKey rhs = (CFBamScopeHPKey) obj;
     {
       int lhsRequiredRevision = getRequiredRevision();
       int rhsRequiredRevision = rhs.getRequiredRevision();
       if (lhsRequiredRevision < rhsRequiredRevision) {
         return (-1);
       } else if (lhsRequiredRevision > rhsRequiredRevision) {
         return (1);
       }
     }
     if (getRequiredTenantId() < rhs.getRequiredTenantId()) {
       return (-1);
     } else if (getRequiredTenantId() > rhs.getRequiredTenantId()) {
       return (1);
     }
     if (getRequiredId() < rhs.getRequiredId()) {
       return (-1);
     } else if (getRequiredId() > rhs.getRequiredId()) {
       return (1);
     }
     return (0);
   } else if (obj instanceof CFBamServerProcHBuff) {
     CFBamServerProcHBuff rhs = (CFBamServerProcHBuff) obj;
     int retval = super.compareTo(rhs);
     if (retval != 0) {
       return (retval);
     }
     if (getOptionalDummy() != null) {
       if (rhs.getOptionalDummy() != null) {
         int cmp = getOptionalDummy().compareTo(rhs.getOptionalDummy());
         if (cmp != 0) {
           return (cmp);
         }
       } else {
         return (1);
       }
     } else {
       if (rhs.getOptionalDummy() != null) {
         return (-1);
       }
     }
     return (0);
   } else {
     int retval = super.compareTo(obj);
     return (retval);
   }
 }
 public void deleteClearDepByIdIdx(CFSecurityAuthorization Authorization, CFBamScopePKey argKey) {
   deleteClearDepByIdIdx(Authorization, argKey.getRequiredTenantId(), argKey.getRequiredId());
 }
  public void startElement(String uri, String localName, String qName, Attributes attrs)
      throws SAXException {
    CFBamXMsgSchemaMessageFormatter schemaFormatter = null;
    try {
      // Common XML Attributes
      String attrId = null;
      String attrRevision = null;
      // Scope Attributes
      String attrTenantId = null;
      String attrCreatedAt = null;
      String attrCreatedBy = null;
      String attrUpdatedAt = null;
      String attrUpdatedBy = null;
      // Index Attributes
      String attrTableId = null;
      String attrDefSchemaTenantId = null;
      String attrDefSchemaId = null;
      String attrName = null;
      String attrShortName = null;
      String attrLabel = null;
      String attrShortDescription = null;
      String attrDescription = null;
      String attrDbName = null;
      String attrSuffix = null;
      String attrIsUnique = null;
      String attrIsDbMapped = null;
      String attrDefaultVisibility = null;
      // Attribute Extraction
      String attrLocalName;
      int numAttrs;
      int idxAttr;
      final String S_ProcName = "startElement";
      final String S_LocalName = "LocalName";

      assert qName.equals("RqstIndexUpdate");

      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()");
      }

      // 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("Revision")) {
          if (attrRevision != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrRevision = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("CreatedAt")) {
          if (attrCreatedAt != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrCreatedAt = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("CreatedBy")) {
          if (attrCreatedBy != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrCreatedBy = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("UpdatedAt")) {
          if (attrUpdatedAt != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrUpdatedAt = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("UpdatedBy")) {
          if (attrUpdatedBy != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrUpdatedBy = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("TenantId")) {
          if (attrTenantId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrTenantId = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("TableId")) {
          if (attrTableId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrTableId = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("DefSchemaTenantId")) {
          if (attrDefSchemaTenantId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrDefSchemaTenantId = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("DefSchemaId")) {
          if (attrDefSchemaId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrDefSchemaId = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("Name")) {
          if (attrName != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrName = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("ShortName")) {
          if (attrShortName != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrShortName = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("Label")) {
          if (attrLabel != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrLabel = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("ShortDescription")) {
          if (attrShortDescription != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrShortDescription = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("Description")) {
          if (attrDescription != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrDescription = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("DbName")) {
          if (attrDbName != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrDbName = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("Suffix")) {
          if (attrSuffix != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrSuffix = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("IsUnique")) {
          if (attrIsUnique != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrIsUnique = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("IsDbMapped")) {
          if (attrIsDbMapped != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrIsDbMapped = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("DefaultVisibility")) {
          if (attrDefaultVisibility != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrDefaultVisibility = 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 ((attrTenantId == null) || (attrTenantId.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "TenantId");
      }
      if ((attrId == null) || (attrId.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "Id");
      }
      if ((attrRevision == null) || (attrRevision.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "Revision");
      }
      if ((attrCreatedAt == null) || (attrCreatedAt.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "CreatedAt");
      }
      if ((attrCreatedBy == null) || (attrCreatedBy.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "CreatedBy");
      }
      if ((attrUpdatedAt == null) || (attrUpdatedAt.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "UpdatedAt");
      }
      if ((attrUpdatedBy == null) || (attrUpdatedBy.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "UpdatedBy");
      }
      if ((attrTableId == null) || (attrTableId.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "TableId");
      }
      if (attrName == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "Name");
      }
      if ((attrIsUnique == null) || (attrIsUnique.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "IsUnique");
      }
      if ((attrIsDbMapped == null) || (attrIsDbMapped.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "IsDbMapped");
      }
      if ((attrDefaultVisibility == null) || (attrDefaultVisibility.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "DefaultVisibility");
      }

      // Save named attributes to context
      CFLibXmlCoreContext curContext = getParser().getCurContext();

      // Instantiate a PKey buffer for the parsed information
      CFBamScopePKey pkey = schemaObj.getBackingStore().getFactoryScope().newPKey();

      long natTenantId;
      natTenantId = Long.parseLong(attrTenantId);
      pkey.setRequiredTenantId(natTenantId);
      long natId;
      natId = Long.parseLong(attrId);
      pkey.setRequiredId(natId);
      // Read the instance
      ICFBamIndexObj origBuff = schemaObj.getIndexTableObj().readIndex(pkey);
      if (origBuff == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "getIndexTableObj().readIndex()");
      } else {
        // Edit the instance
        ICFBamIndexEditObj editBuff = (ICFBamIndexEditObj) origBuff.beginEdit();
        CFBamIndexBuff dataBuff = editBuff.getIndexBuff();
        // Convert string attributes to native Java types
        // and apply the converted attributes to the editBuff.
        int natRevision = Integer.parseInt(attrRevision);
        dataBuff.setRequiredRevision(natRevision);
        UUID createdBy = null;
        if (attrCreatedBy != null) {
          createdBy = UUID.fromString(attrCreatedBy);
        }
        Calendar createdAt = null;
        if (attrCreatedAt != null) {
          createdAt = CFLibXmlUtil.parseTimestamp(attrCreatedAt);
        }
        UUID updatedBy = null;
        if (attrUpdatedBy != null) {
          updatedBy = UUID.fromString(attrUpdatedBy);
        }
        Calendar updatedAt = null;
        if (attrUpdatedAt != null) {
          updatedAt = CFLibXmlUtil.parseTimestamp(attrUpdatedAt);
        }
        if (createdBy != null) {
          dataBuff.setCreatedByUserId(createdBy);
        }
        if (createdAt != null) {
          dataBuff.setCreatedAt(createdAt);
        }
        if (updatedBy != null) {
          dataBuff.setUpdatedByUserId(updatedBy);
        }
        if (updatedAt != null) {
          dataBuff.setUpdatedAt(updatedAt);
        }
        long natTableId = Long.parseLong(attrTableId);

        dataBuff.setRequiredTableId(natTableId);

        Long natDefSchemaTenantId;
        if ((attrDefSchemaTenantId == null) || (attrDefSchemaTenantId.length() <= 0)) {
          natDefSchemaTenantId = null;
        } else {
          natDefSchemaTenantId = new Long(Long.parseLong(attrDefSchemaTenantId));
        }

        dataBuff.setOptionalDefSchemaTenantId(natDefSchemaTenantId);

        Long natDefSchemaId;
        if ((attrDefSchemaId == null) || (attrDefSchemaId.length() <= 0)) {
          natDefSchemaId = null;
        } else {
          natDefSchemaId = new Long(Long.parseLong(attrDefSchemaId));
        }

        dataBuff.setOptionalDefSchemaId(natDefSchemaId);

        String natName = attrName;

        dataBuff.setRequiredName(natName);

        String natShortName = attrShortName;

        dataBuff.setOptionalShortName(natShortName);

        String natLabel = attrLabel;

        dataBuff.setOptionalLabel(natLabel);

        String natShortDescription = attrShortDescription;

        dataBuff.setOptionalShortDescription(natShortDescription);

        String natDescription = attrDescription;

        dataBuff.setOptionalDescription(natDescription);

        String natDbName = attrDbName;

        dataBuff.setOptionalDbName(natDbName);

        String natSuffix = attrSuffix;

        dataBuff.setOptionalSuffix(natSuffix);

        boolean natIsUnique;
        if (attrIsUnique.equals("true") || attrIsUnique.equals("yes") || attrIsUnique.equals("1")) {
          natIsUnique = true;
        } else if (attrIsUnique.equals("false")
            || attrIsUnique.equals("no")
            || attrIsUnique.equals("0")) {
          natIsUnique = false;
        } else {
          throw CFLib.getDefaultExceptionFactory()
              .newUsageException(
                  getClass(),
                  S_ProcName,
                  "Unexpected IsUnique value, must be one of true, false, yes, no, 1, or 0, not \""
                      + attrIsUnique
                      + "\"");
        }

        dataBuff.setRequiredIsUnique(natIsUnique);

        boolean natIsDbMapped;
        if (attrIsDbMapped.equals("true")
            || attrIsDbMapped.equals("yes")
            || attrIsDbMapped.equals("1")) {
          natIsDbMapped = true;
        } else if (attrIsDbMapped.equals("false")
            || attrIsDbMapped.equals("no")
            || attrIsDbMapped.equals("0")) {
          natIsDbMapped = false;
        } else {
          throw CFLib.getDefaultExceptionFactory()
              .newUsageException(
                  getClass(),
                  S_ProcName,
                  "Unexpected IsDbMapped value, must be one of true, false, yes, no, 1, or 0, not \""
                      + attrIsDbMapped
                      + "\"");
        }

        dataBuff.setRequiredIsDbMapped(natIsDbMapped);

        boolean natDefaultVisibility;
        if (attrDefaultVisibility.equals("true")
            || attrDefaultVisibility.equals("yes")
            || attrDefaultVisibility.equals("1")) {
          natDefaultVisibility = true;
        } else if (attrDefaultVisibility.equals("false")
            || attrDefaultVisibility.equals("no")
            || attrDefaultVisibility.equals("0")) {
          natDefaultVisibility = false;
        } else {
          throw CFLib.getDefaultExceptionFactory()
              .newUsageException(
                  getClass(),
                  S_ProcName,
                  "Unexpected DefaultVisibility value, must be one of true, false, yes, no, 1, or 0, not \""
                      + attrDefaultVisibility
                      + "\"");
        }

        dataBuff.setRequiredDefaultVisibility(natDefaultVisibility);

        //	Attempt the update
        editBuff.update();
        editBuff.endEdit();
        String response =
            schemaFormatter.formatRspnXmlPreamble()
                + "\n"
                + "\t"
                + CFBamXMsgIndexMessageFormatter.formatIndexRspnUpdated(
                    "\n\t\t\t", origBuff.getIndexBuff())
                + "\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 updateDelSubDep3(CFBamAuthorization Authorization, CFBamDelSubDep3Buff Buff) {
    schema.getTableDelDep().updateDelDep(Authorization, Buff);
    CFBamScopePKey pkey = schema.getFactoryScope().newPKey();
    pkey.setRequiredTenantId(Buff.getRequiredTenantId());
    pkey.setRequiredId(Buff.getRequiredId());
    CFBamDelSubDep3Buff existing = dictByPKey.get(pkey);
    if (existing == null) {
      throw CFLib.getDefaultExceptionFactory()
          .newStaleCacheDetectedException(
              getClass(), "updateDelSubDep3", "Existing record not found", "DelSubDep3", pkey);
    }
    CFBamDelSubDep3ByContDelDep2IdxKey existingKeyContDelDep2Idx =
        schema.getFactoryDelSubDep3().newContDelDep2IdxKey();
    existingKeyContDelDep2Idx.setRequiredContTenantId(existing.getRequiredContTenantId());
    existingKeyContDelDep2Idx.setRequiredContDelDep2Id(existing.getRequiredContDelDep2Id());

    CFBamDelSubDep3ByContDelDep2IdxKey newKeyContDelDep2Idx =
        schema.getFactoryDelSubDep3().newContDelDep2IdxKey();
    newKeyContDelDep2Idx.setRequiredContTenantId(Buff.getRequiredContTenantId());
    newKeyContDelDep2Idx.setRequiredContDelDep2Id(Buff.getRequiredContDelDep2Id());

    CFBamDelSubDep3ByUNameIdxKey existingKeyUNameIdx =
        schema.getFactoryDelSubDep3().newUNameIdxKey();
    existingKeyUNameIdx.setRequiredContTenantId(existing.getRequiredContTenantId());
    existingKeyUNameIdx.setRequiredContDelDep2Id(existing.getRequiredContDelDep2Id());
    existingKeyUNameIdx.setRequiredName(existing.getRequiredName());

    CFBamDelSubDep3ByUNameIdxKey newKeyUNameIdx = schema.getFactoryDelSubDep3().newUNameIdxKey();
    newKeyUNameIdx.setRequiredContTenantId(Buff.getRequiredContTenantId());
    newKeyUNameIdx.setRequiredContDelDep2Id(Buff.getRequiredContDelDep2Id());
    newKeyUNameIdx.setRequiredName(Buff.getRequiredName());

    // Check unique indexes

    if (!existingKeyUNameIdx.equals(newKeyUNameIdx)) {
      if (dictByUNameIdx.containsKey(newKeyUNameIdx)) {
        throw CFLib.getDefaultExceptionFactory()
            .newUniqueIndexViolationException(
                getClass(), "updateDelSubDep3", "DelSubDep3UNameIdx", newKeyUNameIdx);
      }
    }

    // Validate foreign keys

    {
      boolean allNull = true;

      if (allNull) {
        if (null
            == schema
                .getTableDelDep()
                .readDerivedByIdIdx(
                    Authorization, Buff.getRequiredTenantId(), Buff.getRequiredId())) {
          throw CFLib.getDefaultExceptionFactory()
              .newUnresolvedRelationException(
                  getClass(), "updateDelSubDep3", "Superclass", "SuperClass", "DelDep", null);
        }
      }
    }

    {
      boolean allNull = true;

      if (allNull) {
        if (null
            == schema
                .getTableDelSubDep2()
                .readDerivedByIdIdx(
                    Authorization,
                    Buff.getRequiredContTenantId(),
                    Buff.getRequiredContDelDep2Id())) {
          throw CFLib.getDefaultExceptionFactory()
              .newUnresolvedRelationException(
                  getClass(),
                  "updateDelSubDep3",
                  "Container",
                  "ContDelSubDep3",
                  "DelSubDep2",
                  null);
        }
      }
    }

    // Update is valid

    Map<CFBamScopePKey, CFBamDelSubDep3Buff> subdict;

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

    subdict = dictByContDelDep2Idx.get(existingKeyContDelDep2Idx);
    if (subdict != null) {
      subdict.remove(pkey);
    }
    if (dictByContDelDep2Idx.containsKey(newKeyContDelDep2Idx)) {
      subdict = dictByContDelDep2Idx.get(newKeyContDelDep2Idx);
    } else {
      subdict = new HashMap<CFBamScopePKey, CFBamDelSubDep3Buff>();
      dictByContDelDep2Idx.put(newKeyContDelDep2Idx, subdict);
    }
    subdict.put(pkey, Buff);

    dictByUNameIdx.remove(existingKeyUNameIdx);
    dictByUNameIdx.put(newKeyUNameIdx, Buff);
  }
  public void startElement(String uri, String localName, String qName, Attributes attrs)
      throws SAXException {
    CFBamXMsgSchemaMessageFormatter schemaFormatter = null;
    try {
      // Common XML Attributes
      String attrId = null;
      String attrRevision = null;
      // Scope Attributes
      String attrTenantId = null;
      String attrCreatedAt = null;
      String attrCreatedBy = null;
      String attrUpdatedAt = null;
      String attrUpdatedBy = null;
      // ClearDep Attributes
      String attrRelationId = null;
      // ClearSubDep3 Attributes
      String attrContClearDep2TenantId = null;
      String attrContClearDep2Id = null;
      String attrName = null;
      // Attribute Extraction
      String attrLocalName;
      int numAttrs;
      int idxAttr;
      final String S_ProcName = "startElement";
      final String S_LocalName = "LocalName";

      assert qName.equals("RqstClearSubDep3Update");

      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()");
      }

      // 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("Revision")) {
          if (attrRevision != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrRevision = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("CreatedAt")) {
          if (attrCreatedAt != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrCreatedAt = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("CreatedBy")) {
          if (attrCreatedBy != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrCreatedBy = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("UpdatedAt")) {
          if (attrUpdatedAt != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrUpdatedAt = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("UpdatedBy")) {
          if (attrUpdatedBy != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrUpdatedBy = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("TenantId")) {
          if (attrTenantId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrTenantId = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("RelationId")) {
          if (attrRelationId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrRelationId = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("ContClearDep2TenantId")) {
          if (attrContClearDep2TenantId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrContClearDep2TenantId = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("ContClearDep2Id")) {
          if (attrContClearDep2Id != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrContClearDep2Id = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("Name")) {
          if (attrName != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrName = 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 ((attrTenantId == null) || (attrTenantId.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "TenantId");
      }
      if ((attrId == null) || (attrId.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "Id");
      }
      if ((attrRevision == null) || (attrRevision.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "Revision");
      }
      if ((attrCreatedAt == null) || (attrCreatedAt.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "CreatedAt");
      }
      if ((attrCreatedBy == null) || (attrCreatedBy.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "CreatedBy");
      }
      if ((attrUpdatedAt == null) || (attrUpdatedAt.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "UpdatedAt");
      }
      if ((attrUpdatedBy == null) || (attrUpdatedBy.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "UpdatedBy");
      }
      if ((attrRelationId == null) || (attrRelationId.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "RelationId");
      }
      if ((attrContClearDep2TenantId == null) || (attrContClearDep2TenantId.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "ContClearDep2TenantId");
      }
      if ((attrContClearDep2Id == null) || (attrContClearDep2Id.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "ContClearDep2Id");
      }
      if (attrName == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "Name");
      }

      // Save named attributes to context
      CFLibXmlCoreContext curContext = getParser().getCurContext();

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

      long natTenantId;
      natTenantId = Long.parseLong(attrTenantId);
      pkey.setRequiredTenantId(natTenantId);
      long natId;
      natId = Long.parseLong(attrId);
      pkey.setRequiredId(natId);
      // Read the instance
      ICFBamClearSubDep3Obj origBuff =
          ((ICFBamClearSubDep3Obj) schemaObj.getClearSubDep3TableObj().readClearSubDep3(pkey));
      if (origBuff == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(
                getClass(), S_ProcName, 0, "getClearSubDep3TableObj().readClearSubDep3()");
      } else {
        // Edit the instance
        ICFBamClearSubDep3EditObj editBuff = (ICFBamClearSubDep3EditObj) origBuff.beginEdit();
        CFBamClearSubDep3Buff dataBuff = editBuff.getClearSubDep3Buff();
        // Convert string attributes to native Java types
        // and apply the converted attributes to the editBuff.
        int natRevision = Integer.parseInt(attrRevision);
        dataBuff.setRequiredRevision(natRevision);
        UUID createdBy = null;
        if (attrCreatedBy != null) {
          createdBy = UUID.fromString(attrCreatedBy);
        }
        Calendar createdAt = null;
        if (attrCreatedAt != null) {
          createdAt = CFLibXmlUtil.parseTimestamp(attrCreatedAt);
        }
        UUID updatedBy = null;
        if (attrUpdatedBy != null) {
          updatedBy = UUID.fromString(attrUpdatedBy);
        }
        Calendar updatedAt = null;
        if (attrUpdatedAt != null) {
          updatedAt = CFLibXmlUtil.parseTimestamp(attrUpdatedAt);
        }
        if (createdBy != null) {
          dataBuff.setCreatedByUserId(createdBy);
        }
        if (createdAt != null) {
          dataBuff.setCreatedAt(createdAt);
        }
        if (updatedBy != null) {
          dataBuff.setUpdatedByUserId(updatedBy);
        }
        if (updatedAt != null) {
          dataBuff.setUpdatedAt(updatedAt);
        }
        long natRelationId = Long.parseLong(attrRelationId);

        dataBuff.setRequiredRelationId(natRelationId);

        long natContClearDep2TenantId = Long.parseLong(attrContClearDep2TenantId);

        dataBuff.setRequiredContClearDep2TenantId(natContClearDep2TenantId);

        long natContClearDep2Id = Long.parseLong(attrContClearDep2Id);

        dataBuff.setRequiredContClearDep2Id(natContClearDep2Id);

        String natName = attrName;

        dataBuff.setRequiredName(natName);

        //	Attempt the update
        editBuff.update();
        editBuff.endEdit();
        String response =
            schemaFormatter.formatRspnXmlPreamble()
                + "\n"
                + "\t"
                + CFBamXMsgClearSubDep3MessageFormatter.formatClearSubDep3RspnUpdated(
                    "\n\t\t\t", origBuff.getClearSubDep3Buff())
                + "\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 int compareTo(Object obj) {
   if (obj == null) {
     return (-1);
   } else if (obj instanceof CFBamScopeHPKey) {
     CFBamScopeHPKey rhs = (CFBamScopeHPKey) obj;
     if (getRequiredTenantId() < rhs.getRequiredTenantId()) {
       return (-1);
     } else if (getRequiredTenantId() > rhs.getRequiredTenantId()) {
       return (1);
     }
     if (getRequiredId() < rhs.getRequiredId()) {
       return (-1);
     } else if (getRequiredId() > rhs.getRequiredId()) {
       return (1);
     }
     return (0);
   } else if (obj instanceof CFBamScopePKey) {
     CFBamScopePKey rhs = (CFBamScopePKey) obj;
     if (getRequiredTenantId() < rhs.getRequiredTenantId()) {
       return (-1);
     } else if (getRequiredTenantId() > rhs.getRequiredTenantId()) {
       return (1);
     }
     if (getRequiredId() < rhs.getRequiredId()) {
       return (-1);
     } else if (getRequiredId() > rhs.getRequiredId()) {
       return (1);
     }
     return (0);
   } else if (obj instanceof CFBamScopeBuff) {
     CFBamScopeBuff rhs = (CFBamScopeBuff) obj;
     if (getRequiredTenantId() < rhs.getRequiredTenantId()) {
       return (-1);
     } else if (getRequiredTenantId() > rhs.getRequiredTenantId()) {
       return (1);
     }
     if (getRequiredId() < rhs.getRequiredId()) {
       return (-1);
     } else if (getRequiredId() > rhs.getRequiredId()) {
       return (1);
     }
     return (0);
   } else if (obj instanceof CFBamScopeHBuff) {
     CFBamScopeHBuff rhs = (CFBamScopeHBuff) obj;
     if (getRequiredTenantId() < rhs.getRequiredTenantId()) {
       return (-1);
     } else if (getRequiredTenantId() > rhs.getRequiredTenantId()) {
       return (1);
     }
     if (getRequiredId() < rhs.getRequiredId()) {
       return (-1);
     } else if (getRequiredId() > rhs.getRequiredId()) {
       return (1);
     }
     return (0);
   } else {
     throw CFLib.getDefaultExceptionFactory()
         .newUnsupportedClassException(
             getClass(), "compareTo", "obj", obj, "CFBamScopePKey, CFBamScopeBuff");
   }
 }