diff --git a/src/main/java/sh/libre/scim/core/ScimClient.java b/src/main/java/sh/libre/scim/core/ScimClient.java index 33b98c4928..84afe5de73 100644 --- a/src/main/java/sh/libre/scim/core/ScimClient.java +++ b/src/main/java/sh/libre/scim/core/ScimClient.java @@ -99,19 +99,19 @@ public class ScimClient { return session.getContext().getRealm().getId(); } - protected > A getAdapter( - Class aClass) { + protected > A newAdapter( + Class adapterClass) { try { - return aClass.getDeclaredConstructor(KeycloakSession.class, String.class) + return adapterClass.getDeclaredConstructor(KeycloakSession.class, String.class) .newInstance(session, this.model.getId()); } catch (Exception e) { throw new RuntimeException(e); } } - public > void create(Class aClass, + public > void create(Class adapterClass, M kcModel) { - A adapter = getAdapter(aClass); + A adapter = newAdapter(adapterClass); adapter.apply(kcModel); if (adapter.skip) return; @@ -141,9 +141,9 @@ public class ScimClient { adapter.saveMapping(); } - public > void replace(Class aClass, + public > void replace(Class adapterClass, M kcModel) { - A adapter = getAdapter(aClass); + A adapter = newAdapter(adapterClass); try { adapter.apply(kcModel); if (adapter.skip) @@ -172,9 +172,9 @@ public class ScimClient { } } - public > void delete(Class aClass, + public > void delete(Class adapterClass, String id) { - A adapter = getAdapter(aClass); + A adapter = newAdapter(adapterClass); adapter.setId(id); try { @@ -205,21 +205,21 @@ public class ScimClient { } public > void refreshResources( - Class aClass, + Class adapterClass, SynchronizationResult syncRes) { LOGGER.info("Refresh resources"); - getAdapter(aClass).getResourceStream().forEach(resource -> { - A adapter = getAdapter(aClass); + newAdapter(adapterClass).getResourceStream().forEach(resource -> { + A adapter = newAdapter(adapterClass); adapter.apply(resource); LOGGER.infof("Reconciling local resource %s", adapter.getId()); if (!adapter.skipRefresh()) { ScimResource mapping = adapter.getMapping(); if (mapping == null) { LOGGER.info("Creating it"); - this.create(aClass, resource); + this.create(adapterClass, resource); } else { LOGGER.info("Replacing it"); - this.replace(aClass, resource); + this.replace(adapterClass, resource); } syncRes.increaseUpdated(); } @@ -228,17 +228,17 @@ public class ScimClient { } public > void importResources( - Class aClass, SynchronizationResult syncRes) { + Class adapterClass, SynchronizationResult syncRes) { LOGGER.info("Import"); try { - A adapter = getAdapter(aClass); + A adapter = newAdapter(adapterClass); ServerResponse> response = scimRequestBuilder.list(adapter.getResourceClass(), adapter.getScimEndpoint()).get().sendRequest(); ListResponse resourceTypeListResponse = response.getResource(); for (S resource : resourceTypeListResponse.getListedResources()) { try { LOGGER.infof("Reconciling remote resource %s", resource); - adapter = getAdapter(aClass); + adapter = newAdapter(adapterClass); adapter.apply(resource); ScimResource mapping = adapter.getMapping();