public void deleteSecGroupByIdIdx(long ClusterId, int SecGroupId) { CFSecuritySecGroupPKey pkey = ((ICFSecuritySchema) schema.getBackingStore()).getFactorySecGroup().newPKey(); pkey.setRequiredClusterId(ClusterId); pkey.setRequiredSecGroupId(SecGroupId); ICFSecuritySecGroupObj obj = readSecGroup(pkey); if (obj != null) { ICFSecuritySecGroupEditObj editObj = (ICFSecuritySecGroupEditObj) obj.getEdit(); boolean editStarted; if (editObj == null) { editObj = (ICFSecuritySecGroupEditObj) 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 deleteSecGroup(ICFSecuritySecGroupObj Obj) { ICFSecuritySecGroupObj obj = Obj; ((ICFSecuritySchema) schema.getBackingStore()) .getTableSecGroup() .deleteSecGroup(schema.getAuthorization(), obj.getSecGroupBuff()); obj.forget(true); }
public void forgetSecGroupByClusterIdx(long ClusterId) { if (indexByClusterIdx == null) { return; } CFSecuritySecGroupByClusterIdxKey key = ((ICFSecuritySchema) schema.getBackingStore()).getFactorySecGroup().newClusterIdxKey(); key.setRequiredClusterId(ClusterId); if (indexByClusterIdx.containsKey(key)) { Map<CFSecuritySecGroupPKey, ICFSecuritySecGroupObj> mapClusterIdx = indexByClusterIdx.get(key); if (mapClusterIdx != null) { List<ICFSecuritySecGroupObj> toForget = new LinkedList<ICFSecuritySecGroupObj>(); ICFSecuritySecGroupObj cur = null; Iterator<ICFSecuritySecGroupObj> iter = mapClusterIdx.values().iterator(); while (iter.hasNext()) { cur = iter.next(); toForget.add(cur); } iter = toForget.iterator(); while (iter.hasNext()) { cur = iter.next(); cur.forget(true); } } indexByClusterIdx.remove(key); } }
public void deleteSecGroupByClusterIdx(long ClusterId) { CFSecuritySecGroupByClusterIdxKey key = ((ICFSecuritySchema) schema.getBackingStore()).getFactorySecGroup().newClusterIdxKey(); key.setRequiredClusterId(ClusterId); if (indexByClusterIdx == null) { indexByClusterIdx = new HashMap< CFSecuritySecGroupByClusterIdxKey, Map<CFSecuritySecGroupPKey, ICFSecuritySecGroupObj>>(); } if (indexByClusterIdx.containsKey(key)) { Map<CFSecuritySecGroupPKey, ICFSecuritySecGroupObj> dict = indexByClusterIdx.get(key); ((ICFSecuritySchema) schema.getBackingStore()) .getTableSecGroup() .deleteSecGroupByClusterIdx(schema.getAuthorization(), ClusterId); Iterator<ICFSecuritySecGroupObj> iter = dict.values().iterator(); ICFSecuritySecGroupObj obj; List<ICFSecuritySecGroupObj> toForget = new LinkedList<ICFSecuritySecGroupObj>(); while (iter.hasNext()) { obj = iter.next(); toForget.add(obj); } iter = toForget.iterator(); while (iter.hasNext()) { obj = iter.next(); obj.forget(true); } indexByClusterIdx.remove(key); } else { ((ICFSecuritySchema) schema.getBackingStore()) .getTableSecGroup() .deleteSecGroupByClusterIdx(schema.getAuthorization(), ClusterId); } }
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 updateSecGroup(ICFSecuritySecGroupObj Obj) { ICFSecuritySecGroupObj obj = Obj; ((ICFSecuritySchema) schema.getBackingStore()) .getTableSecGroup() .updateSecGroup(schema.getAuthorization(), Obj.getSecGroupBuff()); obj = (ICFSecuritySecGroupObj) Obj.realize(); return (obj); }
public ICFSecuritySecGroupObj createSecGroup(ICFSecuritySecGroupObj Obj) { ICFSecuritySecGroupObj obj = Obj; CFSecuritySecGroupBuff buff = obj.getSecGroupBuff(); ((ICFSecuritySchema) schema.getBackingStore()) .getTableSecGroup() .createSecGroup(schema.getAuthorization(), buff); obj.copyBuffToPKey(); obj = obj.realize(); return (obj); }
public void setRequiredContainerGroup(ICFSecuritySecGroupObj value) { if (buff == null) { getSecGroupFormBuff(); } requiredOwnerCluster = null; requiredContainerGroup = null; if (value != null) { getPKey().setRequiredClusterId(value.getRequiredClusterId()); getSecGroupFormBuff().setRequiredClusterId(value.getRequiredClusterId()); getSecGroupFormBuff().setRequiredSecGroupId(value.getRequiredSecGroupId()); } requiredContainerGroup = value; }
public void forgetSecGroupByIdIdx(long ClusterId, int SecGroupId) { if (members == null) { return; } CFSecuritySecGroupPKey key = ((ICFSecuritySchema) schema.getBackingStore()).getFactorySecGroup().newPKey(); key.setRequiredClusterId(ClusterId); key.setRequiredSecGroupId(SecGroupId); if (members.containsKey(key)) { ICFSecuritySecGroupObj probed = members.get(key); if (probed != null) { probed.forget(true); } } }
public void forgetSecGroupByUNameIdx(long ClusterId, String Name) { if (indexByUNameIdx == null) { return; } CFSecuritySecGroupByUNameIdxKey key = ((ICFSecuritySchema) schema.getBackingStore()).getFactorySecGroup().newUNameIdxKey(); key.setRequiredClusterId(ClusterId); key.setRequiredName(Name); if (indexByUNameIdx.containsKey(key)) { ICFSecuritySecGroupObj probed = indexByUNameIdx.get(key); if (probed != null) { probed.forget(true); } indexByUNameIdx.remove(key); } }
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 void minimizeMemory() { allSecGroup = null; indexByClusterIdx = null; indexByUNameIdx = null; List<ICFSecuritySecGroupObj> toForget = new LinkedList<ICFSecuritySecGroupObj>(); ICFSecuritySecGroupObj cur = null; Iterator<ICFSecuritySecGroupObj> iter = members.values().iterator(); while (iter.hasNext()) { cur = iter.next(); if (cur.getEdit() == null) { toForget.add(cur); } } iter = toForget.iterator(); while (iter.hasNext()) { cur = iter.next(); cur.forget(); } }
public ICFSecuritySecGroupObj getRequiredContainerGroup(boolean forceRead) { if (forceRead || (requiredContainerGroup == null)) { boolean anyMissing = false; if (!anyMissing) { ICFSecuritySecGroupObj obj = ((ICFAsteriskSchemaObj) getOrigAsSecGroupForm().getSchema()) .getSecGroupTableObj() .readSecGroupByIdIdx( getPKey().getRequiredClusterId(), getSecGroupFormBuff().getRequiredSecGroupId()); requiredContainerGroup = obj; if (obj != null) { getSecGroupFormBuff().setRequiredClusterId(obj.getRequiredClusterId()); getSecGroupFormBuff().setRequiredSecGroupId(obj.getRequiredSecGroupId()); requiredContainerGroup = obj; } } } return (requiredContainerGroup); }
public void deleteSecGroupByUNameIdx(long ClusterId, String Name) { 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 (indexByUNameIdx.containsKey(key)) { obj = indexByUNameIdx.get(key); ((ICFSecuritySchema) schema.getBackingStore()) .getTableSecGroup() .deleteSecGroupByUNameIdx(schema.getAuthorization(), ClusterId, Name); obj.forget(true); } else { ((ICFSecuritySchema) schema.getBackingStore()) .getTableSecGroup() .deleteSecGroupByUNameIdx(schema.getAuthorization(), ClusterId, Name); } }
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 ICFSecuritySecGroupObj realizeSecGroup(ICFSecuritySecGroupObj Obj) { ICFSecuritySecGroupObj obj = Obj; CFSecuritySecGroupPKey pkey = obj.getPKey(); ICFSecuritySecGroupObj keepObj = null; if (members.containsKey(pkey) && (null != members.get(pkey))) { ICFSecuritySecGroupObj 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 (indexByClusterIdx != null) { CFSecuritySecGroupByClusterIdxKey keyClusterIdx = ((ICFSecuritySchema) schema.getBackingStore()).getFactorySecGroup().newClusterIdxKey(); keyClusterIdx.setRequiredClusterId(keepObj.getRequiredClusterId()); Map<CFSecuritySecGroupPKey, ICFSecuritySecGroupObj> mapClusterIdx = indexByClusterIdx.get(keyClusterIdx); if (mapClusterIdx != null) { mapClusterIdx.remove(keepObj.getPKey()); } } if (indexByUNameIdx != null) { CFSecuritySecGroupByUNameIdxKey keyUNameIdx = ((ICFSecuritySchema) schema.getBackingStore()).getFactorySecGroup().newUNameIdxKey(); keyUNameIdx.setRequiredClusterId(keepObj.getRequiredClusterId()); keyUNameIdx.setRequiredName(keepObj.getRequiredName()); indexByUNameIdx.remove(keyUNameIdx); } keepObj.setBuff(Obj.getBuff()); // Attach new object to alternate and duplicate indexes -- PKey stay stable if (indexByClusterIdx != null) { CFSecuritySecGroupByClusterIdxKey keyClusterIdx = ((ICFSecuritySchema) schema.getBackingStore()).getFactorySecGroup().newClusterIdxKey(); keyClusterIdx.setRequiredClusterId(keepObj.getRequiredClusterId()); Map<CFSecuritySecGroupPKey, ICFSecuritySecGroupObj> mapClusterIdx = indexByClusterIdx.get(keyClusterIdx); if (mapClusterIdx != null) { mapClusterIdx.put(keepObj.getPKey(), keepObj); } } if (indexByUNameIdx != null) { CFSecuritySecGroupByUNameIdxKey keyUNameIdx = ((ICFSecuritySchema) schema.getBackingStore()).getFactorySecGroup().newUNameIdxKey(); keyUNameIdx.setRequiredClusterId(keepObj.getRequiredClusterId()); keyUNameIdx.setRequiredName(keepObj.getRequiredName()); indexByUNameIdx.put(keyUNameIdx, keepObj); } if (allSecGroup != null) { allSecGroup.put(keepObj.getPKey(), keepObj); } } else { keepObj = obj; keepObj.setIsNew(false); // Attach new object to PKey, all, alternate, and duplicate indexes members.put(keepObj.getPKey(), keepObj); if (allSecGroup != null) { allSecGroup.put(keepObj.getPKey(), keepObj); } if (indexByClusterIdx != null) { CFSecuritySecGroupByClusterIdxKey keyClusterIdx = ((ICFSecuritySchema) schema.getBackingStore()).getFactorySecGroup().newClusterIdxKey(); keyClusterIdx.setRequiredClusterId(keepObj.getRequiredClusterId()); Map<CFSecuritySecGroupPKey, ICFSecuritySecGroupObj> mapClusterIdx = indexByClusterIdx.get(keyClusterIdx); if (mapClusterIdx != null) { mapClusterIdx.put(keepObj.getPKey(), keepObj); } } if (indexByUNameIdx != null) { CFSecuritySecGroupByUNameIdxKey keyUNameIdx = ((ICFSecuritySchema) schema.getBackingStore()).getFactorySecGroup().newUNameIdxKey(); keyUNameIdx.setRequiredClusterId(keepObj.getRequiredClusterId()); keyUNameIdx.setRequiredName(keepObj.getRequiredName()); indexByUNameIdx.put(keyUNameIdx, keepObj); } } return (keepObj); }
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 void forgetSecGroup(ICFSecuritySecGroupObj Obj, boolean forgetSubObjects) { ICFSecuritySecGroupObj obj = Obj; CFSecuritySecGroupPKey pkey = obj.getPKey(); if (members.containsKey(pkey)) { ICFSecuritySecGroupObj keepObj = members.get(pkey); // Detach object from alternate, duplicate, all and PKey indexes if (indexByClusterIdx != null) { CFSecuritySecGroupByClusterIdxKey keyClusterIdx = ((ICFSecuritySchema) schema.getBackingStore()).getFactorySecGroup().newClusterIdxKey(); keyClusterIdx.setRequiredClusterId(keepObj.getRequiredClusterId()); Map<CFSecuritySecGroupPKey, ICFSecuritySecGroupObj> mapClusterIdx = indexByClusterIdx.get(keyClusterIdx); if (mapClusterIdx != null) { mapClusterIdx.remove(keepObj.getPKey()); } } if (indexByUNameIdx != null) { CFSecuritySecGroupByUNameIdxKey keyUNameIdx = ((ICFSecuritySchema) schema.getBackingStore()).getFactorySecGroup().newUNameIdxKey(); keyUNameIdx.setRequiredClusterId(keepObj.getRequiredClusterId()); keyUNameIdx.setRequiredName(keepObj.getRequiredName()); indexByUNameIdx.remove(keyUNameIdx); } if (allSecGroup != null) { allSecGroup.remove(keepObj.getPKey()); } members.remove(pkey); if (forgetSubObjects) { ((ICFSecuritySchemaObj) schema) .getSecGroupIncludeTableObj() .forgetSecGroupIncludeByGroupIdx( keepObj.getRequiredClusterId(), keepObj.getRequiredSecGroupId()); ((ICFSecuritySchemaObj) schema) .getSecGroupMemberTableObj() .forgetSecGroupMemberByGroupIdx( keepObj.getRequiredClusterId(), keepObj.getRequiredSecGroupId()); ((ICFSecuritySchemaObj) schema) .getSecGroupIncludeTableObj() .forgetSecGroupIncludeByIncludeIdx( keepObj.getRequiredClusterId(), keepObj.getRequiredSecGroupId()); ((ICFSecuritySchemaObj) schema) .getSecGroupFormTableObj() .forgetSecGroupFormByGroupIdx( keepObj.getRequiredClusterId(), keepObj.getRequiredSecGroupId()); } } }
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); }
public List<ICFSecuritySecGroupObj> readAllSecGroup(boolean forceRead) { final String S_ProcName = "readAllSecGroup"; if ((allSecGroup == null) || forceRead) { Map<CFSecuritySecGroupPKey, ICFSecuritySecGroupObj> map = new HashMap<CFSecuritySecGroupPKey, ICFSecuritySecGroupObj>(); allSecGroup = map; CFSecuritySecGroupBuff[] buffList = ((ICFSecuritySchema) schema.getBackingStore()) .getTableSecGroup() .readAllDerived(schema.getAuthorization()); CFSecuritySecGroupBuff buff; ICFSecuritySecGroupObj obj; for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; obj = 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 = allSecGroup.size(); ICFSecuritySecGroupObj arr[] = new ICFSecuritySecGroupObj[len]; Iterator<ICFSecuritySecGroupObj> valIter = allSecGroup.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); }