getRolesWithStatus does not return null
This commit is contained in:
parent
cda2cd5557
commit
95335461a2
|
@ -16,6 +16,7 @@ import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.security.core.context.SecurityContextHolder;
|
import org.springframework.security.core.context.SecurityContextHolder;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -169,15 +170,18 @@ public class RegistryCalls implements AaiRegistryService {
|
||||||
@Override
|
@Override
|
||||||
public JsonArray getRolesWithStatus(Integer coPersonId, RoleStatus status) {
|
public JsonArray getRolesWithStatus(Integer coPersonId, RoleStatus status) {
|
||||||
JsonArray roles = getRoles(coPersonId);
|
JsonArray roles = getRoles(coPersonId);
|
||||||
if (status == null) {
|
if (roles == null) {
|
||||||
return roles;
|
roles = new JsonArray();
|
||||||
}
|
}
|
||||||
JsonArray activeRoles = new JsonArray();
|
JsonArray activeRoles = new JsonArray();
|
||||||
for (JsonElement role : roles) {
|
if (status != null) {
|
||||||
if (role.getAsJsonObject().get("Status").getAsString().equalsIgnoreCase(status.toString())) {
|
for (JsonElement role : roles) {
|
||||||
activeRoles.add(role);
|
if (role.getAsJsonObject().get("Status").getAsString().equalsIgnoreCase(status.toString())) {
|
||||||
|
activeRoles.add(role);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
assert activeRoles != null;
|
||||||
return activeRoles;
|
return activeRoles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue