related to bug 32375: preferences incorrectly resolve client visibility
authorAsier Lostalé <asier.lostale@openbravo.com>
Fri, 04 Mar 2016 08:45:40 +0100
changeset 28825 6a656a96298b
parent 28823 617c4ab81da2
child 28826 bc3e4c65d7b1
related to bug 32375: preferences incorrectly resolve client visibility

Small code clean up:
-isHigherPriority renamed to getHighestPriority: by convention is* are boolean
getters which was not the case of this one
-removed unneded brackets in condition which didn't help to make the code more
readable
src/org/openbravo/erpCommon/businessUtility/Preferences.java
--- a/src/org/openbravo/erpCommon/businessUtility/Preferences.java	Thu Feb 11 13:03:59 2016 +0100
+++ b/src/org/openbravo/erpCommon/businessUtility/Preferences.java	Fri Mar 04 08:45:40 2016 +0100
@@ -11,7 +11,7 @@
  * under the License. 
  * The Original Code is Openbravo ERP. 
  * The Initial Developer of the Original Code is Openbravo SLU 
- * All portions are Copyright (C) 2010-2015 Openbravo SLU 
+ * All portions are Copyright (C) 2010-2016 Openbravo SLU
  * All Rights Reserved. 
  * Contributor(s):  ______________________________________.
  ************************************************************************
@@ -72,7 +72,7 @@
         } else {
           // There is a preference for the current property, check whether it is higher priority and
           // if so replace it. In case of conflict leave current preference.
-          if (isHigherPriority(pref, existentPreference, parentTree) == 1) {
+          if (getHighestPriority(pref, existentPreference, parentTree) == 1) {
             preferences.remove(existentPreference);
             preferences.add(pref);
           }
@@ -196,7 +196,7 @@
           selectedPreference = preference;
           continue;
         }
-        int higherPriority = isHigherPriority(selectedPreference, preference, parentTree);
+        int higherPriority = getHighestPriority(selectedPreference, preference, parentTree);
         switch (higherPriority) {
         case 1:
           // do nothing, selected one has higher priority
@@ -487,7 +487,7 @@
    *         <li>0 in case of conflict (both have identical visibility and value)
    *         </ul>
    */
-  private static int isHigherPriority(Preference pref1, Preference pref2, List<String> parentTree) {
+  private static int getHighestPriority(Preference pref1, Preference pref2, List<String> parentTree) {
     // Check priority by client
     if ((pref2.getVisibleAtClient() == null || pref2.getVisibleAtClient().getId().equals("0"))
         && pref1.getVisibleAtClient() != null && !pref1.getVisibleAtClient().getId().equals("0")) {
@@ -501,7 +501,7 @@
       return 1;
     }
 
-    if ((org1 == null && org2 != null)) {
+    if (org1 == null && org2 != null) {
       return 2;
     }