Check emptyness not size
This commit is contained in:
parent
f2464bbc00
commit
10ff5787f0
3 changed files with 5 additions and 4 deletions
|
@ -4,6 +4,7 @@ import de.captaingoldfish.scim.sdk.common.resources.Group;
|
|||
import de.captaingoldfish.scim.sdk.common.resources.complex.Meta;
|
||||
import de.captaingoldfish.scim.sdk.common.resources.multicomplex.Member;
|
||||
import jakarta.persistence.NoResultException;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.BooleanUtils;
|
||||
import org.jboss.logging.Logger;
|
||||
import org.keycloak.models.GroupModel;
|
||||
|
@ -60,7 +61,7 @@ public class GroupAdapter extends Adapter<GroupModel, Group> {
|
|||
setExternalId(group.getId().get());
|
||||
setDisplayName(group.getDisplayName().get());
|
||||
List<Member> groupMembers = group.getMembers();
|
||||
if (groupMembers != null && groupMembers.size() > 0) {
|
||||
if (CollectionUtils.isNotEmpty(groupMembers)) {
|
||||
this.members = new HashSet<>();
|
||||
for (Member groupMember : groupMembers) {
|
||||
try {
|
||||
|
@ -80,7 +81,7 @@ public class GroupAdapter extends Adapter<GroupModel, Group> {
|
|||
group.setId(externalId);
|
||||
group.setExternalId(id);
|
||||
group.setDisplayName(displayName);
|
||||
if (members.size() > 0) {
|
||||
if (!members.isEmpty()) {
|
||||
for (String member : members) {
|
||||
Member groupMember = new Member();
|
||||
try {
|
||||
|
|
|
@ -116,7 +116,7 @@ public class ScimClient {
|
|||
if (adapter.skip)
|
||||
return;
|
||||
// If mapping exist then it was created by import so skip.
|
||||
if (adapter.query("findById", adapter.getId()).getResultList().size() != 0) {
|
||||
if (!adapter.query("findById", adapter.getId()).getResultList().isEmpty()) {
|
||||
return;
|
||||
}
|
||||
Retry retry = registry.retry("create-" + adapter.getId());
|
||||
|
|
|
@ -139,7 +139,7 @@ public class UserAdapter extends Adapter<UserModel, User> {
|
|||
setUsername(user.getUserName().get());
|
||||
setDisplayName(user.getDisplayName().get());
|
||||
setActive(user.isActive().get());
|
||||
if (user.getEmails().size() > 0) {
|
||||
if (!user.getEmails().isEmpty()) {
|
||||
setEmail(user.getEmails().get(0).getValue().get());
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue