Class JohnsonUtils


  • @ParametersAreNonnullByDefault
    public class JohnsonUtils
    extends Object
    Utility methods relating to the Johnson framework.
    Since:
    5.8
    • Constructor Detail

      • JohnsonUtils

        public JohnsonUtils()
    • Method Detail

      • raiseJohnsonEvent

        public static com.atlassian.johnson.event.Event raiseJohnsonEvent​(JohnsonEventType eventType,
                                                                          String eventDescription,
                                                                          @Nullable String exception,
                                                                          JohnsonEventLevel eventLevel)
        Raises an Event with the given properties in the currently initialised Johnson container.
        Parameters:
        eventType - the type of Johnson event to raise
        eventDescription - the description of the event
        exception - further details of the cause of the Johnson event, if available
        eventLevel - the level of the Johnson event to raise
        Returns:
        Event created.
        Since:
        6.6.0
      • raiseJohnsonEventRequiringTranslation

        public static com.atlassian.johnson.event.Event raiseJohnsonEventRequiringTranslation​(JohnsonEventType eventType,
                                                                                              String i18nKey,
                                                                                              @Nullable String exception,
                                                                                              JohnsonEventLevel eventLevel)
        Raises an Event whose description requires translation in the currently initialised Johnson container.
        Parameters:
        eventType - the type of Johnson event to raise
        i18nKey - the key which should be used to look up the description translation
        exception - further details of the cause of the Johnson event, if available
        eventLevel - the level of the Johnson event to raise
        Returns:
        Event created.
        Since:
        6.6.0
      • removeEvent

        public static void removeEvent​(com.atlassian.johnson.event.Event johnsonEvent)
        Removes the given event from the currently initialised Johnson container.
        Since:
        6.6.0
      • findHighestEventLevel

        public static Optional<JohnsonEventLevel> findHighestEventLevel()
        Returns the highest event level within the initialised Johnson container, if any.
        Returns:
        see above
        Since:
        6.6.0
      • findHighestEventLevel

        public static Optional<JohnsonEventLevel> findHighestEventLevel​(com.atlassian.johnson.JohnsonEventContainer eventContainer)
        Returns the highest event level within the given event container, if any.
        Parameters:
        eventContainer - the container to inspect
        Returns:
        see above
      • eventExists

        public static boolean eventExists​(Predicate<com.atlassian.johnson.event.Event> predicate)
        Indicates whether the currently initialised container contains any events matching the given predicate.
        Parameters:
        predicate - the predicate to apply
        Returns:
        see above
        Since:
        6.6.0
      • eventExists

        public static boolean eventExists​(com.atlassian.johnson.JohnsonEventContainer container,
                                          Predicate<com.atlassian.johnson.event.Event> predicate)
        Indicates whether the given container contains any events matching the given predicate. Newer versions of JohnsonEventContainer contain this method.
        Parameters:
        container - the container to check
        predicate - the predicate to apply
        Returns:
        see above
        Since:
        6.5.0
      • dismissEvents

        public static void dismissEvents()
        Removes warnings from the currently initialised Johnson container.
        Since:
        6.7.0
      • allEventsDismissible

        public static boolean allEventsDismissible()
        Indicates whether all johnson events have dismissible attribute equal to true. Also returns true when there are no events in the container.
        Returns:
        see above
        Since:
        6.7.0