Improve some method names

This commit is contained in:
Brendan Le Ny 2024-06-12 17:00:22 +02:00
parent b6d3c20fe1
commit 2ed6f1a16d
4 changed files with 13 additions and 13 deletions

View file

@ -57,7 +57,7 @@ public abstract class Adapter<M extends RoleMapperModel, S extends ResourceNode>
}
}
public String getSCIMEndpoint() {
public String getScimEndpoint() {
return "/" + type + "s";
}
@ -117,7 +117,7 @@ public abstract class Adapter<M extends RoleMapperModel, S extends ResourceNode>
public abstract Class<S> getResourceClass();
public abstract S toSCIM();
public abstract S toScim();
public abstract Boolean entityExists();

View file

@ -75,7 +75,7 @@ public class GroupAdapter extends Adapter<GroupModel, Group> {
}
@Override
public Group toSCIM() {
public Group toScim() {
Group group = new Group();
group.setId(externalId);
group.setExternalId(id);

View file

@ -91,7 +91,7 @@ public class ScimClient {
return new ScimClient(scimRequestBuilder, retryRegistry, session, model);
}
protected EntityManager getEM() {
protected EntityManager getEntityManager() {
return session.getProvider(JpaConnectionProvider.class).getEntityManager();
}
@ -124,8 +124,8 @@ public class ScimClient {
ServerResponse<S> response = retry.executeSupplier(() -> {
try {
return scimRequestBuilder
.create(adapter.getResourceClass(), adapter.getSCIMEndpoint())
.setResource(adapter.toSCIM())
.create(adapter.getResourceClass(), adapter.getScimEndpoint())
.setResource(adapter.toScim())
.sendRequest();
} catch (ResponseException e) {
throw new RuntimeException(e);
@ -154,8 +154,8 @@ public class ScimClient {
ServerResponse<S> response = retry.executeSupplier(() -> {
try {
return scimRequestBuilder
.update(adapter.getResourceClass(), adapter.getSCIMEndpoint(), adapter.getExternalId())
.setResource(adapter.toSCIM())
.update(adapter.getResourceClass(), adapter.getScimEndpoint(), adapter.getExternalId())
.setResource(adapter.toScim())
.sendRequest();
} catch (ResponseException e) {
throw new RuntimeException(e);
@ -185,7 +185,7 @@ public class ScimClient {
ServerResponse<S> response = retry.executeSupplier(() -> {
try {
return scimRequestBuilder.delete(adapter.getResourceClass(), adapter.getSCIMEndpoint(), adapter.getExternalId())
return scimRequestBuilder.delete(adapter.getResourceClass(), adapter.getScimEndpoint(), adapter.getExternalId())
.sendRequest();
} catch (ResponseException e) {
throw new RuntimeException(e);
@ -197,7 +197,7 @@ public class ScimClient {
LOGGER.warn(response.getHttpStatus());
}
getEM().remove(resource);
getEntityManager().remove(resource);
} catch (NoResultException e) {
LOGGER.warnf("Failed to delete resource %s, scim mapping not found", id);
@ -232,7 +232,7 @@ public class ScimClient {
LOGGER.info("Import");
try {
A adapter = getAdapter(aClass);
ServerResponse<ListResponse<S>> response = scimRequestBuilder.list(adapter.getResourceClass(), adapter.getSCIMEndpoint()).get().sendRequest();
ServerResponse<ListResponse<S>> response = scimRequestBuilder.list(adapter.getResourceClass(), adapter.getScimEndpoint()).get().sendRequest();
ListResponse<S> resourceTypeListResponse = response.getResource();
for (S resource : resourceTypeListResponse.getListedResources()) {
@ -272,7 +272,7 @@ public class ScimClient {
case "DELETE_REMOTE":
LOGGER.info("Delete remote resource");
scimRequestBuilder
.delete(adapter.getResourceClass(), adapter.getSCIMEndpoint(), resource.getId().get())
.delete(adapter.getResourceClass(), adapter.getScimEndpoint(), resource.getId().get())
.sendRequest();
syncRes.increaseRemoved();
break;

View file

@ -145,7 +145,7 @@ public class UserAdapter extends Adapter<UserModel, User> {
}
@Override
public User toSCIM() {
public User toScim() {
User user = new User();
user.setExternalId(id);
user.setUserName(username);