public ICFSecuritySecGroupObj readSecGroupByUNameIdx(
     long ClusterId, String Name, boolean forceRead) {
   if (indexByUNameIdx == null) {
     indexByUNameIdx = new HashMap<CFSecuritySecGroupByUNameIdxKey, ICFSecuritySecGroupObj>();
   }
   CFSecuritySecGroupByUNameIdxKey key =
       ((ICFSecuritySchema) schema.getBackingStore()).getFactorySecGroup().newUNameIdxKey();
   key.setRequiredClusterId(ClusterId);
   key.setRequiredName(Name);
   ICFSecuritySecGroupObj obj = null;
   if ((!forceRead) && indexByUNameIdx.containsKey(key)) {
     obj = indexByUNameIdx.get(key);
   } else {
     CFSecuritySecGroupBuff buff =
         ((ICFSecuritySchema) schema.getBackingStore())
             .getTableSecGroup()
             .readDerivedByUNameIdx(schema.getAuthorization(), ClusterId, Name);
     if (buff != null) {
       obj = schema.getSecGroupTableObj().newInstance();
       obj.setPKey(((ICFSecuritySchema) schema.getBackingStore()).getFactorySecGroup().newPKey());
       obj.setBuff(buff);
       obj = (ICFSecuritySecGroupObj) obj.realize();
     } else if (schema.getCacheMisses()) {
       indexByUNameIdx.put(key, null);
     }
   }
   return (obj);
 }
 public ICFSecuritySecGroupObj lockSecGroup(CFSecuritySecGroupPKey pkey) {
   ICFSecuritySecGroupObj locked = null;
   CFSecuritySecGroupBuff lockBuff =
       ((ICFSecuritySchema) schema.getBackingStore())
           .getTableSecGroup()
           .lockDerived(schema.getAuthorization(), pkey);
   if (lockBuff != null) {
     locked = schema.getSecGroupTableObj().newInstance();
     locked.setPKey(((ICFSecuritySchema) schema.getBackingStore()).getFactorySecGroup().newPKey());
     locked.setBuff(lockBuff);
     locked = (ICFSecuritySecGroupObj) locked.realize();
   } else {
     throw CFLib.getDefaultExceptionFactory()
         .newCollisionDetectedException(getClass(), "lockSecGroup", pkey);
   }
   return (locked);
 }
 public ICFSecuritySecGroupObj readSecGroup(CFSecuritySecGroupPKey pkey, boolean forceRead) {
   ICFSecuritySecGroupObj obj = null;
   if ((!forceRead) && members.containsKey(pkey)) {
     obj = members.get(pkey);
   } else {
     CFSecuritySecGroupBuff readBuff =
         ((ICFSecuritySchema) schema.getBackingStore())
             .getTableSecGroup()
             .readDerivedByIdIdx(
                 schema.getAuthorization(),
                 pkey.getRequiredClusterId(),
                 pkey.getRequiredSecGroupId());
     if (readBuff != null) {
       obj = schema.getSecGroupTableObj().newInstance();
       obj.setPKey(((ICFSecuritySchema) schema.getBackingStore()).getFactorySecGroup().newPKey());
       obj.setBuff(readBuff);
       obj = (ICFSecuritySecGroupObj) obj.realize();
     } else if (schema.getCacheMisses()) {
       members.put(pkey, null);
     }
   }
   return (obj);
 }
  public void startElement(String uri, String localName, String qName, Attributes attrs)
      throws SAXException {
    CFSecurityXMsgSchemaMessageFormatter schemaFormatter = null;
    try {
      // Common XML Attributes
      String attrId = null;
      String attrClusterId = null;
      String attrName = null;
      // Attribute Extraction
      String attrLocalName;
      int numAttrs;
      int idxAttr;
      final String S_ProcName = "startElement";
      final String S_LocalName = "LocalName";

      assert qName.equals("RqstSecGroupReadByUNameIdx");

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

      schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();

      ICFSecuritySchemaObj 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("ClusterId")) {
          if (attrClusterId != null) {
            throw CFLib.getDefaultExceptionFactory()
                .newUniqueIndexViolationException(
                    getClass(), S_ProcName, S_LocalName, attrLocalName);
          }
          attrClusterId = 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 ((attrClusterId == null) || (attrClusterId.length() <= 0)) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "ClusterId");
      }
      if (attrName == null) {
        throw CFLib.getDefaultExceptionFactory()
            .newNullArgumentException(getClass(), S_ProcName, 0, "Name");
      }

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

      long natClusterId;
      natClusterId = Long.parseLong(attrClusterId);

      String natName;
      natName = attrName;

      // Read the object
      ICFSecuritySecGroupObj read =
          ((ICFSecuritySecGroupObj)
              schemaObj.getSecGroupTableObj().readSecGroupByUNameIdx(natClusterId, natName, true));
      if (read != null) {
        String response =
            schemaFormatter.formatRspnXmlPreamble()
                + "\n"
                + "\t"
                + CFSecurityXMsgSecGroupMessageFormatter.formatSecGroupRspnSingleOpenTag()
                + CFSecurityXMsgSecGroupMessageFormatter.formatSecGroupRspnDerivedRec(
                    "\n\t\t", read.getSecGroupBuff())
                + "\n"
                + "\t"
                + CFSecurityXMsgSecGroupMessageFormatter.formatSecGroupRspnSingleCloseTag()
                + schemaFormatter.formatRspnXmlPostamble();
        ((CFSecurityXMsgRqstHandler) getParser()).appendResponse(response);
      } else {
        String response =
            schemaFormatter.formatRspnXmlPreamble()
                + "\n"
                + "\t"
                + CFSecurityXMsgSchemaMessageFormatter.formatRspnNoDataFound()
                + "\n"
                + schemaFormatter.formatRspnXmlPostamble();
        xmsgRqstHandler.appendResponse(response);
      }
    } catch (RuntimeException e) {
      CFSecurityXMsgRqstHandler xmsgRqstHandler = ((CFSecurityXMsgRqstHandler) getParser());
      schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();
      String response =
          schemaFormatter.formatRspnXmlPreamble()
              + "\n"
              + "\t"
              + CFSecurityXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e)
              + "\n"
              + schemaFormatter.formatRspnXmlPostamble();
      xmsgRqstHandler.resetResponse();
      xmsgRqstHandler.appendResponse(response);
      xmsgRqstHandler.setCaughtException(true);
    } catch (Error e) {
      CFSecurityXMsgRqstHandler xmsgRqstHandler = ((CFSecurityXMsgRqstHandler) getParser());
      schemaFormatter = xmsgRqstHandler.getSchemaMessageFormatter();
      String response =
          schemaFormatter.formatRspnXmlPreamble()
              + "\n"
              + "\t"
              + CFSecurityXMsgSchemaMessageFormatter.formatRspnException("\n\t\t\t", e)
              + "\n"
              + schemaFormatter.formatRspnXmlPostamble();
      xmsgRqstHandler.resetResponse();
      xmsgRqstHandler.appendResponse(response);
      xmsgRqstHandler.setCaughtException(true);
    }
  }
 public List<ICFSecuritySecGroupObj> readSecGroupByClusterIdx(long ClusterId, boolean forceRead) {
   final String S_ProcName = "readSecGroupByClusterIdx";
   CFSecuritySecGroupByClusterIdxKey key =
       ((ICFSecuritySchema) schema.getBackingStore()).getFactorySecGroup().newClusterIdxKey();
   key.setRequiredClusterId(ClusterId);
   Map<CFSecuritySecGroupPKey, ICFSecuritySecGroupObj> dict;
   if (indexByClusterIdx == null) {
     indexByClusterIdx =
         new HashMap<
             CFSecuritySecGroupByClusterIdxKey,
             Map<CFSecuritySecGroupPKey, ICFSecuritySecGroupObj>>();
   }
   if ((!forceRead) && indexByClusterIdx.containsKey(key)) {
     dict = indexByClusterIdx.get(key);
   } else {
     dict = new HashMap<CFSecuritySecGroupPKey, ICFSecuritySecGroupObj>();
     // Allow other threads to dirty-read while we're loading
     indexByClusterIdx.put(key, dict);
     ICFSecuritySecGroupObj obj;
     CFSecuritySecGroupBuff[] buffList =
         ((ICFSecuritySchema) schema.getBackingStore())
             .getTableSecGroup()
             .readDerivedByClusterIdx(schema.getAuthorization(), ClusterId);
     CFSecuritySecGroupBuff buff;
     for (int idx = 0; idx < buffList.length; idx++) {
       buff = buffList[idx];
       obj = schema.getSecGroupTableObj().newInstance();
       obj.setPKey(((ICFSecuritySchema) schema.getBackingStore()).getFactorySecGroup().newPKey());
       obj.setBuff(buff);
       ICFSecuritySecGroupObj realized = (ICFSecuritySecGroupObj) obj.realize();
     }
   }
   Comparator<ICFSecuritySecGroupObj> cmp =
       new Comparator<ICFSecuritySecGroupObj>() {
         public int compare(ICFSecuritySecGroupObj lhs, ICFSecuritySecGroupObj rhs) {
           if (lhs == null) {
             if (rhs == null) {
               return (0);
             } else {
               return (-1);
             }
           } else if (rhs == null) {
             return (1);
           } else {
             CFSecuritySecGroupPKey lhsPKey = lhs.getPKey();
             CFSecuritySecGroupPKey rhsPKey = rhs.getPKey();
             int ret = lhsPKey.compareTo(rhsPKey);
             return (ret);
           }
         }
       };
   int len = dict.size();
   ICFSecuritySecGroupObj arr[] = new ICFSecuritySecGroupObj[len];
   Iterator<ICFSecuritySecGroupObj> 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<ICFSecuritySecGroupObj> arrayList = new ArrayList<ICFSecuritySecGroupObj>(len);
   for (idx = 0; idx < len; idx++) {
     arrayList.add(arr[idx]);
   }
   List<ICFSecuritySecGroupObj> sortedList = arrayList;
   return (sortedList);
 }