public Connector createConnector ( Long chargingStationTypeId , Long evseId , Connector connector ) { ChargingStationType chargingStationType = chargingStationTypeRepository . findOne ( chargingStationTypeId ) ; Evse evse = getEvseById ( chargingStationType , evseId ) ; Set < Connector > originalConnectors = ImmutableSet . copyOf ( evse . getConnectors ( ) ) ; evse . getConnectors ( ) . add ( connector ) ; chargingStationType = chargingStationTypeRepository . createOrUpdate ( chargingStationType ) ; Set < Connector > newConnectors = getEvseById ( chargingStationType , evseId ) . getConnectors ( ) ; Set < Connector > diffConnectors = Sets . difference ( newConnectors , originalConnectors ) ; if ( diffConnectors . size ( ) == 1 ) { return Iterables . get ( diffConnectors , 0 ) ; } else { return null ; } }
Creates a connector in a charging station type evse .