@EventHandler public void handle(ComponentStatusNotificationReceivedEvent event) { LOG.info("ComponentStatusNotificationReceivedEvent for {} received", event.getChargingStationId()); ChargingStation chargingStation = getChargingStation(event.getChargingStationId()); if (chargingStation != null && event.getComponentId() instanceof EvseId) { io.motown.vas.viewmodel.persistence.entities.Evse evse = chargingStation.getEvse(((EvseId) event.getComponentId()).getNumberedId()); if (evse != null) { evse.setState(ComponentStatus.fromApiComponentStatus(event.getStatusNotification().getStatus())); chargingStationRepository.createOrUpdate(chargingStation); } else { LOG.error("Received ComponentStatusNotificationReceivedEvent for unknown component."); } subscriberService.updateSubscribers(chargingStation, event.getStatusNotification().getTimeStamp()); } }
/** * Handles the {@link ComponentStatusNotificationReceivedEvent}. * * @param event the event to handle. */ @EventHandler public void handle(ComponentStatusNotificationReceivedEvent event) { if (event.getComponent() == ChargingStationComponent.EVSE) { ChargingStation chargingStation = repository.findOne(event.getChargingStationId().getId()); if (chargingStation != null) { updateEvseStatus(chargingStation, event.getComponentId().getId(), event.getStatusNotification().getStatus()); repository.createOrUpdate(chargingStation); } } }