Vojtech Szocs has posted comments on this change.

Change subject: aaa: Fixing search to search by authz
......................................................................


Patch Set 5:

(3 comments)

http://gerrit.ovirt.org/#/c/28722/5/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetAAAProfileListQuery.java
File 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetAAAProfileListQuery.java:

Line 27:         Collections.sort(names, new Comparator<ProfileEntry>() {
Line 28: 
Line 29:             @Override
Line 30:             public int compare(ProfileEntry lhs, ProfileEntry rhs) {
Line 31:                 return lhs.getProfile().compareTo(rhs.getProfile()) == 
0 ?
I think it should be != 0 rather than == 0 within this ternary operator's 
condition.

You could also extract logical comparisons as variables for better readability, 
for example:

 int profileComparison = lhs.getProfile().compareTo(rhs.getProfile());
 int authzComparison = lhs.getAuthz().compareTo(rhs.getAuthz());
 return profileComparison != 0 ? profileComparison : authzComparison;
Line 32:                         lhs.getProfile().compareTo(rhs.getProfile())
Line 33:                         : lhs.getAuthz().compareTo(rhs.getAuthz());
Line 34: 
Line 35:             }


http://gerrit.ovirt.org/#/c/28722/5/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/aaa/ProfileEntry.java
File 
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/aaa/ProfileEntry.java:

Line 23:     public String getProfile() {
Line 24:         return profile;
Line 25:     }
Line 26: 
Line 27:     public void setProfile(String profile) {
> I didn't see this was used, consider removing it or limiting access to priv
I think it's better to aim for immutable classes if possible.

In other words, reduce mutable state to essential minimum.

For example:

 private final String foo;

 protected MyClass() {
     this(null);
 }

 public MyClass(String foo) {
     this.foo = foo;
 }

 public String getFoo() {
     return foo;
 }

It's up to you to consider :-)
Line 28:         this.profile = profile;
Line 29:     }
Line 30: 
Line 31:     public String getAuthz() {


Line 36:         this.authz = authz;
Line 37:     }
Line 38: 
Line 39:     public String toString() {
Line 40:         return profile + " (" + authz + ")"; //$NON-NLS-1$
I think you're missing //$NON-NLS-2$ for the second String literal ")".
Line 41:     }
Line 42: 


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

Gerrit-MessageType: comment
Gerrit-Change-Id: Ic1867577a900e2c7a815d443b771e2576bd8aea2
Gerrit-PatchSet: 5
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Yair Zaslavsky <yzasl...@redhat.com>
Gerrit-Reviewer: Alon Bar-Lev <alo...@redhat.com>
Gerrit-Reviewer: Lior Vernia <lver...@redhat.com>
Gerrit-Reviewer: Vojtech Szocs <vsz...@redhat.com>
Gerrit-Reviewer: Yair Zaslavsky <yzasl...@redhat.com>
Gerrit-Reviewer: automat...@ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to