Class JohnsonUtils
java.lang.Object
com.atlassian.confluence.setup.johnson.JohnsonUtils
Utility methods relating to the Johnson framework.
- Since:
- 5.8
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanIndicates whether all johnson events have dismissible attribute equal to true.static voidRemoves warnings from the currently initialised Johnson container.static booleaneventExists(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 booleaneventExists(Predicate<com.atlassian.johnson.event.Event> predicate) Indicates whether the currently initialised container contains any events matching the given predicate.static Optional<JohnsonEventLevel>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.EventraiseJohnsonEvent(JohnsonEventType eventType, String eventDescription, @Nullable String exception, JohnsonEventLevel eventLevel) Raises anEventwith the given properties in the currently initialised Johnson container.static com.atlassian.johnson.event.EventraiseJohnsonEventRequiringTranslation(JohnsonEventType eventType, String i18nKey, @Nullable String exception, JohnsonEventLevel eventLevel) Raises anEventwhose description requires translation in the currently initialised Johnson container.static voidremoveEvent(com.atlassian.johnson.event.Event johnsonEvent) Removes the given event from the currently initialised Johnson container.
-
Constructor Details
-
JohnsonUtils
public JohnsonUtils()
-
-
Method Details
-
raiseJohnsonEvent
public static com.atlassian.johnson.event.Event raiseJohnsonEvent(JohnsonEventType eventType, String eventDescription, @Nullable String exception, JohnsonEventLevel eventLevel) Raises anEventwith 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:
Eventcreated.- Since:
- 6.6.0
-
raiseJohnsonEventRequiringTranslation
public static com.atlassian.johnson.event.Event raiseJohnsonEventRequiringTranslation(JohnsonEventType eventType, String i18nKey, @Nullable String exception, JohnsonEventLevel eventLevel) Raises anEventwhose 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:
Eventcreated.- 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
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
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 ofJohnsonEventContainercontain 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
-