Package org.keycloak.partialimport
Class RolesPartialImport
java.lang.Object
org.keycloak.partialimport.RolesPartialImport
- All Implemented Interfaces:
PartialImport<RolesRepresentation>
This class handles both realm roles and client roles. It delegates to
RealmRolesPartialImport and ClientRolesPartialImport, which are no longer used
directly by the PartialImportManager.
The strategy is to utilize RepresentationToModel.importRoles(). That way,
the complex code for bulk creation of roles is kept in one place. To do this, the
logic for skip needs to remove the roles that are going to be skipped so that
importRoles() doesn't know about them. The logic for overwrite needs to delete
the overwritten roles before importRoles() is called.
- Author:
- Stan Silvert ssilvert@redhat.com (C) 2016 Red Hat Inc.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptiondoImport
(PartialImportRepresentation rep, RealmModel realm, KeycloakSession session) Create (or re-create) all the imported resources.void
prepare
(PartialImportRepresentation rep, RealmModel realm, KeycloakSession session) Find which resources will need to be skipped or overwritten.void
removeOverwrites
(RealmModel realm, KeycloakSession session) Delete resources that will be overwritten.
-
Constructor Details
-
RolesPartialImport
public RolesPartialImport()
-
-
Method Details
-
prepare
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<RolesRepresentation>
- Parameters:
rep
- Everything in the PartialImport request.realm
- Realm to be imported into.session
- The KeycloakSession.
-
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<RolesRepresentation>
- Parameters:
realm
- Realm to be imported into.session
- The KeycloakSession
-
doImport
public PartialImportResults doImport(PartialImportRepresentation rep, RealmModel realm, KeycloakSession session) Description copied from interface:PartialImport
Create (or re-create) all the imported resources.- Specified by:
doImport
in interfacePartialImport<RolesRepresentation>
- Parameters:
rep
- Everything in the PartialImport request.realm
- Realm to be imported into.session
- The KeycloakSession.- Returns:
- The final results of the PartialImport request.
-