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

OZG-5400 use static final for constants

parent c5711a78
Branches
Tags
No related merge requests found
...@@ -38,26 +38,33 @@ import org.mapstruct.ReportingPolicy; ...@@ -38,26 +38,33 @@ import org.mapstruct.ReportingPolicy;
@Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE, unmappedSourcePolicy = ReportingPolicy.IGNORE) @Mapper(unmappedTargetPolicy = ReportingPolicy.IGNORE, unmappedSourcePolicy = ReportingPolicy.IGNORE)
interface KeycloakRealmMapper { interface KeycloakRealmMapper {
public static final String ACTION_TOKEN_GENERATED_BY_USER_LIFE_SPAN = "900";
public static final String PASSWORD_POLICY = "upperCase(1) and lowerCase(1) and length(8) and notUsername";
public static final String DEFAULT_LOCAL = "de";
public static final String RESET_PASSWORD_ALLOWED = "true";
public static final String ENABLED = "true";
public static final String INTERNATIONALIZATION_ENABLED = "true";
@Mapping(target = "displayName", source = "displayName") @Mapping(target = "displayName", source = "displayName")
@Mapping(target = "enabled", constant = "true") @Mapping(target = "enabled", constant = ENABLED)
@Mapping(target = "resetPasswordAllowed", constant = "true") @Mapping(target = "resetPasswordAllowed", constant = RESET_PASSWORD_ALLOWED)
@Mapping(target = "supportedLocales", source = ".", qualifiedByName = "supportedLocales") @Mapping(target = "supportedLocales", source = ".", qualifiedByName = "supportedLocales")
@Mapping(target = "defaultLocale", constant = "de") @Mapping(target = "defaultLocale", constant = DEFAULT_LOCAL)
@Mapping(target = "internationalizationEnabled", constant = "true") @Mapping(target = "internationalizationEnabled", constant = INTERNATIONALIZATION_ENABLED)
@Mapping(target = "passwordPolicy", constant = "upperCase(1) and lowerCase(1) and length(8) and notUsername") @Mapping(target = "passwordPolicy", constant = PASSWORD_POLICY)
@Mapping(target = "actionTokenGeneratedByUserLifespan", constant = "900") @Mapping(target = "actionTokenGeneratedByUserLifespan", constant = ACTION_TOKEN_GENERATED_BY_USER_LIFE_SPAN)
@Mapping(target = "smtpServer", source = "smtpServer", qualifiedByName = "smtpServer") @Mapping(target = "smtpServer", source = "smtpServer", qualifiedByName = "smtpServer")
@Mapping(target = "roles.realm", source = "realmRoles") @Mapping(target = "roles.realm", source = "realmRoles")
public RealmRepresentation map(OzgCloudKeycloakRealmSpec realm); public RealmRepresentation map(OzgCloudKeycloakRealmSpec realm);
@Mapping(target = "displayName", source = "displayName") @Mapping(target = "displayName", source = "displayName")
@Mapping(target = "enabled", constant = "true") @Mapping(target = "enabled", constant = ENABLED)
@Mapping(target = "resetPasswordAllowed", constant = "true") @Mapping(target = "resetPasswordAllowed", constant = RESET_PASSWORD_ALLOWED)
@Mapping(target = "supportedLocales", source = ".", qualifiedByName = "supportedLocales") @Mapping(target = "supportedLocales", source = ".", qualifiedByName = "supportedLocales")
@Mapping(target = "defaultLocale", constant = "de") @Mapping(target = "defaultLocale", constant = DEFAULT_LOCAL)
@Mapping(target = "internationalizationEnabled", constant = "true") @Mapping(target = "internationalizationEnabled", constant = INTERNATIONALIZATION_ENABLED)
@Mapping(target = "passwordPolicy", constant = "upperCase(1) and lowerCase(1) and length(8) and notUsername") @Mapping(target = "passwordPolicy", constant = PASSWORD_POLICY)
@Mapping(target = "actionTokenGeneratedByUserLifespan", constant = "900") @Mapping(target = "actionTokenGeneratedByUserLifespan", constant = ACTION_TOKEN_GENERATED_BY_USER_LIFE_SPAN)
@Mapping(target = "smtpServer", source = "smtpServer", qualifiedByName = "smtpServer") @Mapping(target = "smtpServer", source = "smtpServer", qualifiedByName = "smtpServer")
@Mapping(target = "roles.realm", source = "realmRoles") @Mapping(target = "roles.realm", source = "realmRoles")
RealmRepresentation update(@MappingTarget RealmRepresentation existingRealm, OzgCloudKeycloakRealmSpec spec); RealmRepresentation update(@MappingTarget RealmRepresentation existingRealm, OzgCloudKeycloakRealmSpec spec);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment