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.stereotype.Service;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
|
@ -169,15 +170,18 @@ public class RegistryCalls implements AaiRegistryService {
|
|||
@Override
|
||||
public JsonArray getRolesWithStatus(Integer coPersonId, RoleStatus status) {
|
||||
JsonArray roles = getRoles(coPersonId);
|
||||
if (status == null) {
|
||||
return roles;
|
||||
if (roles == null) {
|
||||
roles = new JsonArray();
|
||||
}
|
||||
JsonArray activeRoles = new JsonArray();
|
||||
for (JsonElement role : roles) {
|
||||
if (role.getAsJsonObject().get("Status").getAsString().equalsIgnoreCase(status.toString())) {
|
||||
activeRoles.add(role);
|
||||
if (status != null) {
|
||||
for (JsonElement role : roles) {
|
||||
if (role.getAsJsonObject().get("Status").getAsString().equalsIgnoreCase(status.toString())) {
|
||||
activeRoles.add(role);
|
||||
}
|
||||
}
|
||||
}
|
||||
assert activeRoles != null;
|
||||
return activeRoles;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue