Skip to content
Snippets Groups Projects
Commit 1426cfce authored by Daniel Gerhardt's avatar Daniel Gerhardt
Browse files

Don't run ScoreCalculatorFactoryImpl's event handlers if roomId is null

parent 7bc75f68
No related merge requests found
...@@ -56,31 +56,31 @@ public class ScoreCalculatorFactoryImpl implements ScoreCalculatorFactory, Appli ...@@ -56,31 +56,31 @@ public class ScoreCalculatorFactoryImpl implements ScoreCalculatorFactory, Appli
return scoreCalculator; return scoreCalculator;
} }
@CacheEvict(value = "score", key = "#event.entity.roomId") @CacheEvict(value = "score", key = "#event.entity.roomId", condition = "#event.entity.roomId != null")
@EventListener @EventListener
public void handleAfterContentCreation(AfterCreationEvent<Content> event) { public void handleAfterContentCreation(AfterCreationEvent<Content> event) {
this.publisher.publishEvent(new ChangeScoreEvent(this, event.getEntity().getRoomId())); this.publisher.publishEvent(new ChangeScoreEvent(this, event.getEntity().getRoomId()));
} }
@CacheEvict(value = "score", key = "#event.entity.roomId") @CacheEvict(value = "score", key = "#event.entity.roomId", condition = "#event.entity.roomId != null")
@EventListener(condition = "#event.stateName == 'state'") @EventListener(condition = "#event.stateName == 'state'")
public void handleContentStateChange(StateChangeEvent<Content, Content.State> event) { public void handleContentStateChange(StateChangeEvent<Content, Content.State> event) {
this.publisher.publishEvent(new ChangeScoreEvent(this, event.getEntity().getRoomId())); this.publisher.publishEvent(new ChangeScoreEvent(this, event.getEntity().getRoomId()));
} }
@CacheEvict(value = "score", key = "#event.entity.roomId") @CacheEvict(value = "score", key = "#event.entity.roomId", condition = "#event.entity.roomId != null")
@EventListener @EventListener
public void handleNewAnswer(AfterCreationEvent<Answer> event) { public void handleNewAnswer(AfterCreationEvent<Answer> event) {
this.publisher.publishEvent(new ChangeScoreEvent(this, event.getEntity().getRoomId())); this.publisher.publishEvent(new ChangeScoreEvent(this, event.getEntity().getRoomId()));
} }
@CacheEvict(value = "score", key = "#event.entity.roomId") @CacheEvict(value = "score", key = "#event.entity.roomId", condition = "#event.entity.roomId != null")
@EventListener @EventListener
public void handleDeleteAnswer(AfterDeletionEvent<Answer> event) { public void handleDeleteAnswer(AfterDeletionEvent<Answer> event) {
this.publisher.publishEvent(new ChangeScoreEvent(this, event.getEntity().getRoomId())); this.publisher.publishEvent(new ChangeScoreEvent(this, event.getEntity().getRoomId()));
} }
@CacheEvict(value = "score", key = "#event.entity.roomId") @CacheEvict(value = "score", key = "#event.entity.roomId", condition = "#event.entity.roomId != null")
@EventListener @EventListener
public void handleDeleteQuestion(AfterDeletionEvent<Content> event) { public void handleDeleteQuestion(AfterDeletionEvent<Content> event) {
this.publisher.publishEvent(new ChangeScoreEvent(this, event.getEntity().getRoomId())); this.publisher.publishEvent(new ChangeScoreEvent(this, event.getEntity().getRoomId()));
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment