fixed some find bugs issues

This commit is contained in:
anhefti 2019-03-07 13:19:30 +01:00
parent bfd25c9885
commit 3cd18d0797
2 changed files with 21 additions and 14 deletions

View file

@ -8,6 +8,7 @@
package ch.ethz.seb.sebserver.gui.service.page.impl; package ch.ethz.seb.sebserver.gui.service.page.impl;
import java.io.Serializable;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Comparator; import java.util.Comparator;
import java.util.HashMap; import java.util.HashMap;
@ -344,9 +345,9 @@ public class PageContextImpl implements PageContext {
+ "]"; + "]";
} }
private final class ConfirmDialogCallback implements DialogCallback { private static final class ConfirmDialogCallback implements DialogCallback {
private static final long serialVersionUID = 1491270214433492441L; private static final long serialVersionUID = 1491270214433492441L;
private transient final Runnable onOK; private final Runnable onOK;
private ConfirmDialogCallback(final Runnable onOK) { private ConfirmDialogCallback(final Runnable onOK) {
this.onOK = onOK; this.onOK = onOK;
@ -366,7 +367,10 @@ public class PageContextImpl implements PageContext {
} }
} }
private static final class ListenerComparator implements Comparator<PageEventListener<?>> { private static final class ListenerComparator implements Comparator<PageEventListener<?>>, Serializable {
private static final long serialVersionUID = 2571739214439340404L;
@Override @Override
public int compare(final PageEventListener<?> o1, final PageEventListener<?> o2) { public int compare(final PageEventListener<?> o1, final PageEventListener<?> o2) {
final int x = o1.priority(); final int x = o1.priority();

View file

@ -166,6 +166,10 @@ public class CurrentUser {
} }
} }
private static final ParameterizedTypeReference<Collection<Privilege>> PRIVILEGE_LIST_TYPE_REF =
new ParameterizedTypeReference<>() {
};
private boolean loadPrivileges() { private boolean loadPrivileges() {
if (this.privileges != null) { if (this.privileges != null) {
return true; return true;
@ -183,8 +187,7 @@ public class CurrentUser {
.toUriString(), .toUriString(),
HttpMethod.GET, HttpMethod.GET,
HttpEntity.EMPTY, HttpEntity.EMPTY,
new ParameterizedTypeReference<Collection<Privilege>>() { PRIVILEGE_LIST_TYPE_REF);
});
if (exchange.getStatusCodeValue() == HttpStatus.OK.value()) { if (exchange.getStatusCodeValue() == HttpStatus.OK.value()) {
this.privileges = exchange.getBody().stream() this.privileges = exchange.getBody().stream()
@ -223,42 +226,42 @@ public class CurrentUser {
} }
/** Checks the base read-only privilege grant /** Checks the base read-only privilege grant
* *
* @return true on read-only privilege grant on wrapped EntityType */ * @return true on read-only privilege grant on wrapped EntityType */
public boolean r() { public boolean r() {
return hasBasePrivilege(PrivilegeType.READ_ONLY, this.entityType); return hasBasePrivilege(PrivilegeType.READ_ONLY, this.entityType);
} }
/** Checks the base modify privilege grant /** Checks the base modify privilege grant
* *
* @return true on modify privilege grant on wrapped EntityType */ * @return true on modify privilege grant on wrapped EntityType */
public boolean m() { public boolean m() {
return hasBasePrivilege(PrivilegeType.MODIFY, this.entityType); return hasBasePrivilege(PrivilegeType.MODIFY, this.entityType);
} }
/** Checks the base write privilege grant /** Checks the base write privilege grant
* *
* @return true on write privilege grant on wrapped EntityType */ * @return true on write privilege grant on wrapped EntityType */
public boolean w() { public boolean w() {
return hasBasePrivilege(PrivilegeType.WRITE, this.entityType); return hasBasePrivilege(PrivilegeType.WRITE, this.entityType);
} }
/** Checks the institutional read-only privilege grant /** Checks the institutional read-only privilege grant
* *
* @return true institutional read-only privilege grant on wrapped EntityType */ * @return true institutional read-only privilege grant on wrapped EntityType */
public boolean ir() { public boolean ir() {
return hasInstitutionalPrivilege(PrivilegeType.READ_ONLY, this.entityType); return hasInstitutionalPrivilege(PrivilegeType.READ_ONLY, this.entityType);
} }
/** Checks the institutional modify privilege grant /** Checks the institutional modify privilege grant
* *
* @return true institutional modify privilege grant on wrapped EntityType */ * @return true institutional modify privilege grant on wrapped EntityType */
public boolean im() { public boolean im() {
return hasInstitutionalPrivilege(PrivilegeType.MODIFY, this.entityType); return hasInstitutionalPrivilege(PrivilegeType.MODIFY, this.entityType);
} }
/** Checks the institutional write privilege grant /** Checks the institutional write privilege grant
* *
* @return true institutional write privilege grant on wrapped EntityType */ * @return true institutional write privilege grant on wrapped EntityType */
public boolean iw() { public boolean iw() {
return hasInstitutionalPrivilege(PrivilegeType.WRITE, this.entityType); return hasInstitutionalPrivilege(PrivilegeType.WRITE, this.entityType);
@ -274,21 +277,21 @@ public class CurrentUser {
} }
/** Checks the read-only privilege grant for wrapped grantEntity /** Checks the read-only privilege grant for wrapped grantEntity
* *
* @return true on read-only privilege grant for wrapped grantEntity */ * @return true on read-only privilege grant for wrapped grantEntity */
public boolean r() { public boolean r() {
return hasPrivilege(PrivilegeType.READ_ONLY, this.grantEntity); return hasPrivilege(PrivilegeType.READ_ONLY, this.grantEntity);
} }
/** Checks the modify privilege grant for wrapped grantEntity /** Checks the modify privilege grant for wrapped grantEntity
* *
* @return true on modify privilege grant for wrapped grantEntity */ * @return true on modify privilege grant for wrapped grantEntity */
public boolean m() { public boolean m() {
return hasPrivilege(PrivilegeType.MODIFY, this.grantEntity); return hasPrivilege(PrivilegeType.MODIFY, this.grantEntity);
} }
/** Checks the write privilege grant for wrapped grantEntity /** Checks the write privilege grant for wrapped grantEntity
* *
* @return true on write privilege grant for wrapped grantEntity */ * @return true on write privilege grant for wrapped grantEntity */
public boolean w() { public boolean w() {
return hasPrivilege(PrivilegeType.WRITE, this.grantEntity); return hasPrivilege(PrivilegeType.WRITE, this.grantEntity);