/** * Handles {@code UnconfiguredChargingStationBootedEvent}s by requesting the domainService for information about * the vendor and model code which should be present in the event attributes. * * @param event the event to handle. */ @EventHandler protected void onEvent(UnconfiguredChargingStationBootedEvent event) { LOG.info("Handling UnconfiguredChargingStationBootedEvent"); Map<String, String> attributes = event.getAttributes(); Set<Evse> evses = domainService.getEvses(attributes.get(AttributeMapKeys.VENDOR_ID), attributes.get(AttributeMapKeys.MODEL)); if (evses != null && !evses.isEmpty()) { IdentityContext identityContext = new IdentityContext(addOnIdentity, new NullUserIdentity()); ConfigureChargingStationCommand command = new ConfigureChargingStationCommand(event.getChargingStationId(), evses, identityContext); LOG.info("Sending configure charging station command for charging station: {}", event.getChargingStationId()); commandGateway.send(command); } else { LOG.info("No Evses found for vendor {} and model {}", attributes.get(AttributeMapKeys.VENDOR_ID), attributes.get(AttributeMapKeys.MODEL)); } }
@CommandHandler public void handle(BootChargingStationCommand command) { ChargingStationBootedEvent chargingStationBootedEvent; if (isConfigured) { chargingStationBootedEvent = new ConfiguredChargingStationBootedEvent(command.getChargingStationId(), command.getProtocol(), command.getAttributes(), command.getIdentityContext()); } else { chargingStationBootedEvent = new UnconfiguredChargingStationBootedEvent(command.getChargingStationId(), command.getProtocol(), command.getAttributes(), command.getIdentityContext()); } apply(chargingStationBootedEvent); }