Class JohnsonUtils
- java.lang.Object
-
- com.atlassian.confluence.setup.johnson.JohnsonUtils
-
@ParametersAreNonnullByDefault public class JohnsonUtils extends Object
Utility methods relating to the Johnson framework.- Since:
- 5.8
-
-
Constructor Summary
Constructors Constructor Description JohnsonUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
allEventsDismissible()
Indicates whether all johnson events have dismissible attribute equal to true.static void
dismissEvents()
Removes warnings from the currently initialised Johnson container.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.static boolean
eventExists(Predicate<com.atlassian.johnson.event.Event> predicate)
Indicates whether the currently initialised container contains any events matching the given predicate.static Optional<JohnsonEventLevel>
findHighestEventLevel()
Returns the highest event level within the initialised Johnson container, if any.static Optional<JohnsonEventLevel>
findHighestEventLevel(com.atlassian.johnson.JohnsonEventContainer eventContainer)
Returns the highest event level within the given event container, if any.static com.atlassian.johnson.event.Event
raiseJohnsonEvent(JohnsonEventType eventType, String eventDescription, @Nullable String exception, JohnsonEventLevel eventLevel)
Raises anEvent
with the given properties in the currently initialised Johnson container.static com.atlassian.johnson.event.Event
raiseJohnsonEventRequiringTranslation(JohnsonEventType eventType, String i18nKey, @Nullable String exception, JohnsonEventLevel eventLevel)
Raises anEvent
whose description requires translation in the currently initialised Johnson container.static void
removeEvent(com.atlassian.johnson.event.Event johnsonEvent)
Removes the given event from the currently initialised Johnson container.
-
-
-
Method Detail
-
raiseJohnsonEvent
public static com.atlassian.johnson.event.Event raiseJohnsonEvent(JohnsonEventType eventType, String eventDescription, @Nullable String exception, JohnsonEventLevel eventLevel)
Raises anEvent
with the given properties in the currently initialised Johnson container.- Parameters:
eventType
- the type of Johnson event to raiseeventDescription
- the description of the eventexception
- further details of the cause of the Johnson event, if availableeventLevel
- 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 anEvent
whose description requires translation in the currently initialised Johnson container.- Parameters:
eventType
- the type of Johnson event to raisei18nKey
- the key which should be used to look up the description translationexception
- further details of the cause of the Johnson event, if availableeventLevel
- 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 ofJohnsonEventContainer
contain this method.- Parameters:
container
- the container to checkpredicate
- 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
-
-