private ChargingStation checkChargingStationExistsAndIsRegisteredAndConfigured ( ChargingStationId chargingStationId ) { ChargingStation chargingStation = chargingStationRepository . findOne ( chargingStationId . getId ( ) ) ; if ( chargingStation == null ) { throw new IllegalStateException ( "Unknown charging station." ) ; } if ( ! chargingStation . isRegisteredAndConfigured ( ) ) { throw new IllegalStateException ( "Charging station has not been registered/configured." ) ; } return chargingStation ; }
Checks if the charging station exists in the repository and if it has been registered and configured . If not a IllegalStateException will be thrown .