public void deleteClearTopDepByTenantIdx(long TenantId) {
   CFBamScopeByTenantIdxKey key = schema.getBackingStore().getFactoryScope().newTenantIdxKey();
   key.setRequiredTenantId(TenantId);
   if (indexByTenantIdx == null) {
     indexByTenantIdx =
         new HashMap<CFBamScopeByTenantIdxKey, Map<CFBamScopePKey, ICFBamClearTopDepObj>>();
   }
   if (indexByTenantIdx.containsKey(key)) {
     Map<CFBamScopePKey, ICFBamClearTopDepObj> dict = indexByTenantIdx.get(key);
     schema
         .getBackingStore()
         .getTableClearTopDep()
         .deleteClearTopDepByTenantIdx(schema.getAuthorization(), TenantId);
     Iterator<ICFBamClearTopDepObj> iter = dict.values().iterator();
     ICFBamClearTopDepObj obj;
     List<ICFBamClearTopDepObj> toForget = new LinkedList<ICFBamClearTopDepObj>();
     while (iter.hasNext()) {
       obj = iter.next();
       toForget.add(obj);
     }
     iter = toForget.iterator();
     while (iter.hasNext()) {
       obj = iter.next();
       obj.forget(true);
     }
     indexByTenantIdx.remove(key);
   } else {
     schema
         .getBackingStore()
         .getTableClearTopDep()
         .deleteClearTopDepByTenantIdx(schema.getAuthorization(), TenantId);
   }
 }
 public ICFBamClearTopDepObj readClearTopDepByUNameIdx(
     long TenantId, long ContTableId, String Name, boolean forceRead) {
   if (indexByUNameIdx == null) {
     indexByUNameIdx = new HashMap<CFBamClearTopDepByUNameIdxKey, ICFBamClearTopDepObj>();
   }
   CFBamClearTopDepByUNameIdxKey key =
       schema.getBackingStore().getFactoryClearTopDep().newUNameIdxKey();
   key.setRequiredTenantId(TenantId);
   key.setRequiredContTableId(ContTableId);
   key.setRequiredName(Name);
   ICFBamClearTopDepObj obj = null;
   if ((!forceRead) && indexByUNameIdx.containsKey(key)) {
     obj = indexByUNameIdx.get(key);
   } else {
     CFBamClearTopDepBuff buff =
         schema
             .getBackingStore()
             .getTableClearTopDep()
             .readDerivedByUNameIdx(schema.getAuthorization(), TenantId, ContTableId, Name);
     if (buff != null) {
       obj =
           (ICFBamClearTopDepObj)
               schema.getScopeTableObj().constructByClassCode(buff.getClassCode());
       obj.setPKey(schema.getBackingStore().getFactoryScope().newPKey());
       obj.setBuff(buff);
       obj = (ICFBamClearTopDepObj) obj.realize();
     } else if (schema.getCacheMisses()) {
       indexByUNameIdx.put(key, null);
     }
   }
   return (obj);
 }
 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 void forgetClearTopDepByContTblIdx(long TenantId, long ContTableId) {
    if (indexByContTblIdx == null) {
      return;
    }
    CFBamClearTopDepByContTblIdxKey key =
        schema.getBackingStore().getFactoryClearTopDep().newContTblIdxKey();
    key.setRequiredTenantId(TenantId);
    key.setRequiredContTableId(ContTableId);
    if (indexByContTblIdx.containsKey(key)) {
      Map<CFBamScopePKey, ICFBamClearTopDepObj> mapContTblIdx = indexByContTblIdx.get(key);
      if (mapContTblIdx != null) {
        List<ICFBamClearTopDepObj> toForget = new LinkedList<ICFBamClearTopDepObj>();
        ICFBamClearTopDepObj cur = null;
        Iterator<ICFBamClearTopDepObj> iter = mapContTblIdx.values().iterator();
        while (iter.hasNext()) {
          cur = iter.next();
          toForget.add(cur);
        }
        iter = toForget.iterator();
        while (iter.hasNext()) {
          cur = iter.next();
          cur.forget(true);
        }
      }

      indexByContTblIdx.remove(key);
    }
  }
 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 void deleteClearTopDep(ICFBamClearTopDepObj Obj) {
   ICFBamClearTopDepObj obj = Obj;
   schema
       .getBackingStore()
       .getTableClearTopDep()
       .deleteClearTopDep(schema.getAuthorization(), obj.getClearTopDepBuff());
   obj.forget(true);
 }
 public ICFBamClearTopDepObj lockClearTopDep(CFBamScopePKey pkey) {
   ICFBamClearTopDepObj locked = null;
   CFBamClearTopDepBuff lockBuff =
       schema.getBackingStore().getTableClearTopDep().lockDerived(schema.getAuthorization(), pkey);
   if (lockBuff != null) {
     locked =
         (ICFBamClearTopDepObj)
             schema.getScopeTableObj().constructByClassCode(lockBuff.getClassCode());
     locked.setPKey(schema.getBackingStore().getFactoryScope().newPKey());
     locked.setBuff(lockBuff);
     locked = (ICFBamClearTopDepObj) locked.realize();
   } else {
     throw CFLib.getDefaultExceptionFactory()
         .newCollisionDetectedException(getClass(), "lockClearTopDep", pkey);
   }
   return (locked);
 }
 public ICFBamClearTopDepObj updateClearTopDep(ICFBamClearTopDepObj Obj) {
   ICFBamClearTopDepObj obj = Obj;
   schema
       .getBackingStore()
       .getTableClearTopDep()
       .updateClearTopDep(schema.getAuthorization(), Obj.getClearTopDepBuff());
   if (Obj.getClassCode().equals("CLRT")) {
     obj = (ICFBamClearTopDepObj) Obj.realize();
   }
   return (obj);
 }
 public ICFBamClearTopDepObj createClearTopDep(ICFBamClearTopDepObj Obj) {
   ICFBamClearTopDepObj obj = Obj;
   CFBamClearTopDepBuff buff = obj.getClearTopDepBuff();
   schema
       .getBackingStore()
       .getTableClearTopDep()
       .createClearTopDep(schema.getAuthorization(), buff);
   obj.copyBuffToPKey();
   if (obj.getPKey().getClassCode().equals("CLRT")) {
     obj = (ICFBamClearTopDepObj) (obj.realize());
   }
   return (obj);
 }
 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 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 deleteClearTopDepByUNameIdx(long TenantId, long ContTableId, String Name) {
   if (indexByUNameIdx == null) {
     indexByUNameIdx = new HashMap<CFBamClearTopDepByUNameIdxKey, ICFBamClearTopDepObj>();
   }
   CFBamClearTopDepByUNameIdxKey key =
       schema.getBackingStore().getFactoryClearTopDep().newUNameIdxKey();
   key.setRequiredTenantId(TenantId);
   key.setRequiredContTableId(ContTableId);
   key.setRequiredName(Name);
   ICFBamClearTopDepObj obj = null;
   if (indexByUNameIdx.containsKey(key)) {
     obj = indexByUNameIdx.get(key);
     schema
         .getBackingStore()
         .getTableClearTopDep()
         .deleteClearTopDepByUNameIdx(schema.getAuthorization(), TenantId, ContTableId, Name);
     obj.forget(true);
   } else {
     schema
         .getBackingStore()
         .getTableClearTopDep()
         .deleteClearTopDepByUNameIdx(schema.getAuthorization(), TenantId, ContTableId, Name);
   }
 }
  public void forgetClearTopDepByUNameIdx(long TenantId, long ContTableId, String Name) {
    if (indexByUNameIdx == null) {
      return;
    }
    CFBamClearTopDepByUNameIdxKey key =
        schema.getBackingStore().getFactoryClearTopDep().newUNameIdxKey();
    key.setRequiredTenantId(TenantId);
    key.setRequiredContTableId(ContTableId);
    key.setRequiredName(Name);
    if (indexByUNameIdx.containsKey(key)) {
      ICFBamClearTopDepObj probed = indexByUNameIdx.get(key);
      if (probed != null) {
        probed.forget(true);
      }

      indexByUNameIdx.remove(key);
    }
  }
  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;
      // 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("RqstInt64ColDelete");

      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
      CFBamValuePKey pkey = schemaObj.getBackingStore().getFactoryValue().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("Revision")) {
          if (attrRevision != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrRevision = 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");
      }
      if ((attrRevision == null) || (attrRevision.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "Revision");
      }

      // 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);
      int natRevision = Integer.parseInt(attrRevision);
      // Delete the object
      ICFBamInt64ColObj read = schemaObj.getInt64ColTableObj().readInt64Col(pkey);
      if (read != null) {
        if (read.getInt64ColBuff().getRequiredRevision() > natRevision) {
          throw CFLib.getDefaultExceptionFactory()
              .newCollisionDetectedException(
                  getClass(), S_ProcName, "Collision detected preparing to delete Int64Col");
        } else {
          ICFBamInt64ColEditObj editBuff = (ICFBamInt64ColEditObj) read.beginEdit();
          if (editBuff != null) {
            editBuff.delete();
            editBuff.endEdit();
            String response =
                schemaFormatter.formatRspnXmlPreamble()
                    + "\n"
                    + "\t"
                    + CFBamXMsgInt64ColMessageFormatter.formatInt64ColRspnDeleted()
                    + "\n"
                    + schemaFormatter.formatRspnXmlPostamble();
            ((CFBamXMsgRqstHandler) getParser()).appendResponse(response);
          } else {
            throw CFLib.getDefaultExceptionFactory()
                .newNullArgumentException(getClass(), S_ProcName, 0, "read.beginEdit()");
          }
        }
      } else {
        String response =
            schemaFormatter.formatRspnXmlPreamble()
                + "\n"
                + "\t"
                + CFBamXMsgSchemaMessageFormatter.formatRspnNoDataFound()
                + "\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 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("RqstAccessFrequencyLock");

      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
      CFBamAccessFrequencyPKey pkey =
          schemaObj.getBackingStore().getFactoryAccessFrequency().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.

      short natId;
      natId = Short.parseShort(attrId);
      pkey.setRequiredId(natId);

      pkey.setRequiredId(natId);
      // Lock the object
      ICFBamAccessFrequencyObj locked =
          schemaObj.getAccessFrequencyTableObj().lockAccessFrequency(pkey);
      String response =
          schemaFormatter.formatRspnXmlPreamble()
              + "\n"
              + "\t"
              + CFBamXMsgAccessFrequencyMessageFormatter.formatAccessFrequencyRspnLocked(
                  "\n\t\t\t", locked.getAccessFrequencyBuff())
              + "\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 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;
      String attrTldId = null;
      // Attribute Extraction
      String attrLocalName;
      int numAttrs;
      int idxAttr;
      final String S_ProcName = "startElement";
      final String S_LocalName = "LocalName";

      assert qName.equals("RqstTldRead");

      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
      CFBamTldPKey pkey = schemaObj.getBackingStore().getFactoryTld().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("TldId")) {
          if (attrTldId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrTldId = 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 ((attrTldId == null) || (attrTldId.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "TldId");
      }

      // 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 natTldId;
      natTldId = Long.parseLong(attrTldId);
      pkey.setRequiredTldId(natTldId);

      pkey.setRequiredTldId(natTldId);
      // Read the object and prepare the XML response
      ICFBamTldObj read = schemaObj.getTldTableObj().readTld(pkey, true);
      if (read != null) {
        String response =
            schemaFormatter.formatRspnXmlPreamble()
                + "\n"
                + "\t"
                + CFBamXMsgTldMessageFormatter.formatTldRspnSingleOpenTag()
                + CFBamXMsgTldMessageFormatter.formatTldRspnDerivedRec("\n\t\t", read.getTldBuff())
                + "\n"
                + "\t"
                + CFBamXMsgTldMessageFormatter.formatTldRspnSingleCloseTag()
                + schemaFormatter.formatRspnXmlPostamble();
        xmsgRqstHandler.appendResponse(response);
      } else {
        String response =
            schemaFormatter.formatRspnXmlPreamble()
                + "\n"
                + "\t"
                + CFBamXMsgSchemaMessageFormatter.formatRspnNoDataFound()
                + "\n"
                + schemaFormatter.formatRspnXmlPostamble();
        xmsgRqstHandler.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 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 forgetClearTopDep(ICFBamClearTopDepObj Obj, boolean forgetSubObjects) {
    ICFBamClearTopDepObj obj = Obj;
    CFBamScopePKey pkey = obj.getPKey();
    if (members.containsKey(pkey)) {
      ICFBamClearTopDepObj keepObj = members.get(pkey);
      // Detach object from alternate, duplicate, all and PKey indexes

      if (indexByTenantIdx != null) {
        CFBamScopeByTenantIdxKey keyTenantIdx =
            schema.getBackingStore().getFactoryScope().newTenantIdxKey();
        keyTenantIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        Map<CFBamScopePKey, ICFBamClearTopDepObj> mapTenantIdx = indexByTenantIdx.get(keyTenantIdx);
        if (mapTenantIdx != null) {
          indexByTenantIdx.remove(keyTenantIdx);
        }
      }

      if (indexByTableIdx != null) {
        CFBamClearDepByTableIdxKey keyTableIdx =
            schema.getBackingStore().getFactoryClearDep().newTableIdxKey();
        keyTableIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        keyTableIdx.setRequiredRelationId(keepObj.getRequiredRelationId());
        Map<CFBamScopePKey, ICFBamClearTopDepObj> mapTableIdx = indexByTableIdx.get(keyTableIdx);
        if (mapTableIdx != null) {
          indexByTableIdx.remove(keyTableIdx);
        }
      }

      if (indexByContTblIdx != null) {
        CFBamClearTopDepByContTblIdxKey keyContTblIdx =
            schema.getBackingStore().getFactoryClearTopDep().newContTblIdxKey();
        keyContTblIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        keyContTblIdx.setRequiredContTableId(keepObj.getRequiredContTableId());
        Map<CFBamScopePKey, ICFBamClearTopDepObj> mapContTblIdx =
            indexByContTblIdx.get(keyContTblIdx);
        if (mapContTblIdx != null) {
          mapContTblIdx.remove(keepObj.getPKey());
        }
      }

      if (indexByUNameIdx != null) {
        CFBamClearTopDepByUNameIdxKey keyUNameIdx =
            schema.getBackingStore().getFactoryClearTopDep().newUNameIdxKey();
        keyUNameIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        keyUNameIdx.setRequiredContTableId(keepObj.getRequiredContTableId());
        keyUNameIdx.setRequiredName(keepObj.getRequiredName());
        indexByUNameIdx.remove(keyUNameIdx);
      }

      if (allClearTopDep != null) {
        allClearTopDep.remove(keepObj.getPKey());
      }
      members.remove(pkey);
      if (forgetSubObjects) {
        schema
            .getClearSubDep1TableObj()
            .forgetClearSubDep1ByContClearTopIdx(
                keepObj.getRequiredTenantId(), keepObj.getRequiredId());
      }
    }
    schema.getClearDepTableObj().forgetClearDep(obj);
  }
 public List<ICFBamClearTopDepObj> readAllClearTopDep(boolean forceRead) {
   final String S_ProcName = "readAllClearTopDep";
   if ((allClearTopDep == null) || forceRead) {
     Map<CFBamScopePKey, ICFBamClearTopDepObj> map =
         new HashMap<CFBamScopePKey, ICFBamClearTopDepObj>();
     allClearTopDep = map;
     CFBamClearTopDepBuff[] buffList =
         schema.getBackingStore().getTableClearTopDep().readAllDerived(schema.getAuthorization());
     CFBamClearTopDepBuff buff;
     ICFBamClearTopDepObj obj;
     for (int idx = 0; idx < buffList.length; idx++) {
       buff = buffList[idx];
       obj =
           (ICFBamClearTopDepObj)
               schema.getScopeTableObj().constructByClassCode(buff.getClassCode());
       obj.setPKey(schema.getBackingStore().getFactoryScope().newPKey());
       obj.setBuff(buff);
       ICFBamClearTopDepObj realized = (ICFBamClearTopDepObj) obj.realize();
     }
   }
   Comparator<ICFBamClearTopDepObj> cmp =
       new Comparator<ICFBamClearTopDepObj>() {
         public int compare(ICFBamClearTopDepObj lhs, ICFBamClearTopDepObj rhs) {
           if (lhs == null) {
             if (rhs == null) {
               return (0);
             } else {
               return (-1);
             }
           } else if (rhs == null) {
             return (1);
           } else {
             CFBamScopePKey lhsPKey = lhs.getPKey();
             CFBamScopePKey rhsPKey = rhs.getPKey();
             int ret = lhsPKey.compareTo(rhsPKey);
             return (ret);
           }
         }
       };
   int len = allClearTopDep.size();
   ICFBamClearTopDepObj arr[] = new ICFBamClearTopDepObj[len];
   Iterator<ICFBamClearTopDepObj> valIter = allClearTopDep.values().iterator();
   int idx = 0;
   while ((idx < len) && valIter.hasNext()) {
     arr[idx++] = valIter.next();
   }
   if (idx < len) {
     throw CFLib.getDefaultExceptionFactory()
         .newArgumentUnderflowException(getClass(), S_ProcName, 0, "idx", idx, len);
   } else if (valIter.hasNext()) {
     throw CFLib.getDefaultExceptionFactory()
         .newArgumentOverflowException(getClass(), S_ProcName, 0, "idx", idx, len);
   }
   Arrays.sort(arr, cmp);
   ArrayList<ICFBamClearTopDepObj> arrayList = new ArrayList<ICFBamClearTopDepObj>(len);
   for (idx = 0; idx < len; idx++) {
     arrayList.add(arr[idx]);
   }
   List<ICFBamClearTopDepObj> sortedList = arrayList;
   return (sortedList);
 }
  public ICFBamClearTopDepObj realizeClearTopDep(ICFBamClearTopDepObj Obj) {
    ICFBamClearTopDepObj obj = Obj;
    CFBamScopePKey pkey = obj.getPKey();
    ICFBamClearTopDepObj keepObj = null;
    if (members.containsKey(pkey) && (null != members.get(pkey))) {
      ICFBamClearTopDepObj existingObj = members.get(pkey);
      keepObj = existingObj;

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

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

      if (indexByTenantIdx != null) {
        CFBamScopeByTenantIdxKey keyTenantIdx =
            schema.getBackingStore().getFactoryScope().newTenantIdxKey();
        keyTenantIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        Map<CFBamScopePKey, ICFBamClearTopDepObj> mapTenantIdx = indexByTenantIdx.get(keyTenantIdx);
        if (mapTenantIdx != null) {
          indexByTenantIdx.remove(keyTenantIdx);
        }
      }

      if (indexByTableIdx != null) {
        CFBamClearDepByTableIdxKey keyTableIdx =
            schema.getBackingStore().getFactoryClearDep().newTableIdxKey();
        keyTableIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        keyTableIdx.setRequiredRelationId(keepObj.getRequiredRelationId());
        Map<CFBamScopePKey, ICFBamClearTopDepObj> mapTableIdx = indexByTableIdx.get(keyTableIdx);
        if (mapTableIdx != null) {
          indexByTableIdx.remove(keyTableIdx);
        }
      }

      if (indexByContTblIdx != null) {
        CFBamClearTopDepByContTblIdxKey keyContTblIdx =
            schema.getBackingStore().getFactoryClearTopDep().newContTblIdxKey();
        keyContTblIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        keyContTblIdx.setRequiredContTableId(keepObj.getRequiredContTableId());
        Map<CFBamScopePKey, ICFBamClearTopDepObj> mapContTblIdx =
            indexByContTblIdx.get(keyContTblIdx);
        if (mapContTblIdx != null) {
          mapContTblIdx.remove(keepObj.getPKey());
        }
      }

      if (indexByUNameIdx != null) {
        CFBamClearTopDepByUNameIdxKey keyUNameIdx =
            schema.getBackingStore().getFactoryClearTopDep().newUNameIdxKey();
        keyUNameIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        keyUNameIdx.setRequiredContTableId(keepObj.getRequiredContTableId());
        keyUNameIdx.setRequiredName(keepObj.getRequiredName());
        indexByUNameIdx.remove(keyUNameIdx);
      }
      // Keep passing the new object because it's the one with the buffer
      // that the base table needs to copy to the existing object from
      // the cache.
      keepObj = (ICFBamClearTopDepObj) schema.getClearDepTableObj().realizeClearDep(Obj);

      // Attach new object to alternate and duplicate indexes -- PKey stay stable

      if (indexByTenantIdx != null) {
        CFBamScopeByTenantIdxKey keyTenantIdx =
            schema.getBackingStore().getFactoryScope().newTenantIdxKey();
        keyTenantIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        Map<CFBamScopePKey, ICFBamClearTopDepObj> mapTenantIdx = indexByTenantIdx.get(keyTenantIdx);
        if (mapTenantIdx != null) {
          mapTenantIdx.put(keepObj.getPKey(), keepObj);
        }
      }

      if (indexByTableIdx != null) {
        CFBamClearDepByTableIdxKey keyTableIdx =
            schema.getBackingStore().getFactoryClearDep().newTableIdxKey();
        keyTableIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        keyTableIdx.setRequiredRelationId(keepObj.getRequiredRelationId());
        Map<CFBamScopePKey, ICFBamClearTopDepObj> mapTableIdx = indexByTableIdx.get(keyTableIdx);
        if (mapTableIdx != null) {
          mapTableIdx.put(keepObj.getPKey(), keepObj);
        }
      }

      if (indexByContTblIdx != null) {
        CFBamClearTopDepByContTblIdxKey keyContTblIdx =
            schema.getBackingStore().getFactoryClearTopDep().newContTblIdxKey();
        keyContTblIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        keyContTblIdx.setRequiredContTableId(keepObj.getRequiredContTableId());
        Map<CFBamScopePKey, ICFBamClearTopDepObj> mapContTblIdx =
            indexByContTblIdx.get(keyContTblIdx);
        if (mapContTblIdx != null) {
          mapContTblIdx.put(keepObj.getPKey(), keepObj);
        }
      }

      if (indexByUNameIdx != null) {
        CFBamClearTopDepByUNameIdxKey keyUNameIdx =
            schema.getBackingStore().getFactoryClearTopDep().newUNameIdxKey();
        keyUNameIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        keyUNameIdx.setRequiredContTableId(keepObj.getRequiredContTableId());
        keyUNameIdx.setRequiredName(keepObj.getRequiredName());
        indexByUNameIdx.put(keyUNameIdx, keepObj);
      }
      if (allClearTopDep != null) {
        allClearTopDep.put(keepObj.getPKey(), keepObj);
      }
    } else {
      keepObj = obj;
      keepObj = (ICFBamClearTopDepObj) schema.getClearDepTableObj().realizeClearDep(keepObj);
      // Attach new object to PKey, all, alternate, and duplicate indexes
      members.put(keepObj.getPKey(), keepObj);
      if (allClearTopDep != null) {
        allClearTopDep.put(keepObj.getPKey(), keepObj);
      }

      if (indexByTenantIdx != null) {
        CFBamScopeByTenantIdxKey keyTenantIdx =
            schema.getBackingStore().getFactoryScope().newTenantIdxKey();
        keyTenantIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        Map<CFBamScopePKey, ICFBamClearTopDepObj> mapTenantIdx = indexByTenantIdx.get(keyTenantIdx);
        if (mapTenantIdx != null) {
          mapTenantIdx.put(keepObj.getPKey(), keepObj);
        }
      }

      if (indexByTableIdx != null) {
        CFBamClearDepByTableIdxKey keyTableIdx =
            schema.getBackingStore().getFactoryClearDep().newTableIdxKey();
        keyTableIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        keyTableIdx.setRequiredRelationId(keepObj.getRequiredRelationId());
        Map<CFBamScopePKey, ICFBamClearTopDepObj> mapTableIdx = indexByTableIdx.get(keyTableIdx);
        if (mapTableIdx != null) {
          mapTableIdx.put(keepObj.getPKey(), keepObj);
        }
      }

      if (indexByContTblIdx != null) {
        CFBamClearTopDepByContTblIdxKey keyContTblIdx =
            schema.getBackingStore().getFactoryClearTopDep().newContTblIdxKey();
        keyContTblIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        keyContTblIdx.setRequiredContTableId(keepObj.getRequiredContTableId());
        Map<CFBamScopePKey, ICFBamClearTopDepObj> mapContTblIdx =
            indexByContTblIdx.get(keyContTblIdx);
        if (mapContTblIdx != null) {
          mapContTblIdx.put(keepObj.getPKey(), keepObj);
        }
      }

      if (indexByUNameIdx != null) {
        CFBamClearTopDepByUNameIdxKey keyUNameIdx =
            schema.getBackingStore().getFactoryClearTopDep().newUNameIdxKey();
        keyUNameIdx.setRequiredTenantId(keepObj.getRequiredTenantId());
        keyUNameIdx.setRequiredContTableId(keepObj.getRequiredContTableId());
        keyUNameIdx.setRequiredName(keepObj.getRequiredName());
        indexByUNameIdx.put(keyUNameIdx, keepObj);
      }
    }
    return (keepObj);
  }
 public List<ICFBamClearTopDepObj> readClearTopDepByContTblIdx(
     long TenantId, long ContTableId, boolean forceRead) {
   final String S_ProcName = "readClearTopDepByContTblIdx";
   CFBamClearTopDepByContTblIdxKey key =
       schema.getBackingStore().getFactoryClearTopDep().newContTblIdxKey();
   key.setRequiredTenantId(TenantId);
   key.setRequiredContTableId(ContTableId);
   Map<CFBamScopePKey, ICFBamClearTopDepObj> dict;
   if (indexByContTblIdx == null) {
     indexByContTblIdx =
         new HashMap<CFBamClearTopDepByContTblIdxKey, Map<CFBamScopePKey, ICFBamClearTopDepObj>>();
   }
   if ((!forceRead) && indexByContTblIdx.containsKey(key)) {
     dict = indexByContTblIdx.get(key);
   } else {
     dict = new HashMap<CFBamScopePKey, ICFBamClearTopDepObj>();
     // Allow other threads to dirty-read while we're loading
     indexByContTblIdx.put(key, dict);
     ICFBamClearTopDepObj obj;
     CFBamClearTopDepBuff[] buffList =
         schema
             .getBackingStore()
             .getTableClearTopDep()
             .readDerivedByContTblIdx(schema.getAuthorization(), TenantId, ContTableId);
     CFBamClearTopDepBuff buff;
     for (int idx = 0; idx < buffList.length; idx++) {
       buff = buffList[idx];
       obj =
           (ICFBamClearTopDepObj)
               schema.getScopeTableObj().constructByClassCode(buff.getClassCode());
       obj.setPKey(schema.getBackingStore().getFactoryScope().newPKey());
       obj.setBuff(buff);
       ICFBamClearTopDepObj realized = (ICFBamClearTopDepObj) obj.realize();
     }
   }
   Comparator<ICFBamClearTopDepObj> cmp =
       new Comparator<ICFBamClearTopDepObj>() {
         public int compare(ICFBamClearTopDepObj lhs, ICFBamClearTopDepObj rhs) {
           if (lhs == null) {
             if (rhs == null) {
               return (0);
             } else {
               return (-1);
             }
           } else if (rhs == null) {
             return (1);
           } else {
             CFBamScopePKey lhsPKey = lhs.getPKey();
             CFBamScopePKey rhsPKey = rhs.getPKey();
             int ret = lhsPKey.compareTo(rhsPKey);
             return (ret);
           }
         }
       };
   int len = dict.size();
   ICFBamClearTopDepObj arr[] = new ICFBamClearTopDepObj[len];
   Iterator<ICFBamClearTopDepObj> valIter = dict.values().iterator();
   int idx = 0;
   while ((idx < len) && valIter.hasNext()) {
     arr[idx++] = valIter.next();
   }
   if (idx < len) {
     throw CFLib.getDefaultExceptionFactory()
         .newArgumentUnderflowException(getClass(), S_ProcName, 0, "idx", idx, len);
   } else if (valIter.hasNext()) {
     throw CFLib.getDefaultExceptionFactory()
         .newArgumentOverflowException(getClass(), S_ProcName, 0, "idx", idx, len);
   }
   Arrays.sort(arr, cmp);
   ArrayList<ICFBamClearTopDepObj> arrayList = new ArrayList<ICFBamClearTopDepObj>(len);
   for (idx = 0; idx < len; idx++) {
     arrayList.add(arr[idx]);
   }
   List<ICFBamClearTopDepObj> sortedList = arrayList;
   return (sortedList);
 }