@@ -170,20 +170,8 @@ public List<AruPatch> getRecommendedPatches(FmwInstallerType type, String versio
170170 String userId , String password ) throws AruException {
171171 List <AruPatch > result = new ArrayList <>();
172172 for (AruProduct product : type .products ()) {
173- List <AruPatch > patches = getRecommendedPatches (product , version , userId , password );
174- // temporary, until OHS stops using same release number and product ID for two different installs
175- if (type == FmwInstallerType .OHS_DB19 ) {
176- if (product == AruProduct .OHS ) {
177- patches = patches .stream ().filter (p -> p .description ().contains (" DB19C " ))
178- .collect (Collectors .toList ());
179- } else if (product == AruProduct .OAM_WG ) {
180- patches = patches .stream ().filter (p -> p .description ().contains (" DB19c " ))
181- .collect (Collectors .toList ());
182- } else if (product == AruProduct .OSS ) {
183- patches = patches .stream ().filter (p -> p .description ().contains (" 19C " ))
184- .collect (Collectors .toList ());
185- }
186- }
173+ List <AruPatch > patches = getRecommendedPatches (type , product , version , userId , password );
174+
187175 if (!patches .isEmpty ()) {
188176 patches .forEach (p -> logger .info ("IMG-0068" , product .description (), p .patchId (), p .description ()));
189177 result .addAll (patches );
@@ -205,8 +193,8 @@ public List<AruPatch> getRecommendedPatches(FmwInstallerType type, String versio
205193 * @return the recommended patches for the given product and version
206194 * @throws AruException when response from ARU has an error or fails
207195 */
208- List <AruPatch > getRecommendedPatches (AruProduct product , String version , String userId , String password )
209- throws AruException {
196+ List <AruPatch > getRecommendedPatches (FmwInstallerType type , AruProduct product , String version ,
197+ String userId , String password ) throws AruException {
210198 logger .entering (product , version );
211199 List <AruPatch > patches = Collections .emptyList ();
212200 try {
@@ -218,6 +206,12 @@ List<AruPatch> getRecommendedPatches(AruProduct product, String version, String
218206 } else {
219207 // Get a list of patches applicable to the given product and release number
220208 patches = getReleaseRecommendations (product , releaseNumber , userId , password );
209+ logger .fine ("Search for {0} recommended patches returned {1}" , product , patches .size ());
210+ if (type == FmwInstallerType .OHS_DB19 ) {
211+ // Workaround for OHS where the DB19 patches and the DB12 patches have the same product/release ID
212+ patches = filterDb19Patches (patches , product );
213+ }
214+
221215 String psuVersion = getPsuVersion (product .description (), patches );
222216 if (psuVersion != null ) {
223217 // Check to see if there is a release with the PSU version that contains overlay patches.
@@ -227,11 +221,11 @@ List<AruPatch> getRecommendedPatches(AruProduct product, String version, String
227221 String psuReleaseNumber = getReleaseNumber (product , psuVersion , userId , password );
228222 // If there is a release for the specific PSU, check it for overlay patches
229223 if (!Utils .isEmptyString (psuReleaseNumber )) {
230- // Debug log - useful to know what was thrown away when "patches" is replaced by the new array
231- patches .forEach (p -> logger .fine ("Discarding recommended patch {0} {1}" ,
232- p .patchId (), p .description ()));
233224 // Get recommended patches for PSU release (includes PSU overlay patches)
234- patches = getReleaseRecommendations (product , psuReleaseNumber , userId , password );
225+ List <AruPatch > overlays =
226+ getReleaseRecommendations (product , psuReleaseNumber , userId , password );
227+ logger .fine ("Search for PSU {0} overlay patches returned {1}" , psuVersion , overlays .size ());
228+ patches .addAll (overlays );
235229 } else {
236230 // ARU does not have a release number for the PSU version found (no overlays needed)
237231 logger .fine ("PSU release was not found for {0} : {1}" , product , psuVersion );
@@ -247,6 +241,25 @@ List<AruPatch> getRecommendedPatches(AruProduct product, String version, String
247241 return patches ;
248242 }
249243
244+ /**
245+ * This is a temporary workaround to select DB19 patches from a recommended list of patches.
246+ * Currently, OHS is using the same release number and product ID for two different installs (DB19 and DB12).
247+ * @param patches patches list to filter
248+ * @param product AruProduct that the supplied patches are for
249+ */
250+ private List <AruPatch > filterDb19Patches (List <AruPatch > patches , AruProduct product ) {
251+ List <AruPatch > result = patches ;
252+ // temporary, until OHS stops using same release number and product ID for two different installs
253+ if (product == AruProduct .OHS ) {
254+ result = patches .stream ().filter (p -> p .description ().contains (" DB19C " )).collect (Collectors .toList ());
255+ } else if (product == AruProduct .OAM_WG ) {
256+ result = patches .stream ().filter (p -> p .description ().contains (" DB19c " )).collect (Collectors .toList ());
257+ } else if (product == AruProduct .OSS ) {
258+ result = patches .stream ().filter (p -> p .description ().contains (" 19C " )).collect (Collectors .toList ());
259+ }
260+ return result ;
261+ }
262+
250263 private String getPsuVersion (String productName , Collection <AruPatch > patches ) {
251264 String psuBundle = patches .stream ()
252265 .map (AruPatch ::psuBundle )
@@ -270,6 +283,7 @@ List<AruPatch> getReleaseRecommendations(AruProduct product, String releaseNumbe
270283 .filter (not (AruPatch ::isStackPatchBundle )) // remove the Stack Patch Bundle patch, if returned
271284 // TODO: Need an option for the user to request the Coherence additional feature pack.
272285 .filter (not (AruPatch ::isCoherenceFeaturePack )) // remove the Coherence feature pack, if returned
286+ .filter (p -> p .release ().equals (releaseNumber ))
273287 .collect (Collectors .toList ());
274288 }
275289
0 commit comments