Rename variable
This commit is contained in:
parent
2ed6f1a16d
commit
f2464bbc00
1 changed files with 17 additions and 17 deletions
|
@ -99,19 +99,19 @@ public class ScimClient {
|
|||
return session.getContext().getRealm().getId();
|
||||
}
|
||||
|
||||
protected <M extends RoleMapperModel, S extends ResourceNode, A extends Adapter<M, S>> A getAdapter(
|
||||
Class<A> aClass) {
|
||||
protected <M extends RoleMapperModel, S extends ResourceNode, A extends Adapter<M, S>> A newAdapter(
|
||||
Class<A> 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 <M extends RoleMapperModel, S extends ResourceNode, A extends Adapter<M, S>> void create(Class<A> aClass,
|
||||
public <M extends RoleMapperModel, S extends ResourceNode, A extends Adapter<M, S>> void create(Class<A> 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 <M extends RoleMapperModel, S extends ResourceNode, A extends Adapter<M, S>> void replace(Class<A> aClass,
|
||||
public <M extends RoleMapperModel, S extends ResourceNode, A extends Adapter<M, S>> void replace(Class<A> 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 <M extends RoleMapperModel, S extends ResourceNode, A extends Adapter<M, S>> void delete(Class<A> aClass,
|
||||
public <M extends RoleMapperModel, S extends ResourceNode, A extends Adapter<M, S>> void delete(Class<A> adapterClass,
|
||||
String id) {
|
||||
A adapter = getAdapter(aClass);
|
||||
A adapter = newAdapter(adapterClass);
|
||||
adapter.setId(id);
|
||||
|
||||
try {
|
||||
|
@ -205,21 +205,21 @@ public class ScimClient {
|
|||
}
|
||||
|
||||
public <M extends RoleMapperModel, S extends ResourceNode, A extends Adapter<M, S>> void refreshResources(
|
||||
Class<A> aClass,
|
||||
Class<A> 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 <M extends RoleMapperModel, S extends ResourceNode, A extends Adapter<M, S>> void importResources(
|
||||
Class<A> aClass, SynchronizationResult syncRes) {
|
||||
Class<A> adapterClass, SynchronizationResult syncRes) {
|
||||
LOGGER.info("Import");
|
||||
try {
|
||||
A adapter = getAdapter(aClass);
|
||||
A adapter = newAdapter(adapterClass);
|
||||
ServerResponse<ListResponse<S>> response = scimRequestBuilder.list(adapter.getResourceClass(), adapter.getScimEndpoint()).get().sendRequest();
|
||||
ListResponse<S> 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();
|
||||
|
|
Loading…
Reference in a new issue