@EventHandler public void handle(ChargingStationAcceptedEvent event) { LOG.debug("ChargingStationAcceptedEvent for [{}] received!", event.getChargingStationId()); ChargingStation chargingStation = repository.findOne(event.getChargingStationId().getId()); if (chargingStation != null) { chargingStation.setAccepted(true); repository.createOrUpdate(chargingStation); } else { LOG.error("operator api repo COULD NOT FIND CHARGEPOINT {} and mark it as accepted", event.getChargingStationId()); } }
@CommandHandler public void handle(AcceptChargingStationCommand command) { checkCommandAllowed(command.getIdentityContext(), command.getClass()); if (isAccepted) { throw new IllegalStateException("Cannot accept an already accepted charging station"); } apply(new ChargingStationAcceptedEvent(command.getChargingStationId(), command.getIdentityContext())); }
@CommandHandler public ChargingStation(CreateAndAcceptChargingStationCommand command) { this(); apply(new ChargingStationCreatedEvent(command.getChargingStationId(), command.getUserIdentitiesWithAllPermissions(), command.getIdentityContext())); // created event sets authorization, check if this command is checkCommandAllowed(command.getIdentityContext(), command.getClass()); apply(new ChargingStationAcceptedEvent(command.getChargingStationId(), command.getIdentityContext())); }
@EventHandler public void handle(ChargingStationAcceptedEvent event) { LOG.debug("ChargingStationAcceptedEvent for [{}] received!", event.getChargingStationId()); ChargingStation chargingStation = chargingStationRepository.findOne(event.getChargingStationId().getId()); if (chargingStation != null) { chargingStation.setRegistered(true); chargingStationRepository.createOrUpdate(chargingStation); } else { LOG.info("OCPP module repo COULD NOT FIND CHARGEPOINT {} and mark it as registered", event.getChargingStationId()); } }
@EventHandler public void handle(ChargingStationAcceptedEvent event) { LOG.debug("ChargingStationAcceptedEvent for {} received!", event.getChargingStationId()); ChargingStation chargingStation = getChargingStation(event.getChargingStationId()); if (chargingStation != null) { chargingStation.setRegistered(true); chargingStationRepository.createOrUpdate(chargingStation); } }