Improve some method names
This commit is contained in:
parent
b6d3c20fe1
commit
2ed6f1a16d
4 changed files with 13 additions and 13 deletions
|
@ -57,7 +57,7 @@ public abstract class Adapter<M extends RoleMapperModel, S extends ResourceNode>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSCIMEndpoint() {
|
public String getScimEndpoint() {
|
||||||
return "/" + type + "s";
|
return "/" + type + "s";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ public abstract class Adapter<M extends RoleMapperModel, S extends ResourceNode>
|
||||||
|
|
||||||
public abstract Class<S> getResourceClass();
|
public abstract Class<S> getResourceClass();
|
||||||
|
|
||||||
public abstract S toSCIM();
|
public abstract S toScim();
|
||||||
|
|
||||||
public abstract Boolean entityExists();
|
public abstract Boolean entityExists();
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ public class GroupAdapter extends Adapter<GroupModel, Group> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Group toSCIM() {
|
public Group toScim() {
|
||||||
Group group = new Group();
|
Group group = new Group();
|
||||||
group.setId(externalId);
|
group.setId(externalId);
|
||||||
group.setExternalId(id);
|
group.setExternalId(id);
|
||||||
|
|
|
@ -91,7 +91,7 @@ public class ScimClient {
|
||||||
return new ScimClient(scimRequestBuilder, retryRegistry, session, model);
|
return new ScimClient(scimRequestBuilder, retryRegistry, session, model);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected EntityManager getEM() {
|
protected EntityManager getEntityManager() {
|
||||||
return session.getProvider(JpaConnectionProvider.class).getEntityManager();
|
return session.getProvider(JpaConnectionProvider.class).getEntityManager();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -124,8 +124,8 @@ public class ScimClient {
|
||||||
ServerResponse<S> response = retry.executeSupplier(() -> {
|
ServerResponse<S> response = retry.executeSupplier(() -> {
|
||||||
try {
|
try {
|
||||||
return scimRequestBuilder
|
return scimRequestBuilder
|
||||||
.create(adapter.getResourceClass(), adapter.getSCIMEndpoint())
|
.create(adapter.getResourceClass(), adapter.getScimEndpoint())
|
||||||
.setResource(adapter.toSCIM())
|
.setResource(adapter.toScim())
|
||||||
.sendRequest();
|
.sendRequest();
|
||||||
} catch (ResponseException e) {
|
} catch (ResponseException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
@ -154,8 +154,8 @@ public class ScimClient {
|
||||||
ServerResponse<S> response = retry.executeSupplier(() -> {
|
ServerResponse<S> response = retry.executeSupplier(() -> {
|
||||||
try {
|
try {
|
||||||
return scimRequestBuilder
|
return scimRequestBuilder
|
||||||
.update(adapter.getResourceClass(), adapter.getSCIMEndpoint(), adapter.getExternalId())
|
.update(adapter.getResourceClass(), adapter.getScimEndpoint(), adapter.getExternalId())
|
||||||
.setResource(adapter.toSCIM())
|
.setResource(adapter.toScim())
|
||||||
.sendRequest();
|
.sendRequest();
|
||||||
} catch (ResponseException e) {
|
} catch (ResponseException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
@ -185,7 +185,7 @@ public class ScimClient {
|
||||||
|
|
||||||
ServerResponse<S> response = retry.executeSupplier(() -> {
|
ServerResponse<S> response = retry.executeSupplier(() -> {
|
||||||
try {
|
try {
|
||||||
return scimRequestBuilder.delete(adapter.getResourceClass(), adapter.getSCIMEndpoint(), adapter.getExternalId())
|
return scimRequestBuilder.delete(adapter.getResourceClass(), adapter.getScimEndpoint(), adapter.getExternalId())
|
||||||
.sendRequest();
|
.sendRequest();
|
||||||
} catch (ResponseException e) {
|
} catch (ResponseException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
@ -197,7 +197,7 @@ public class ScimClient {
|
||||||
LOGGER.warn(response.getHttpStatus());
|
LOGGER.warn(response.getHttpStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
getEM().remove(resource);
|
getEntityManager().remove(resource);
|
||||||
|
|
||||||
} catch (NoResultException e) {
|
} catch (NoResultException e) {
|
||||||
LOGGER.warnf("Failed to delete resource %s, scim mapping not found", id);
|
LOGGER.warnf("Failed to delete resource %s, scim mapping not found", id);
|
||||||
|
@ -232,7 +232,7 @@ public class ScimClient {
|
||||||
LOGGER.info("Import");
|
LOGGER.info("Import");
|
||||||
try {
|
try {
|
||||||
A adapter = getAdapter(aClass);
|
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();
|
ListResponse<S> resourceTypeListResponse = response.getResource();
|
||||||
|
|
||||||
for (S resource : resourceTypeListResponse.getListedResources()) {
|
for (S resource : resourceTypeListResponse.getListedResources()) {
|
||||||
|
@ -272,7 +272,7 @@ public class ScimClient {
|
||||||
case "DELETE_REMOTE":
|
case "DELETE_REMOTE":
|
||||||
LOGGER.info("Delete remote resource");
|
LOGGER.info("Delete remote resource");
|
||||||
scimRequestBuilder
|
scimRequestBuilder
|
||||||
.delete(adapter.getResourceClass(), adapter.getSCIMEndpoint(), resource.getId().get())
|
.delete(adapter.getResourceClass(), adapter.getScimEndpoint(), resource.getId().get())
|
||||||
.sendRequest();
|
.sendRequest();
|
||||||
syncRes.increaseRemoved();
|
syncRes.increaseRemoved();
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -145,7 +145,7 @@ public class UserAdapter extends Adapter<UserModel, User> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public User toSCIM() {
|
public User toScim() {
|
||||||
User user = new User();
|
User user = new User();
|
||||||
user.setExternalId(id);
|
user.setExternalId(id);
|
||||||
user.setUserName(username);
|
user.setUserName(username);
|
||||||
|
|
Loading…
Reference in a new issue