use of org.opensmartgridplatform.adapter.ws.schema.core.firmwaremanagement.SwitchFirmwareAsyncResponse in project open-smart-grid-platform by OSGP.
the class FirmwareManagementEndpoint method switchFirmware.
@PayloadRoot(localPart = "SwitchFirmwareRequest", namespace = NAMESPACE)
@ResponsePayload
public SwitchFirmwareAsyncResponse switchFirmware(@OrganisationIdentification final String organisationIdentification, @RequestPayload final SwitchFirmwareRequest request, @MessagePriority final String messagePriority) throws OsgpException {
LOGGER.info("Switch Firmware Request received from organisation: {} for device: {} with message priority: {}.", organisationIdentification, request.getDeviceIdentification(), messagePriority);
final SwitchFirmwareAsyncResponse response = new SwitchFirmwareAsyncResponse();
try {
final String correlationUid = this.firmwareManagementService.enqueueSwitchFirmwareRequest(organisationIdentification, request.getDeviceIdentification(), String.valueOf(request.getVersion()), MessagePriorityEnum.getMessagePriority(messagePriority));
final AsyncResponse asyncResponse = new AsyncResponse();
asyncResponse.setCorrelationUid(correlationUid);
asyncResponse.setDeviceId(request.getDeviceIdentification());
response.setAsyncResponse(asyncResponse);
} catch (final ConstraintViolationException e) {
LOGGER.error("Exception switch firmware", e);
this.handleException(e);
} catch (final Exception e) {
this.handleException(e);
}
return response;
}
Aggregations