Class PermissionErrorMessageUtil


  • public class PermissionErrorMessageUtil
    extends Object
    This utility helps creating template based permission (authorization) error messages.
    Author:
    Micha Kiener
    • Field Detail

      • PERMISSION_ERROR_CODES_TEMPLATE_KEY

        public static final String PERMISSION_ERROR_CODES_TEMPLATE_KEY
        The template definition key used for permission (authorization) error messages.
        See Also:
        Constant Field Values
    • Method Detail

      • createPermissionErrorMessage

        public static String createPermissionErrorMessage​(String tenantId,
                                                          String errorCode,
                                                          Map<String,​Object> payload)
        Creates a permission error message based on the provided error code and payload. The payload must at least contain the necessary parameters as being defined within the TemplateVariationModel. This one uses english as the default language.
        Parameters:
        errorCode - the error code to choose the template variation for
        payload - the optional payload containing the necessary parameters (if any needed by the template)
        Returns:
        the rendered permission error message
      • createPermissionErrorMessage

        public static String createPermissionErrorMessage​(String tenantId,
                                                          String errorCode,
                                                          String language,
                                                          Map<String,​Object> payload)
        Creates a permission error message based on the provided error code and payload. The payload must at least contain the necessary parameters as being defined within the TemplateVariationModel.
        Parameters:
        errorCode - the error code to choose the template variation for
        language - the language (e.g. "en") for which the message should be rendered
        payload - the optional payload containing the necessary parameters (if any needed by the template)
        Returns:
        the rendered permission error message