@EventHandler public void handle(ChargingStationCreatedEvent event) { LOG.debug("ChargingStationCreatedEvent creates [{}] in operator api repo", event.getChargingStationId()); ChargingStation station = new ChargingStation(event.getChargingStationId().getId()); repository.createOrUpdate(station); }
@EventSourcingHandler public void handle(ChargingStationCreatedEvent event) { this.id = event.getChargingStationId(); for(UserIdentity identity : event.getUserIdentitiesWithAllPermissions()) { this.authorizations.put(identity, AllPermissions.class); } }
@CommandHandler public ChargingStation(CreateChargingStationCommand command) { this(); apply(new ChargingStationCreatedEvent(command.getChargingStationId(), command.getUserIdentitiesWithAllPermissions(), 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(ChargingStationCreatedEvent event) { LOG.info("Handling ChargingStationCreatedEvent"); String chargingStationId = event.getChargingStationId().getId(); ChargingStation chargingStation = chargingStationRepository.findOne(chargingStationId); if (chargingStation == null) { chargingStation = new ChargingStation(chargingStationId); chargingStationRepository.createOrUpdate(chargingStation); } }
/** * Handles {@code ChargingStationCreatedEvent} which contains the initial authorizations. Initial authorizations * are updated in the command authorization repository. * * @param event contains information about command authorization. */ @EventHandler public void handle(ChargingStationCreatedEvent event) { for (UserIdentity userIdentity : event.getUserIdentitiesWithAllPermissions()) { commandAuthorizationRepository.createOrUpdate(event.getChargingStationId().getId(), userIdentity.getId(), AllPermissions.class); } }
@EventHandler public void handle(ChargingStationCreatedEvent event) { LOG.info("Handling ChargingStationCreatedEvent"); String chargingStationId = event.getChargingStationId().getId(); ChargingStation chargingStation = chargingStationRepository.findOne(chargingStationId); if (chargingStation == null) { chargingStation = new ChargingStation(chargingStationId); } chargingStationRepository.createOrUpdate(chargingStation); }
@EventHandler void onEvent(ChargingStationCreatedEvent event) { String chargingStationId = event.getChargingStationId().getId(); LocalAuthChargingStation chargingStation = chargingStationRepository.findOne(chargingStationId); if (chargingStation == null) { chargingStationRepository.createOrUpdate(new LocalAuthChargingStation(chargingStationId)); } }
@EventHandler void onEvent(ChargingStationCreatedEvent event) { String chargingStationId = event.getChargingStationId().getId(); ChargingStation chargingStation = repository.findOne(chargingStationId); if (chargingStation == null) { repository.createOrUpdate(new ChargingStation(chargingStationId, defaultAuthorizationProviders)); } }