public int compare(ICFBamTableColObj lhs, ICFBamTableColObj rhs) {
   if (lhs == null) {
     if (rhs == null) {
       return (0);
     } else {
       return (-1);
     }
   } else if (rhs == null) {
     return (1);
   } else {
     String lhsValue = lhs.getObjQualifiedName();
     String rhsValue = rhs.getObjQualifiedName();
     if (lhsValue == null) {
       if (rhsValue == null) {
         return (0);
       } else {
         return (-1);
       }
     } else if (rhsValue == null) {
       return (1);
     } else {
       return (lhsValue.compareTo(rhsValue));
     }
   }
 }
  /**
   * The core evaluation of ColumnInOwnerLookupRelation is also to determine if an index definition
   * is in an owner relation.
   *
   * <p>WORKING: Yes, I know. This should be a business method instead of copying the code in
   * ICFBamIndexObj and MSIsaGenBindColumnInOwnerLookupRelation.
   *
   * @param genDef to be considered
   * @return True if the column participates in an owner relation.
   */
  public static Boolean isColumnInContainerOrNamedLookupRelation(ICFLibAnyObj genDef) {

    ICFLibAnyObj focusDef;
    ICFBamTableObj tableDef;
    final String S_ProcName = "isColumnInContainerOrNamedLookupRelation";

    if (genDef instanceof ICFBamAtomObj) {
      ICFBamAtomObj atomDef = (ICFBamAtomObj) genDef;
      ICFLibAnyObj atomScopeDef = atomDef.getObjScope();
      tableDef = (ICFBamTableObj) atomScopeDef;
      focusDef = genDef;
    } else if (genDef instanceof ICFBamTableColObj) {
      ICFBamTableColObj tableColDef = (ICFBamTableColObj) genDef;
      ICFLibAnyObj tableColScopeDef = tableColDef.getObjScope();
      tableDef = (ICFBamTableObj) tableColScopeDef;
      focusDef = genDef;
    } else if (genDef instanceof ICFBamIndexColObj) {
      ICFBamIndexColObj indexColDef = (ICFBamIndexColObj) genDef;
      focusDef = indexColDef.getRequiredLookupColumn();
      if (focusDef instanceof ICFBamAtomObj) {
        tableDef = (ICFBamTableObj) ((ICFBamAtomObj) focusDef).getObjScope();
      } else if (focusDef instanceof ICFBamTableColObj) {
        tableDef = (ICFBamTableObj) ((ICFBamTableColObj) focusDef).getObjScope();
      } else {
        throw CFLib.getDefaultExceptionFactory()
            .newUnsupportedClassException(
                MSSBamCFGenBindColumnInContainerOrNamedLookupRelation.class,
                S_ProcName,
                "genContext.GenDef.LookupColumn",
                genDef,
                "ICFBamAtomObj, ICFBamTableColObj");
      }
    } else if (genDef instanceof ICFBamRelationColObj) {
      ICFBamRelationColObj relColDef = (ICFBamRelationColObj) genDef;
      ICFLibAnyObj columnDef = relColDef.getRequiredLookupFromCol();
      if (columnDef instanceof ICFBamAtomObj) {
        focusDef = columnDef;
        tableDef = (ICFBamTableObj) columnDef.getObjScope();
      } else if (columnDef instanceof ICFBamTableColObj) {
        focusDef = columnDef;
        tableDef = (ICFBamTableObj) columnDef.getObjScope();
      } else {
        throw CFLib.getDefaultExceptionFactory()
            .newUnsupportedClassException(
                MSSBamCFGenBindColumnInContainerOrNamedLookupRelation.class,
                S_ProcName,
                "genContext.GenDef.FromCol",
                genDef,
                "ICFBamAtomObj, ICFBamTableColObj");
      }
    } else {
      throw CFLib.getDefaultExceptionFactory()
          .newUnsupportedClassException(
              MSSBamCFGenBindColumnInContainerOrNamedLookupRelation.class,
              S_ProcName,
              "genContext.GenDef",
              genDef,
              "ICFBamAtomObj, ICFBamTableColObj, ICFBamIndexColObj, ICFBamRelationColObj");
    }

    List<ICFBamRelationObj> containerNamedLookupRelations =
        MSSBamCFTableObj.getOwnerContainerNamedLookupChainRelations(tableDef);
    if ((containerNamedLookupRelations == null)
        || ((containerNamedLookupRelations != null)
            && (containerNamedLookupRelations.size() == 0))) {
      return (false);
    }

    ListIterator<ICFBamRelationObj> ownerEnumerator = containerNamedLookupRelations.listIterator();

    ICFBamRelationObj ownerRelation;
    ICFBamRelationColObj ownerRelationCol;
    ICFBamIndexColObj indexCol;
    Iterator<ICFBamRelationColObj> ownerRelationCols;

    while (ownerEnumerator.hasNext()) {

      ownerRelation = ownerEnumerator.next();
      ownerRelationCols = ownerRelation.getOptionalComponentsColumns().iterator();
      while (ownerRelationCols.hasNext()) {
        ownerRelationCol = ownerRelationCols.next();
        indexCol = ownerRelationCol.getRequiredLookupFromCol();
        if (indexCol.getRequiredLookupColumn() == focusDef) {
          return (true);
        }
      }
    }

    return (false);
  }
 public Object getValueAt(int row, int column) {
   if ((row < 0) || (column < -1)) {
     return (null);
   }
   if (arrayOfTableCol == null) {
     return (null);
   }
   int len = arrayOfTableCol.length;
   if (row >= len) {
     return (null);
   }
   ICFBamTableColObj obj = arrayOfTableCol[row];
   if (obj == null) {
     return (null);
   }
   Object retval;
   switch (column) {
     case COLID_ROW_HEADER:
       retval = obj;
       break;
     case COLID_OBJQUALIFIEDNAME:
       retval = obj.getObjQualifiedName();
       break;
     case COLID_ID:
       retval = new Long(obj.getRequiredId());
       break;
     case COLID_NAME:
       retval = obj.getRequiredName();
       if (retval == null) {
         retval = "";
       }
       break;
     case COLID_SHORTNAME:
       retval = obj.getOptionalShortName();
       if (retval == null) {
         retval = "";
       }
       break;
     case COLID_LABEL:
       retval = obj.getOptionalLabel();
       if (retval == null) {
         retval = "";
       }
       break;
     case COLID_SHORTDESCRIPTION:
       retval = obj.getOptionalShortDescription();
       if (retval == null) {
         retval = "";
       }
       break;
     case COLID_DESCRIPTION:
       retval = obj.getOptionalDescription();
       if (retval == null) {
         retval = "";
       }
       break;
     case COLID_ISNULLABLE:
       retval = new Boolean(obj.getRequiredIsNullable());
       break;
     case COLID_GENERATEID:
       retval = obj.getOptionalGenerateId();
       break;
     case COLID_DEFAULTVISIBILITY:
       retval = new Boolean(obj.getRequiredDefaultVisibility());
       break;
     case COLID_DBNAME:
       retval = obj.getOptionalDbName();
       if (retval == null) {
         retval = "";
       }
       break;
     case COLID_PARENT_DATATYPE:
       retval = obj.getRequiredParentDataType();
       break;
     case COLID_LOOKUP_DEFSCHEMA:
       retval = obj.getOptionalLookupDefSchema();
       break;
     case COLID_LOOKUP_DATASCOPE:
       retval = obj.getOptionalLookupDataScope();
       break;
     case COLID_LOOKUP_VACCSEC:
       retval = obj.getOptionalLookupVAccSec();
       break;
     case COLID_LOOKUP_EACCSEC:
       retval = obj.getOptionalLookupEAccSec();
       break;
     case COLID_LOOKUP_VACCFREQ:
       retval = obj.getOptionalLookupVAccFreq();
       break;
     case COLID_LOOKUP_EACCFREQ:
       retval = obj.getOptionalLookupEAccFreq();
       break;
     case COLID_LOOKUP_PREV:
       retval = obj.getOptionalLookupPrev();
       break;
     case COLID_LOOKUP_NEXT:
       retval = obj.getOptionalLookupNext();
       break;
     default:
       retval = null;
       break;
   }
   return (retval);
 }
  public void startElement(String uri, String localName, String qName, Attributes attrs)
      throws SAXException {
    try {
      // Common XML Attributes
      String attrId = null;
      // Value Attributes
      String attrName = null;
      String attrShortName = null;
      String attrLabel = null;
      String attrShortDescription = null;
      String attrDescription = null;
      String attrIsNullable = null;
      String attrGenerateId = null;
      String attrDefaultVisibility = null;
      String attrDefSchema = null;
      String attrDataScope = null;
      String attrVAccSec = null;
      String attrEAccSec = null;
      String attrVAccFreq = null;
      String attrEAccFreq = null;
      // Value References
      ICFBamTenantObj refTenant = null;
      ICFBamScopeObj refScope = null;
      ICFBamSchemaDefObj refDefSchema = null;
      ICFBamDataScopeObj refDataScope = null;
      ICFBamAccessSecurityObj refVAccSec = null;
      ICFBamAccessSecurityObj refEAccSec = null;
      ICFBamAccessFrequencyObj refVAccFreq = null;
      ICFBamAccessFrequencyObj refEAccFreq = null;
      // TableCol Attributes
      String attrDbName = null;
      String attrDataType = null;
      // TableCol References
      ICFBamTableObj refTable = null;
      ICFBamValueObj refDataType = null;
      // Attribute Extraction
      String attrLocalName;
      int numAttrs;
      int idxAttr;
      final String S_ProcName = "startElement";
      final String S_LocalName = "LocalName";

      assert qName.equals("TableCol");

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

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

      // Instantiate an edit buffer for the parsed information
      ICFBamTableColEditObj editBuff =
          (ICFBamTableColEditObj) schemaObj.getTableColTableObj().newInstance().beginEdit();

      // 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("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("IsNullable")) {
          if (attrIsNullable != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrIsNullable = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("GenerateId")) {
          if (attrGenerateId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrGenerateId = 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("DefSchema")) {
          if (attrDefSchema != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrDefSchema = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("DataScope")) {
          if (attrDataScope != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrDataScope = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("VAccSec")) {
          if (attrVAccSec != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrVAccSec = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("EAccSec")) {
          if (attrEAccSec != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrEAccSec = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("VAccFreq")) {
          if (attrVAccFreq != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrVAccFreq = attrs.getValue(idxAttr);
        } else if (attrLocalName.equals("EAccFreq")) {
          if (attrEAccFreq != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrEAccFreq = 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("DataType")) {
          if (attrDataType != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrDataType = 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 (attrName == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "Name");
      }
      if ((attrIsNullable == null) || (attrIsNullable.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "IsNullable");
      }
      if ((attrDefaultVisibility == null) || (attrDefaultVisibility.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "DefaultVisibility");
      }
      if ((attrDataType == null) || (attrDataType.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "DataType");
      }

      // Save named attributes to context
      CFLibXmlCoreContext curContext = getParser().getCurContext();
      curContext.putNamedValue("Id", attrId);
      curContext.putNamedValue("Name", attrName);
      curContext.putNamedValue("ShortName", attrShortName);
      curContext.putNamedValue("Label", attrLabel);
      curContext.putNamedValue("ShortDescription", attrShortDescription);
      curContext.putNamedValue("Description", attrDescription);
      curContext.putNamedValue("IsNullable", attrIsNullable);
      curContext.putNamedValue("GenerateId", attrGenerateId);
      curContext.putNamedValue("DefaultVisibility", attrDefaultVisibility);
      curContext.putNamedValue("DefSchema", attrDefSchema);
      curContext.putNamedValue("DataScope", attrDataScope);
      curContext.putNamedValue("VAccSec", attrVAccSec);
      curContext.putNamedValue("EAccSec", attrEAccSec);
      curContext.putNamedValue("VAccFreq", attrVAccFreq);
      curContext.putNamedValue("EAccFreq", attrEAccFreq);
      curContext.putNamedValue("DbName", attrDbName);
      curContext.putNamedValue("DataType", attrDataType);

      // Convert string attributes to native Java types
      // and apply the converted attributes to the editBuff.

      Integer natId;
      if ((attrId != null) && (attrId.length() > 0)) {
        natId = new Integer(Integer.parseInt(attrId));
      } else {
        natId = null;
      }
      String natName = attrName;
      editBuff.setRequiredName(natName);

      String natShortName = attrShortName;
      editBuff.setOptionalShortName(natShortName);

      String natLabel = attrLabel;
      editBuff.setOptionalLabel(natLabel);

      String natShortDescription = attrShortDescription;
      editBuff.setOptionalShortDescription(natShortDescription);

      String natDescription = attrDescription;
      editBuff.setOptionalDescription(natDescription);

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

      Boolean natGenerateId;
      if ((attrGenerateId == null) || (attrGenerateId.length() <= 0)) {
        natGenerateId = null;
      } else if (attrGenerateId.equals("true")
          || attrGenerateId.equals("yes")
          || attrGenerateId.equals("1")) {
        natGenerateId = true;
      } else if (attrGenerateId.equals("false")
          || attrGenerateId.equals("no")
          || attrGenerateId.equals("0")) {
        natGenerateId = false;
      } else {
        throw CFLib.getDefaultExceptionFactory()
            .newUsageException(
                getClass(),
                S_ProcName,
                "Unexpected GenerateId value, must be one of true, false, yes, no, 1, or 0, not \""
                    + attrGenerateId
                    + "\"");
      }
      editBuff.setOptionalGenerateId(natGenerateId);

      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
                    + "\"");
      }
      editBuff.setRequiredDefaultVisibility(natDefaultVisibility);

      String natDbName = attrDbName;
      editBuff.setOptionalDbName(natDbName);

      // Get the scope/container object

      CFLibXmlCoreContext parentContext = curContext.getPrevContext();
      Object scopeObj;
      if (parentContext != null) {
        scopeObj = parentContext.getNamedValue("Object");
      } else {
        scopeObj = null;
      }

      // Resolve and apply required Container reference

      if (scopeObj == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "scopeObj");
      } else if (scopeObj instanceof ICFBamTableObj) {
        refTable = (ICFBamTableObj) scopeObj;
        editBuff.setRequiredContainerTable(refTable);
        refTenant = (ICFBamTenantObj) editBuff.getRequiredOwnerTenant();
      } else {
        throw CFLib.getDefaultExceptionFactory()
            .newUnsupportedClassException(
                getClass(), S_ProcName, "scopeObj", scopeObj, "ICFBamTableObj");
      }

      // Resolve and apply Owner reference

      if (refTenant == null) {
        if (scopeObj instanceof ICFBamTenantObj) {
          refTenant = (ICFBamTenantObj) scopeObj;
          editBuff.setRequiredOwnerTenant(refTenant);
        } else {
          throw CFLib.getDefaultExceptionFactory()
              .newNullArgumentException(getClass(), S_ProcName, 0, "Owner<Tenant>");
        }
      }

      refScope = refTable;
      // Lookup refDefSchema by qualified name
      if ((attrDefSchema != null) && (attrDefSchema.length() > 0)) {
        refDefSchema =
            (ICFBamSchemaDefObj)
                (editBuff.getNamedObject(
                    schemaObj.getSchemaDefTableObj().getObjQualifyingClass(), attrDefSchema));
        if (refDefSchema == null) {
          throw CFLib.getDefaultExceptionFactory()
              .newNullArgumentException(
                  getClass(),
                  S_ProcName,
                  0,
                  "Resolve DefSchema reference qualified name \""
                      + attrDefSchema
                      + "\" to table SchemaDef");
        }
      } else {
        refDefSchema = null;
      }
      editBuff.setOptionalLookupDefSchema(refDefSchema);

      // Lookup refDataScope by key name value attr
      if ((attrDataScope != null) && (attrDataScope.length() > 0)) {
        refDataScope =
            (ICFBamDataScopeObj)
                schemaObj.getDataScopeTableObj().readDataScopeByUNameIdx(attrDataScope);
        if (refDataScope == null) {
          throw CFLib.getDefaultExceptionFactory()
              .newNullArgumentException(
                  getClass(),
                  S_ProcName,
                  0,
                  "Resolve DataScope reference named \"" + attrDataScope + "\" to table DataScope");
        }
      } else {
        refDataScope = null;
      }
      editBuff.setOptionalLookupDataScope(refDataScope);

      // Lookup refVAccSec by key name value attr
      if ((attrVAccSec != null) && (attrVAccSec.length() > 0)) {
        refVAccSec =
            (ICFBamAccessSecurityObj)
                schemaObj.getAccessSecurityTableObj().readAccessSecurityByUNameIdx(attrVAccSec);
        if (refVAccSec == null) {
          throw CFLib.getDefaultExceptionFactory()
              .newNullArgumentException(
                  getClass(),
                  S_ProcName,
                  0,
                  "Resolve VAccSec reference named \""
                      + attrVAccSec
                      + "\" to table AccessSecurity");
        }
      } else {
        refVAccSec = null;
      }
      editBuff.setOptionalLookupVAccSec(refVAccSec);

      // Lookup refEAccSec by key name value attr
      if ((attrEAccSec != null) && (attrEAccSec.length() > 0)) {
        refEAccSec =
            (ICFBamAccessSecurityObj)
                schemaObj.getAccessSecurityTableObj().readAccessSecurityByUNameIdx(attrEAccSec);
        if (refEAccSec == null) {
          throw CFLib.getDefaultExceptionFactory()
              .newNullArgumentException(
                  getClass(),
                  S_ProcName,
                  0,
                  "Resolve EAccSec reference named \""
                      + attrEAccSec
                      + "\" to table AccessSecurity");
        }
      } else {
        refEAccSec = null;
      }
      editBuff.setOptionalLookupEAccSec(refEAccSec);

      // Lookup refVAccFreq by key name value attr
      if ((attrVAccFreq != null) && (attrVAccFreq.length() > 0)) {
        refVAccFreq =
            (ICFBamAccessFrequencyObj)
                schemaObj.getAccessFrequencyTableObj().readAccessFrequencyByUNameIdx(attrVAccFreq);
        if (refVAccFreq == null) {
          throw CFLib.getDefaultExceptionFactory()
              .newNullArgumentException(
                  getClass(),
                  S_ProcName,
                  0,
                  "Resolve VAccFreq reference named \""
                      + attrVAccFreq
                      + "\" to table AccessFrequency");
        }
      } else {
        refVAccFreq = null;
      }
      editBuff.setOptionalLookupVAccFreq(refVAccFreq);

      // Lookup refEAccFreq by key name value attr
      if ((attrEAccFreq != null) && (attrEAccFreq.length() > 0)) {
        refEAccFreq =
            (ICFBamAccessFrequencyObj)
                schemaObj.getAccessFrequencyTableObj().readAccessFrequencyByUNameIdx(attrEAccFreq);
        if (refEAccFreq == null) {
          throw CFLib.getDefaultExceptionFactory()
              .newNullArgumentException(
                  getClass(),
                  S_ProcName,
                  0,
                  "Resolve EAccFreq reference named \""
                      + attrEAccFreq
                      + "\" to table AccessFrequency");
        }
      } else {
        refEAccFreq = null;
      }
      editBuff.setOptionalLookupEAccFreq(refEAccFreq);

      // Lookup refDataType by qualified name
      if ((attrDataType != null) && (attrDataType.length() > 0)) {
        refDataType =
            (ICFBamValueObj)
                (editBuff.getNamedObject(
                    schemaObj.getValueTableObj().getObjQualifyingClass(), attrDataType));
        if (refDataType == null) {
          throw CFLib.getDefaultExceptionFactory()
              .newNullArgumentException(
                  getClass(),
                  S_ProcName,
                  0,
                  "Resolve DataType reference qualified name \""
                      + attrDataType
                      + "\" to table Value");
        }
      } else {
        refDataType = null;
      }
      editBuff.setRequiredParentDataType(refDataType);

      CFBamSaxLoader.LoaderBehaviourEnum loaderBehaviour = saxLoader.getTableColLoaderBehaviour();
      ICFBamTableColEditObj editTableCol = null;
      ICFBamTableColObj origTableCol =
          (ICFBamTableColObj)
              schemaObj
                  .getTableColTableObj()
                  .readTableColByUNameIdx(
                      refTenant.getRequiredId(),
                      refScope.getRequiredId(),
                      editBuff.getRequiredName());
      if (origTableCol == null) {
        editTableCol = editBuff;
      } else {
        switch (loaderBehaviour) {
          case Insert:
            break;
          case Update:
            editTableCol = (ICFBamTableColEditObj) origTableCol.beginEdit();
            editTableCol.setRequiredName(editBuff.getRequiredName());
            editTableCol.setOptionalShortName(editBuff.getOptionalShortName());
            editTableCol.setOptionalLabel(editBuff.getOptionalLabel());
            editTableCol.setOptionalShortDescription(editBuff.getOptionalShortDescription());
            editTableCol.setOptionalDescription(editBuff.getOptionalDescription());
            editTableCol.setRequiredIsNullable(editBuff.getRequiredIsNullable());
            editTableCol.setOptionalGenerateId(editBuff.getOptionalGenerateId());
            editTableCol.setRequiredDefaultVisibility(editBuff.getRequiredDefaultVisibility());
            editTableCol.setOptionalDbName(editBuff.getOptionalDbName());
            editTableCol.setOptionalLookupDefSchema(editBuff.getOptionalLookupDefSchema());
            editTableCol.setOptionalLookupDataScope(editBuff.getOptionalLookupDataScope());
            editTableCol.setOptionalLookupVAccSec(editBuff.getOptionalLookupVAccSec());
            editTableCol.setOptionalLookupEAccSec(editBuff.getOptionalLookupEAccSec());
            editTableCol.setOptionalLookupVAccFreq(editBuff.getOptionalLookupVAccFreq());
            editTableCol.setOptionalLookupEAccFreq(editBuff.getOptionalLookupEAccFreq());
            editTableCol.setRequiredParentDataType(editBuff.getRequiredParentDataType());
            break;
          case Replace:
            editTableCol = (ICFBamTableColEditObj) origTableCol.beginEdit();
            editTableCol.delete();
            editTableCol.endEdit();
            origTableCol = null;
            editTableCol = editBuff;
            break;
        }
      }

      if (editTableCol != null) {
        if (origTableCol != null) {
          editTableCol.update();
        } else {
          origTableCol = (ICFBamTableColObj) editTableCol.create();
        }
        editTableCol.endEdit();
      }

      curContext.putNamedValue("Object", origTableCol);
    } catch (RuntimeException e) {
      throw new RuntimeException(
          "Near "
              + getParser().getLocationInfo()
              + ": Caught and rethrew "
              + e.getClass().getName()
              + " - "
              + e.getMessage(),
          e);
    } catch (Error e) {
      throw new Error(
          "Near "
              + getParser().getLocationInfo()
              + ": Caught and rethrew "
              + e.getClass().getName()
              + " - "
              + e.getMessage(),
          e);
    }
  }