Skip to content

Commit

Permalink
chore: Remove unnecessary function
Browse files Browse the repository at this point in the history
  • Loading branch information
kaancayli committed Dec 15, 2024
1 parent c4021ed commit c269687
Showing 1 changed file with 0 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Service;
Expand Down Expand Up @@ -40,7 +39,6 @@ public PyrisEventPublisher(ApplicationEventPublisher eventPublisher, IrisSetting
* @param event the event to publish
*/
public void publishEvent(PyrisEvent event) {
isEventSupportedElseThrow(event);
if (!isEventEnabled(event)) {
log.debug("Skipping event publication as conditions are not met: {}", event.getClass().getSimpleName());
return;
Expand All @@ -54,26 +52,6 @@ public void publishEvent(PyrisEvent event) {
}
}

/**
* Checks if the given event is supported and throws an exception if it is not.
*
* @param event - the event to check
*/
private void isEventSupportedElseThrow(ApplicationEvent event) {
if (!isEventSupported(event)) {
throw new UnsupportedPyrisEventException("Event not supported: " + event);
}
}

/**
* Checks if the given event is supported.
*
* @param event the event to publish
*/
private boolean isEventSupported(ApplicationEvent event) {
return event instanceof PyrisEvent;
}

private boolean isEventEnabled(PyrisEvent event) {
return switch (event) {
case NewResultEvent newResultEvent -> {
Expand Down

0 comments on commit c269687

Please sign in to comment.