public static List<IInstallableUnit> elementsToIUs(Object[] elements) { ArrayList<IInstallableUnit> theIUs = new ArrayList<IInstallableUnit>(elements.length); for (int i = 0; i < elements.length; i++) { IInstallableUnit iu = ProvUI.getAdapter(elements[i], IInstallableUnit.class); if (iu != null) theIUs.add(iu); } return theIUs; }
public static AvailableIUElement[] requestToElement(Remedy remedy, boolean installMode) { if (remedy == null) return new AvailableIUElement[0]; ArrayList<AvailableIUElement> temp = new ArrayList<AvailableIUElement>(); IUElementListRoot root = new IUElementListRoot(); for (Iterator<RemedyIUDetail> iterator = remedy.getIusDetails().iterator(); iterator.hasNext(); ) { RemedyIUDetail iuDetail = iterator.next(); if (iuDetail.getStatus() == RemedyIUDetail.STATUS_NOT_ADDED) continue; AvailableIUElement element = new AvailableIUElement( root, iuDetail.getIu(), ProvisioningUI.getDefaultUI().getProfileId(), true); if (iuDetail.getBeingInstalledVersion() != null && iuDetail.getRequestedVersion() != null && iuDetail.getBeingInstalledVersion().compareTo(iuDetail.getRequestedVersion()) < 0 && !installMode) element.setImageOverlayId(ProvUIImages.IMG_INFO); else if (iuDetail.getStatus() == RemedyIUDetail.STATUS_REMOVED) element.setImageId(ProvUIImages.IMG_REMOVED); temp.add(element); } return temp.toArray(new AvailableIUElement[temp.size()]); }