Package org.keycloak.partialimport
Class AbstractPartialImport<T>
java.lang.Object
org.keycloak.partialimport.AbstractPartialImport<T>
- All Implemented Interfaces:
PartialImport<T>
- Direct Known Subclasses:
ClientsPartialImport
,GroupsPartialImport
,IdentityProviderMappersPartialImport
,IdentityProvidersPartialImport
,RealmRolesPartialImport
,UsersPartialImport
Base PartialImport for most resource types.
- Author:
- Stan Silvert ssilvert@redhat.com (C) 2016 Red Hat Inc.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected PartialImportResult
abstract void
create
(RealmModel realm, KeycloakSession session, T resourceRep) doImport
(PartialImportRepresentation partialImportRep, RealmModel realm, KeycloakSession session) Create (or re-create) all the imported resources.abstract boolean
exists
(RealmModel realm, KeycloakSession session, T resourceRep) protected ErrorResponseException
existsError
(String message) abstract String
existsMessage
(RealmModel realm, T resourceRep) abstract String
getModelId
(RealmModel realm, KeycloakSession session, T resourceRep) abstract String
getRepList
(PartialImportRepresentation partialImportRep) abstract ResourceType
protected PartialImportResult
overwritten
(String modelId, T resourceRep) void
prepare
(PartialImportRepresentation partialImportRep, RealmModel realm, KeycloakSession session) Find which resources will need to be skipped or overwritten.abstract void
remove
(RealmModel realm, KeycloakSession session, T resourceRep) void
removeOverwrites
(RealmModel realm, KeycloakSession session) Delete resources that will be overwritten.protected PartialImportResult
-
Field Details
-
toOverwrite
-
toSkip
-
-
Constructor Details
-
AbstractPartialImport
public AbstractPartialImport()
-
-
Method Details
-
getRepList
-
getName
-
getModelId
-
exists
-
existsMessage
-
getResourceType
-
remove
-
create
-
prepare
public void prepare(PartialImportRepresentation partialImportRep, RealmModel realm, KeycloakSession session) throws ErrorResponseException Description copied from interface:PartialImport
Find which resources will need to be skipped or overwritten. Also, do a preliminary check for errors.- Specified by:
prepare
in interfacePartialImport<T>
- Parameters:
partialImportRep
- Everything in the PartialImport request.realm
- Realm to be imported into.session
- The KeycloakSession.- Throws:
ErrorResponseException
- If the PartialImport can not be performed, throw this exception.
-
existsError
-
overwritten
-
skipped
-
added
-
removeOverwrites
Description copied from interface:PartialImport
Delete resources that will be overwritten. This is done separately so that it can be called for all resource types before calling all the doImports. It was found that doing delete/add per resource causes errors because of cascading deletes.- Specified by:
removeOverwrites
in interfacePartialImport<T>
- Parameters:
realm
- Realm to be imported into.session
- The KeycloakSession
-
doImport
public PartialImportResults doImport(PartialImportRepresentation partialImportRep, RealmModel realm, KeycloakSession session) throws ErrorResponseException Description copied from interface:PartialImport
Create (or re-create) all the imported resources.- Specified by:
doImport
in interfacePartialImport<T>
- Parameters:
partialImportRep
- Everything in the PartialImport request.realm
- Realm to be imported into.session
- The KeycloakSession.- Returns:
- The final results of the PartialImport request.
- Throws:
ErrorResponseException
- if an error was detected trying to doImport a resource.
-