use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.GetKeysRequestData in project open-smart-grid-platform by OSGP.
the class GetKeysRequestMessageProcessor method handleMessage.
@Override
protected void handleMessage(final MessageMetadata messageMetadata, final Object dataObject) throws FunctionalException {
final GetKeysRequestData getKeysRequestData = (GetKeysRequestData) dataObject;
this.configurationService.getKeys(messageMetadata, getKeysRequestData);
}
use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.GetKeysRequestData in project open-smart-grid-platform by OSGP.
the class SmartMeteringConfigurationEndpoint method getKeys.
@PayloadRoot(localPart = "GetKeysRequest", namespace = SMARTMETER_CONFIGURATION_NAMESPACE)
@ResponsePayload
public GetKeysAsyncResponse getKeys(@OrganisationIdentification final String organisationIdentification, @RequestPayload final GetKeysRequest request, @MessagePriority final String messagePriority, @ScheduleTime final String scheduleTime, @ResponseUrl final String responseUrl, @BypassRetry final String bypassRetry) throws OsgpException {
final GetKeysRequestData dataRequest = this.configurationMapper.map(request.getGetKeysData(), GetKeysRequestData.class);
final RequestMessageMetadata requestMessageMetadata = RequestMessageMetadata.newBuilder().withOrganisationIdentification(organisationIdentification).withDeviceIdentification(request.getDeviceIdentification()).withDeviceFunction(DeviceFunction.GET_KEYS).withMessageType(MessageType.GET_KEYS).withMessagePriority(messagePriority).withScheduleTime(scheduleTime).withBypassRetry(bypassRetry).build();
final AsyncResponse asyncResponse = this.requestService.enqueueAndSendRequest(requestMessageMetadata, dataRequest);
this.saveResponseUrlIfNeeded(asyncResponse.getCorrelationUid(), responseUrl);
return this.configurationMapper.map(asyncResponse, GetKeysAsyncResponse.class);
}
use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.GetKeysRequestData in project open-smart-grid-platform by OSGP.
the class ConfigurationService method getKeys.
public void getKeys(final MessageMetadata messageMetadata, final GetKeysRequestData getKeysRequestData) throws FunctionalException {
log.info("getKeys for organisationIdentification: {} for deviceIdentification: {}", messageMetadata.getOrganisationIdentification(), messageMetadata.getDeviceIdentification());
final SmartMeter smartMeter = this.domainHelperService.findSmartMeter(messageMetadata.getDeviceIdentification());
final List<SecretTypeDto> secretTypes = getKeysRequestData.getSecretTypes().stream().map(secretType -> SecretTypeDto.valueOf(secretType.name())).collect(Collectors.toList());
final GetKeysRequestDto requestDto = new GetKeysRequestDto(secretTypes);
this.osgpCoreRequestMessageSender.send(requestDto, messageMetadata.builder().withIpAddress(smartMeter.getIpAddress()).withNetworkSegmentIds(smartMeter.getBtsId(), smartMeter.getCellId()).build());
}
Aggregations