Package io.jmix.security.role
Class RoleLocalizationSupport
java.lang.Object
io.jmix.security.role.RoleLocalizationSupport
@NullMarked
@Component("sec_RoleLocalizationSupport")
public class RoleLocalizationSupport
extends Object
Shows the name and the description of a role in a locale.
A name or a description that has the key of a message, as a design-time role gets from a msg:// reference,
is shown through that message: in the locale, then in the default locale, and the name or the description itself
when neither has a text. Otherwise the text is taken from the localized names or descriptions of the role: the
entry of the exact locale, then the entry of its language, and the name or the description itself when neither
has a text.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CurrentAuthenticationprotected Messagesprotected MessageTools -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription@Nullable String@Nullable StringgetLocalizedDescription(BaseRoleModel roleModel) @Nullable StringgetLocalizedDescription(BaseRoleModel roleModel, Locale locale) @Nullable StringgetLocalizedDescription(BaseRole role, Locale locale) getLocalizedName(BaseRole role) getLocalizedName(BaseRoleModel roleModel) getLocalizedName(BaseRoleModel roleModel, Locale locale) getLocalizedName(BaseRole role, Locale locale) protected booleanloadLocalizedValues(@Nullable String localizedValues) protected @Nullable Stringlocalize(@Nullable String messageKey, @Nullable String localizedValues, @Nullable String text, Locale locale) protected @Nullable StringnullIfAbsent(@Nullable String value) A design-time role without a description holds the empty string its annotation declares by default, a database role holds null; both mean the role has none.
-
Field Details
-
messages
-
messageTools
-
currentAuthentication
-
-
Constructor Details
-
RoleLocalizationSupport
public RoleLocalizationSupport()
-
-
Method Details
-
getLocalizedName
- Returns:
- the name of the role in the current user's locale
-
getLocalizedName
- Returns:
- the name of the role in the given locale
-
getLocalizedDescription
- Returns:
- the description of the role in the current user's locale, or null if the role has none or it is blank
-
getLocalizedDescription
- Returns:
- the description of the role in the given locale, or null if the role has none or it is blank
-
getLocalizedName
- Returns:
- the name of the role model in the current user's locale
- See Also:
-
getLocalizedName
- Returns:
- the name of the role model in the given locale
- See Also:
-
getLocalizedDescription
- Returns:
- the description of the role model in the current user's locale, or null if it has none or it is blank
- See Also:
-
getLocalizedDescription
- Returns:
- the description of the role model in the given locale, or null if it has none or it is blank
- See Also:
-
localize
-
loadLocalizedValues
-
isAbsent
-
nullIfAbsent
A design-time role without a description holds the empty string its annotation declares by default, a database role holds null; both mean the role has none.
-