public void receive(Event event) { if (event.triggerType() == TriggerType.COLLECTING) { insertIntoRepository((CollectedEvent) event); } else { removeFromRepository(event); } }
private void removeFromRepository(Event event) { Element objectId = Element.of(event.source().id()); if (storage.contains(objectId)) { storage.remove(objectId); } }