From 81d9f5424ca7f7c579480161d13a782284337714 Mon Sep 17 00:00:00 2001 From: Alex Morel Date: Fri, 21 Jun 2024 15:25:47 +0200 Subject: [PATCH] Rollback on exception --- src/main/java/sh/libre/scim/core/AbstractScimService.java | 4 ++-- src/main/java/sh/libre/scim/core/ScimClient.java | 6 +++--- .../java/sh/libre/scim/core/ScimPropagationException.java | 4 ++++ 3 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 src/main/java/sh/libre/scim/core/ScimPropagationException.java diff --git a/src/main/java/sh/libre/scim/core/AbstractScimService.java b/src/main/java/sh/libre/scim/core/AbstractScimService.java index 1bad0d8cfe..4e42351c24 100644 --- a/src/main/java/sh/libre/scim/core/AbstractScimService.java +++ b/src/main/java/sh/libre/scim/core/AbstractScimService.java @@ -44,12 +44,12 @@ public abstract class AbstractScimService implements AutoCloseable { return new ScimClient(scimRequestBuilder, scimResourceType); } - public EntityOnRemoteScimId create(KeycloakId id, ResourceNode scimForCreation) { + public EntityOnRemoteScimId create(KeycloakId id, S scimForCreation) { if (scimForCreation.getId().isPresent()) { throw new IllegalArgumentException( "%s is already created on remote with id %s".formatted(id, scimForCreation.getId().get()) @@ -97,8 +96,9 @@ public class ScimClient implements AutoCloseable { return scimResourceType.getResourceClass(); } - public void replace(EntityOnRemoteScimId externalId, ResourceNode scimForReplace) { + public void replace(EntityOnRemoteScimId externalId, S scimForReplace) { Retry retry = retryRegistry.retry("replace-%s".formatted(externalId.asString())); + logger.warn(scimForReplace); ServerResponse response = retry.executeSupplier(() -> scimRequestBuilder .update(getResourceClass(), getScimEndpoint(), externalId.asString()) .setResource(scimForReplace) diff --git a/src/main/java/sh/libre/scim/core/ScimPropagationException.java b/src/main/java/sh/libre/scim/core/ScimPropagationException.java new file mode 100644 index 0000000000..145c7c4c0a --- /dev/null +++ b/src/main/java/sh/libre/scim/core/ScimPropagationException.java @@ -0,0 +1,4 @@ +package sh.libre.scim.core; + +public class ScimPropagationException { +}