Alexander Wels has posted comments on this change.

Change subject: HostGeneralModel: improve "node has upgrade" logic
......................................................................


Patch Set 1: (1 inline comment)

....................................................
File 
frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostGeneralModel.java
Line 1082:                             ArrayList<RpmVersion> isos = 
(ArrayList<RpmVersion>) returnValue;
Line 1083:                             if (isos.size() > 0)
Line 1084:                             {
Line 1085:                                 VDS vds = 
hostGeneralModel.getEntity();
Line 1086:                                 DateTimeFormat format = 
DateTimeFormat.getFormat("yyyyMMdd"); //$NON-NLS-1$
I highly suggest you take this code and put it in its own method. Something like
 boolean shouldAlertUpgrade(List<RpmVersion>isos, String hostOs) {
  stuff
 }
 This method returns a boolean so you can call it from here like this:
hostGeneralModel.setHasUpgradeAlert(shouldAlertUpgrade(isos, vds.getHostOs());

 This has a couple of advantages:
1. This method is already large and adding a huge chunk of code to it doesn't 
help the  readability or maintainability.
2. The new method is small and should be relatively easy to unit test so we can 
make  sure that the provided functionality is what we expect.
Line 1087:                                 String nodeInfo[] = 
vds.getHostOs().split("-"); //$NON-NLS-1$
Line 1088:                                 String formattedISOVersion;
Line 1089:                                 for (RpmVersion iso: isos) {
Line 1090:                                     try {


-- 
To view, visit http://gerrit.ovirt.org/16089
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I49c74d3d0d92c74848e0c175095610b6e6b5a88e
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Douglas Schilling Landgraf <[email protected]>
Gerrit-Reviewer: Alexander Wels <[email protected]>
Gerrit-Reviewer: Barak Azulay <[email protected]>
Gerrit-Reviewer: Doron Fediuck <[email protected]>
Gerrit-Reviewer: Douglas Schilling Landgraf <[email protected]>
Gerrit-Reviewer: Vojtech Szocs <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to