public static RemedyElementCategory[] requestToRemedyElementsCategories(Remedy remedy) { List<RemedyElementCategory> categories = new ArrayList<RemedyElementCategory>(); RemedyElementCategory categoryAdded = new RemedyElementCategory(ProvUIMessages.RemedyCategoryAdded); RemedyElementCategory cateogyRemoved = new RemedyElementCategory(ProvUIMessages.RemedyCategoryRemoved); RemedyElementCategory categoryNotAdded = new RemedyElementCategory(ProvUIMessages.RemedyCategoryNotAdded); RemedyElementCategory categoryChanged = new RemedyElementCategory(ProvUIMessages.RemedyCategoryChanged); for (Iterator<RemedyIUDetail> iterator = remedy.getIusDetails().iterator(); iterator.hasNext(); ) { RemedyIUDetail remedyIUVersions = iterator.next(); if (remedyIUVersions.getStatus() == RemedyIUDetail.STATUS_ADDED) categoryAdded.add(remedyIUVersions); else if (remedyIUVersions.getStatus() == RemedyIUDetail.STATUS_CHANGED) categoryChanged.add(remedyIUVersions); else if (remedyIUVersions.getStatus() == RemedyIUDetail.STATUS_REMOVED) cateogyRemoved.add(remedyIUVersions); else if (remedyIUVersions.getStatus() == RemedyIUDetail.STATUS_NOT_ADDED) categoryNotAdded.add(remedyIUVersions); } if (cateogyRemoved.getElements().size() > 0) categories.add(cateogyRemoved); if (categoryChanged.getElements().size() > 0) categories.add(categoryChanged); if (categoryNotAdded.getElements().size() > 0) categories.add(categoryNotAdded); if (categoryAdded.getElements().size() > 0) categories.add(categoryAdded); return categories.toArray(new RemedyElementCategory[categories.size()]); }
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()]); }