/** * Gets a default EVSE with the given identifier. * * @param identifier the identifier for the EVSE. * @return a default EVSE with the given identifier. */ public static Evse getEvse(int identifier) { return new Evse(new EvseId(identifier), getConnectors(NUMBER_OF_CONNECTORS)); }
/** * {@inheritDoc} */ public boolean isValid() { return authenticationStatus != null && AuthenticationStatus.ACCEPTED.equals(authenticationStatus); }
public boolean isSuccessful() { return RequestResult.SUCCESS.equals(requestResult); } }
@EventHandler public void handle(TransactionStartedEvent event) { LOG.debug("TransactionStartedEvent for [{}] received!", event.getChargingStationId()); StartTransactionInfo startTransactionInfo = event.getStartTransactionInfo(); IdentifyingToken identifyingToken = startTransactionInfo.getIdentifyingToken(); Transaction transaction = new Transaction(event.getChargingStationId().getId(), event.getTransactionId().getId(), startTransactionInfo.getEvseId(), identifyingToken.getToken(), startTransactionInfo.getMeterStart(), startTransactionInfo.getTimestamp(), identifyingToken.getMobilityServiceProvider(), identifyingToken.getVisibleId()); repository.createOrUpdate(transaction); }
/** * Handles the {@link ComponentStatusNotificationReceivedEvent}. * * @param event the event to handle. */ @EventHandler public void handle(ComponentStatusNotificationReceivedEvent event) { if (event.getComponent() == ChargingStationComponent.EVSE) { ChargingStation chargingStation = repository.findOne(event.getChargingStationId().getId()); if (chargingStation != null) { updateEvseStatus(chargingStation, event.getComponentId().getId(), event.getStatusNotification().getStatus()); repository.createOrUpdate(chargingStation); } } }
@Override public void initiateCall() { domainService.startTransaction(chargingStationId, new EvseId(parameters.getConnectorId()), new TextualToken(parameters.getIdTag()), future, addOnIdentity); } }, new StartTransactionResponseFactory(), new ResponseFactory<StartTransactionResponse>() {
/** * 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); }
/** * Handles the {@link ChargingStationStatusNotificationReceivedEvent}. * * @param event the event to handle. */ @EventHandler public void handle(ChargingStationStatusNotificationReceivedEvent event) { ChargingStation chargingStation = repository.findOne(event.getChargingStationId().getId()); if (chargingStation != null) { chargingStation.setStatus(event.getStatusNotification().getStatus()); repository.createOrUpdate(chargingStation); } }
@Override public void handle(ChangeChargingStationAvailabilityToInoperativeRequestedEvent event, CorrelationToken correlationToken) { ocppJsonService.changeAvailability(event.getChargingStationId(), new EvseId(0), Changeavailability.Type.INOPERATIVE, correlationToken); }
@CommandHandler public void handle(RequestReserveNowCommand command, MetaData metaData) { checkCommandAllowed(command.getIdentityContext(), command.getClass()); checkCommunicationAllowed(); if (isReservable) { apply(new ReserveNowRequestedEvent(command.getChargingStationId(), this.protocol, command.getEvseId(), command.getIdentifyingToken(), command.getExpiryDate(), command.getParentIdentifyingToken(), command.getIdentityContext()), metaData); } else { apply(new ReserveNowRequestedForUnreservableChargingStationEvent(command.getChargingStationId(), command.getEvseId(), command.getIdentifyingToken(), command.getExpiryDate(), command.getParentIdentifyingToken(), command.getIdentityContext())); } }
@CommandHandler public void handle(BootChargingStationCommand command) { ChargingStationBootedEvent chargingStationBootedEvent; if (isConfigured) { chargingStationBootedEvent = new ConfiguredChargingStationBootedEvent(command.getChargingStationId(), command.getProtocol(), command.getAttributes(), command.getIdentityContext()); } else { chargingStationBootedEvent = new UnconfiguredChargingStationBootedEvent(command.getChargingStationId(), command.getProtocol(), command.getAttributes(), command.getIdentityContext()); } apply(chargingStationBootedEvent); }
/** * Handles a {@link RequestStartTransactionAcceptedCommand}. * * @param command the command which needs to be applied to the ChargingStation. */ @CommandHandler public void handle(RequestStartTransactionAcceptedCommand command) { apply(new RequestStartTransactionAcceptedEvent(command.getChargingStationId(), command.getEvseId(), command.getIdentifyingToken(), command.getIdentityContext())); }
/** * Handles a {@link RequestStartTransactionRejectedCommand}. * * @param command the command which needs to be applied to the ChargingStation. */ @CommandHandler public void handle(RequestStartTransactionRejectedCommand command) { apply(new RequestStartTransactionRejectedEvent(command.getChargingStationId(), command.getEvseId(), command.getIdentifyingToken(), 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())); }
@CommandHandler public ChargingStation(CreateChargingStationCommand command) { this(); apply(new ChargingStationCreatedEvent(command.getChargingStationId(), command.getUserIdentitiesWithAllPermissions(), command.getIdentityContext())); }
/** * Handles a {@link RequestStopTransactionRejectedCommand}. * * @param command the command which needs to be applied to the ChargingStation. */ @CommandHandler public void handle(RequestStopTransactionRejectedCommand command) { apply(new RequestStopTransactionRejectedEvent(command.getChargingStationId(), command.getTransactionId(), command.getIdentityContext())); }
/** * Handles a {@link RequestStopTransactionAcceptedCommand}. * * @param command the command which needs to be applied to the ChargingStation. */ @CommandHandler public void handle(RequestStopTransactionAcceptedCommand command) { apply(new RequestStopTransactionAcceptedEvent(command.getChargingStationId(), command.getTransactionId(), command.getIdentityContext())); }
@CommandHandler public void handle(DiagnosticsFileNameReceivedCommand command) { String diagnosticsFileName = command.getDiagnosticsFileName(); if (diagnosticsFileName.isEmpty()) { apply(new NoDiagnosticsInformationAvailableEvent(this.id, command.getIdentityContext())); } else { apply(new DiagnosticsFileNameReceivedEvent(this.id, diagnosticsFileName, command.getIdentityContext())); } }
public void setEvseId(EvseId evseId) { this.evseId = evseId.getId(); }
@Override public void initiateCall() { domainService.startTransaction(chargingStationId, new EvseId(parameters.getConnectorId()), new TextualToken(parameters.getIdTag()), future, addOnIdentity); } }, new StartTransactionResponseFactory(), new ResponseFactory<StartTransactionResponse>() {