Skip to content
Snippets Groups Projects
Commit b23dbc44 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-6495 reorder methods

parent 92d356f0
Branches
Tags
No related merge requests found
......@@ -43,14 +43,6 @@ class KeycloakRealmService {
private final KeycloakGenericRemoteService keycloakGenericRemoteService;
void createRealm(OzgCloudKeycloakRealmSpec realm, String realmName) {
Optional.of(realm)
.map(mapper::map)
.map(realmRepresentation -> addRealmName(realmRepresentation, realmName))
.filter(realmRepresentation -> !keycloakGenericRemoteService.realmExists(realmName))
.ifPresent(remoteService::createRealm);
}
public void createOrUpdateRealm(OzgCloudKeycloakRealmSpec realm, String realmName) {
keycloakGenericRemoteService.getRealmRepresentation(realmName)
.ifPresentOrElse(existingRealm -> updateRealm(existingRealm, realm),
......@@ -59,7 +51,6 @@ class KeycloakRealmService {
}
void updateRealm(RealmRepresentation existingRealm, OzgCloudKeycloakRealmSpec spec) {
try {
LOG.debug("{}: Updating existing realm...", existingRealm);
var realmRepresentation = mapper.update(existingRealm, spec);
......@@ -68,7 +59,14 @@ class KeycloakRealmService {
LOG.warn(existingRealm + ": Updating existing realm failed: ", e);
throw e;
}
}
void createRealm(OzgCloudKeycloakRealmSpec realm, String realmName) {
Optional.of(realm)
.map(mapper::map)
.map(realmRepresentation -> addRealmName(realmRepresentation, realmName))
.filter(realmRepresentation -> !keycloakGenericRemoteService.realmExists(realmName))
.ifPresent(remoteService::createRealm);
}
void addOrUpdateRealmRoles(OzgCloudKeycloakRealmSpec spec, String realm) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment