public ICFBamDataScopeObj readDataScopeByUNameIdx(String Name, boolean forceRead) {
   if (indexByUNameIdx == null) {
     indexByUNameIdx = new HashMap<CFBamDataScopeByUNameIdxKey, ICFBamDataScopeObj>();
   }
   CFBamDataScopeByUNameIdxKey key =
       ((ICFBamSchema) schema.getBackingStore()).getFactoryDataScope().newUNameIdxKey();
   key.setRequiredName(Name);
   ICFBamDataScopeObj obj = null;
   if ((!forceRead) && indexByUNameIdx.containsKey(key)) {
     obj = indexByUNameIdx.get(key);
   } else {
     CFBamDataScopeBuff buff =
         ((ICFBamSchema) schema.getBackingStore())
             .getTableDataScope()
             .readDerivedByUNameIdx(schema.getAuthorization(), Name);
     if (buff != null) {
       obj = schema.getDataScopeTableObj().newInstance();
       obj.setPKey(((ICFBamSchema) schema.getBackingStore()).getFactoryDataScope().newPKey());
       obj.setBuff(buff);
       obj = (ICFBamDataScopeObj) obj.realize();
     } else if (schema.getCacheMisses()) {
       indexByUNameIdx.put(key, null);
     }
   }
   return (obj);
 }
 public ICFBamDataScopeObj updateDataScope(ICFBamDataScopeObj Obj) {
   ICFBamDataScopeObj obj = Obj;
   ((ICFBamSchema) schema.getBackingStore())
       .getTableDataScope()
       .updateDataScope(schema.getAuthorization(), Obj.getDataScopeBuff());
   obj = (ICFBamDataScopeObj) Obj.realize();
   return (obj);
 }
 public ICFBamDataScopeObj createDataScope(ICFBamDataScopeObj Obj) {
   ICFBamDataScopeObj obj = Obj;
   CFBamDataScopeBuff buff = obj.getDataScopeBuff();
   ((ICFBamSchema) schema.getBackingStore())
       .getTableDataScope()
       .createDataScope(schema.getAuthorization(), buff);
   obj.copyBuffToPKey();
   obj = obj.realize();
   return (obj);
 }
 public ICFBamDataScopeObj lockDataScope(CFBamDataScopePKey pkey) {
   ICFBamDataScopeObj locked = null;
   CFBamDataScopeBuff lockBuff =
       ((ICFBamSchema) schema.getBackingStore())
           .getTableDataScope()
           .lockDerived(schema.getAuthorization(), pkey);
   if (lockBuff != null) {
     locked = schema.getDataScopeTableObj().newInstance();
     locked.setPKey(((ICFBamSchema) schema.getBackingStore()).getFactoryDataScope().newPKey());
     locked.setBuff(lockBuff);
     locked = (ICFBamDataScopeObj) locked.realize();
   } else {
     throw CFLib.getDefaultExceptionFactory()
         .newCollisionDetectedException(getClass(), "lockDataScope", pkey);
   }
   return (locked);
 }
 public ICFBamDataScopeObj readDataScope(CFBamDataScopePKey pkey, boolean forceRead) {
   ICFBamDataScopeObj obj = null;
   if ((!forceRead) && members.containsKey(pkey)) {
     obj = members.get(pkey);
   } else {
     CFBamDataScopeBuff readBuff =
         ((ICFBamSchema) schema.getBackingStore())
             .getTableDataScope()
             .readDerivedByIdIdx(schema.getAuthorization(), pkey.getRequiredId());
     if (readBuff != null) {
       obj = schema.getDataScopeTableObj().newInstance();
       obj.setPKey(((ICFBamSchema) schema.getBackingStore()).getFactoryDataScope().newPKey());
       obj.setBuff(readBuff);
       obj = (ICFBamDataScopeObj) obj.realize();
     } else if (schema.getCacheMisses()) {
       members.put(pkey, null);
     }
   }
   return (obj);
 }
 public List<ICFBamDataScopeObj> readAllDataScope(boolean forceRead) {
   final String S_ProcName = "readAllDataScope";
   if ((allDataScope == null) || forceRead) {
     Map<CFBamDataScopePKey, ICFBamDataScopeObj> map =
         new HashMap<CFBamDataScopePKey, ICFBamDataScopeObj>();
     allDataScope = map;
     CFBamDataScopeBuff[] buffList =
         ((ICFBamSchema) schema.getBackingStore())
             .getTableDataScope()
             .readAllDerived(schema.getAuthorization());
     CFBamDataScopeBuff buff;
     ICFBamDataScopeObj obj;
     for (int idx = 0; idx < buffList.length; idx++) {
       buff = buffList[idx];
       obj = newInstance();
       obj.setPKey(((ICFBamSchema) schema.getBackingStore()).getFactoryDataScope().newPKey());
       obj.setBuff(buff);
       ICFBamDataScopeObj realized = (ICFBamDataScopeObj) obj.realize();
     }
   }
   Comparator<ICFBamDataScopeObj> cmp =
       new Comparator<ICFBamDataScopeObj>() {
         public int compare(ICFBamDataScopeObj lhs, ICFBamDataScopeObj rhs) {
           if (lhs == null) {
             if (rhs == null) {
               return (0);
             } else {
               return (-1);
             }
           } else if (rhs == null) {
             return (1);
           } else {
             CFBamDataScopePKey lhsPKey = lhs.getPKey();
             CFBamDataScopePKey rhsPKey = rhs.getPKey();
             int ret = lhsPKey.compareTo(rhsPKey);
             return (ret);
           }
         }
       };
   int len = allDataScope.size();
   ICFBamDataScopeObj arr[] = new ICFBamDataScopeObj[len];
   Iterator<ICFBamDataScopeObj> valIter = allDataScope.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<ICFBamDataScopeObj> arrayList = new ArrayList<ICFBamDataScopeObj>(len);
   for (idx = 0; idx < len; idx++) {
     arrayList.add(arr[idx]);
   }
   List<ICFBamDataScopeObj> sortedList = arrayList;
   return (sortedList);
 }
  public void startElement(String uri, String localName, String qName, Attributes attrs)
      throws SAXException {
    try {
      // Common XML Attributes
      String attrId = null;
      String attrRevision = null;
      // DataScope Attributes
      String attrName = null;
      // Attribute Extraction
      String attrLocalName;
      int numAttrs;
      int idxAttr;
      final String S_ProcName = "startElement";
      final String S_LocalName = "LocalName";

      assert qName.equals("DataScope");

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

      ICFBamSchemaObj schemaObj = xmsgRspnHandler.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("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 ((attrId == null) || (attrId.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "Id");
      }
      if (attrName == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "Name");
      }

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

      // Convert string attributes to native Java types

      short natId = Short.parseShort(attrId);

      String natName = attrName;

      int natRevision = Integer.parseInt(attrRevision);
      // Get the parent context
      CFLibXmlCoreContext parentContext = curContext.getPrevContext();
      // Instantiate a buffer for the parsed information
      ICFBamDataScopeObj obj = schemaObj.getDataScopeTableObj().newInstance();
      CFBamDataScopeBuff dataBuff = obj.getDataScopeBuff();
      dataBuff.setRequiredId(natId);
      dataBuff.setRequiredName(natName);
      dataBuff.setRequiredRevision(natRevision);
      obj.copyBuffToPKey();
      @SuppressWarnings("unchecked")
      List<ICFBamDataScopeObj> list = (List<ICFBamDataScopeObj>) xmsgRspnHandler.getListOfObjects();
      ICFBamDataScopeObj realized = (ICFBamDataScopeObj) obj.realize();
      xmsgRspnHandler.setLastObjectProcessed(realized);
      if (list != null) {
        list.add(realized);
      }
    } 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);
    }
  }