public void loadData(boolean forceReload) { ICFBamSchemaObj schemaObj = swingSchema.getSchema(); if ((containingCluster == null) || forceReload) { CFSecurityAuthorization auth = schemaObj.getAuthorization(); long containingClusterId = auth.getSecClusterId(); containingCluster = schemaObj.getClusterTableObj().readClusterByIdIdx(containingClusterId); } if ((listOfSysCluster == null) || forceReload) { arrayOfSysCluster = null; listOfSysCluster = schemaObj .getSysClusterTableObj() .readSysClusterByClusterIdx(containingCluster.getRequiredId(), swingIsInitializing); if (listOfSysCluster != null) { Object objArray[] = listOfSysCluster.toArray(); if (objArray != null) { int len = objArray.length; arrayOfSysCluster = new ICFSecuritySysClusterObj[len]; for (int i = 0; i < len; i++) { arrayOfSysCluster[i] = (ICFSecuritySysClusterObj) objArray[i]; } Arrays.sort(arrayOfSysCluster, compareSysClusterByQualName); } } } }
public void setSwingDataCollection(Collection<ICFBamIndexObj> value) { final String S_ProcName = "setSwingDataCollection"; swingDataCollection = value; if (swingDataCollection == null) { arrayOfIndex = new ICFBamIndexObj[0]; } else { int len = value.size(); arrayOfIndex = new ICFBamIndexObj[len]; Iterator<ICFBamIndexObj> iter = swingDataCollection.iterator(); int idx = 0; while (iter.hasNext() && (idx < len)) { arrayOfIndex[idx++] = iter.next(); } if (idx < len) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Collection iterator did not fully populate the array copy"); } if (iter.hasNext()) { throw CFLib.getDefaultExceptionFactory() .newRuntimeException( getClass(), S_ProcName, "Collection iterator had left over items when done populating array copy"); } Arrays.sort(arrayOfIndex, compareIndexByQualName); } PickerTableModel tblDataModel = getDataModel(); if (tblDataModel != null) { tblDataModel.fireTableDataChanged(); } }
public List<ICFSecuritySecGroupIncludeObj> readSecGroupIncludeByIncludeIdx( long ClusterId, int IncludeGroupId, boolean forceRead) { final String S_ProcName = "readSecGroupIncludeByIncludeIdx"; CFSecuritySecGroupIncludeByIncludeIdxKey key = ((ICFInternetSchema) schema.getBackingStore()) .getFactorySecGroupInclude() .newIncludeIdxKey(); key.setRequiredClusterId(ClusterId); key.setRequiredIncludeGroupId(IncludeGroupId); Map<CFSecuritySecGroupIncludePKey, ICFSecuritySecGroupIncludeObj> dict; if (indexByIncludeIdx == null) { indexByIncludeIdx = new HashMap< CFSecuritySecGroupIncludeByIncludeIdxKey, Map<CFSecuritySecGroupIncludePKey, ICFSecuritySecGroupIncludeObj>>(); } if ((!forceRead) && indexByIncludeIdx.containsKey(key)) { dict = indexByIncludeIdx.get(key); } else { dict = new HashMap<CFSecuritySecGroupIncludePKey, ICFSecuritySecGroupIncludeObj>(); // Allow other threads to dirty-read while we're loading indexByIncludeIdx.put(key, dict); ICFSecuritySecGroupIncludeObj obj; CFSecuritySecGroupIncludeBuff[] buffList = ((ICFInternetSchema) schema.getBackingStore()) .getTableSecGroupInclude() .readDerivedByIncludeIdx(schema.getAuthorization(), ClusterId, IncludeGroupId); CFSecuritySecGroupIncludeBuff buff; for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; obj = schema.getSecGroupIncludeTableObj().newInstance(); obj.setPKey( ((ICFInternetSchema) schema.getBackingStore()).getFactorySecGroupInclude().newPKey()); obj.setBuff(buff); ICFSecuritySecGroupIncludeObj realized = (ICFSecuritySecGroupIncludeObj) obj.realize(); } } Comparator<ICFSecuritySecGroupIncludeObj> cmp = new Comparator<ICFSecuritySecGroupIncludeObj>() { public int compare(ICFSecuritySecGroupIncludeObj lhs, ICFSecuritySecGroupIncludeObj rhs) { if (lhs == null) { if (rhs == null) { return (0); } else { return (-1); } } else if (rhs == null) { return (1); } else { CFSecuritySecGroupIncludePKey lhsPKey = lhs.getPKey(); CFSecuritySecGroupIncludePKey rhsPKey = rhs.getPKey(); int ret = lhsPKey.compareTo(rhsPKey); return (ret); } } }; int len = dict.size(); ICFSecuritySecGroupIncludeObj arr[] = new ICFSecuritySecGroupIncludeObj[len]; Iterator<ICFSecuritySecGroupIncludeObj> 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<ICFSecuritySecGroupIncludeObj> arrayList = new ArrayList<ICFSecuritySecGroupIncludeObj>(len); for (idx = 0; idx < len; idx++) { arrayList.add(arr[idx]); } List<ICFSecuritySecGroupIncludeObj> sortedList = arrayList; return (sortedList); }
public List<ICFSecuritySecGroupIncludeObj> readAllSecGroupInclude(boolean forceRead) { final String S_ProcName = "readAllSecGroupInclude"; if ((allSecGroupInclude == null) || forceRead) { Map<CFSecuritySecGroupIncludePKey, ICFSecuritySecGroupIncludeObj> map = new HashMap<CFSecuritySecGroupIncludePKey, ICFSecuritySecGroupIncludeObj>(); allSecGroupInclude = map; CFSecuritySecGroupIncludeBuff[] buffList = ((ICFInternetSchema) schema.getBackingStore()) .getTableSecGroupInclude() .readAllDerived(schema.getAuthorization()); CFSecuritySecGroupIncludeBuff buff; ICFSecuritySecGroupIncludeObj obj; for (int idx = 0; idx < buffList.length; idx++) { buff = buffList[idx]; obj = newInstance(); obj.setPKey( ((ICFInternetSchema) schema.getBackingStore()).getFactorySecGroupInclude().newPKey()); obj.setBuff(buff); ICFSecuritySecGroupIncludeObj realized = (ICFSecuritySecGroupIncludeObj) obj.realize(); } } Comparator<ICFSecuritySecGroupIncludeObj> cmp = new Comparator<ICFSecuritySecGroupIncludeObj>() { public int compare(ICFSecuritySecGroupIncludeObj lhs, ICFSecuritySecGroupIncludeObj rhs) { if (lhs == null) { if (rhs == null) { return (0); } else { return (-1); } } else if (rhs == null) { return (1); } else { CFSecuritySecGroupIncludePKey lhsPKey = lhs.getPKey(); CFSecuritySecGroupIncludePKey rhsPKey = rhs.getPKey(); int ret = lhsPKey.compareTo(rhsPKey); return (ret); } } }; int len = allSecGroupInclude.size(); ICFSecuritySecGroupIncludeObj arr[] = new ICFSecuritySecGroupIncludeObj[len]; Iterator<ICFSecuritySecGroupIncludeObj> valIter = allSecGroupInclude.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<ICFSecuritySecGroupIncludeObj> arrayList = new ArrayList<ICFSecuritySecGroupIncludeObj>(len); for (idx = 0; idx < len; idx++) { arrayList.add(arr[idx]); } List<ICFSecuritySecGroupIncludeObj> sortedList = arrayList; return (sortedList); }