@Override protected boolean matchesSafely(Event item, Description mismatchDescription) { return key.equals(item.getKey().getType()); }
private static boolean isLicenseEvent(Event event) { return ImmutableList.of(LICENSE_TOO_OLD, CLUSTERING_UNLICENSED, SUBSCRIPTION_EXPIRED) .stream() .map(EventType::get) .anyMatch(key -> event.getKey().equals(key)); }
/** * Matches events which have the specified {@link EventType type}. * * @param type the type to compare against * @return a {@code Predicate} which returns {@code true} for {@link Event events} whose {@link Event#getKey keys} * match the provided {@link EventType}, and {@code false} for all others */ @Nonnull public static Predicate<Event> type(EventType type) { requireNonNull(type, "type"); return event -> type.equals(event.getKey()); } }
private boolean isImportInProgress() { final JohnsonEventContainer container = johnsonProvider.getContainer(); for (Event event : container.getEvents()) { if (IMPORT_EVENT_TYPE.equals(event.getKey().getType())) { log.info("Received new license while import in progress, skipping application configuration."); return true; } } return false; }
public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof Event)) { return false; } Event e = (Event) o; return Objects.equals(getDate(), e.getDate()) && Objects.equals(getDesc(), e.getDesc()) && Objects.equals(getException(), e.getException()) && Objects.equals(getKey(), e.getKey()) && Objects.equals(getLevel(), e.getLevel()); }
public int hashCode() { return Objects.hash(getKey(), getDesc(), getException(), getLevel(), getDate()); }
protected String doExecute() throws Exception { OfBizDelegator ofBizDelegator = ComponentAccessor.getComponent(OfBizDelegator.class); ApplicationProperties applicationProperties = ComponentAccessor.getComponent(ApplicationProperties.class); DataCleaner dataCleaner = new DataCleaner(applicationProperties, ofBizDelegator); dataCleaner.clean(); // Lock JIRA so the server has to be restarted and JohnsonEventContainer cont = johnsonProvider.getContainer(); for (final Object o : cont.getEvents()) { Event event = (Event) o; if (event != null && event.getKey().equals(EventType.get("export-illegal-xml"))) { cont.removeEvent(event); } } Event newEvent = new Event(EventType.get("restart"), "The illegal XML characters have been removed. The server needs to be restarted.", EventLevel.get(EventLevel.ERROR)); cont.addEvent(newEvent); setDataCleaned(true); return getResult(); }