/** * Handles a {@link StartTransactionCommand}. * * @param command the command which needs to be applied to the ChargingStation. */ @CommandHandler public void handle(StartTransactionCommand command, MetaData metaData) { if (command.getStartTransactionInfo().getEvseId().getNumberedId() > numberOfEvses) { apply(new EvseNotFoundEvent(id, command.getStartTransactionInfo().getEvseId(), command.getIdentityContext()), metaData); return; } apply(new TransactionStartedEvent(command.getChargingStationId(), command.getTransactionId(), command.getStartTransactionInfo(), command.getIdentityContext()), metaData); }
@CommandHandler public void handle(RequestUnlockEvseCommand command, MetaData metaData) { checkCommandAllowed(command.getIdentityContext(), command.getClass()); checkCommunicationAllowed(); if (command.getEvseId().getNumberedId() > numberOfEvses) { apply(new EvseNotFoundEvent(id, command.getEvseId(), command.getIdentityContext()), metaData); } else { if (command.getEvseId() == Evse.ALL) { for (int i = 1; i <= numberOfEvses; i++) { apply(new UnlockEvseRequestedEvent(id, protocol, new EvseId(i), command.getIdentityContext()), metaData); } } else { apply(new UnlockEvseRequestedEvent(id, protocol, command.getEvseId(), command.getIdentityContext()), metaData); } } }