use of org.opensmartgridplatform.domain.core.exceptions.ValidationException in project open-smart-grid-platform by OSGP.
the class DeviceManagementEndpoint method updateDeviceSslCertification.
@PayloadRoot(localPart = "UpdateDeviceSslCertificationRequest", namespace = DEVICE_MANAGEMENT_NAMESPACE)
@ResponsePayload
public UpdateDeviceSslCertificationAsyncResponse updateDeviceSslCertification(@OrganisationIdentification final String organisationIdentification, @RequestPayload final UpdateDeviceSslCertificationRequest request, @MessagePriority final String messagePriority) throws OsgpException {
LOGGER.info("Update Device Ssl Certification Request received from organisation: {} for device: {} with message priority: {}.", organisationIdentification, request.getDeviceIdentification(), messagePriority);
final UpdateDeviceSslCertificationAsyncResponse response = new UpdateDeviceSslCertificationAsyncResponse();
try {
final Certification certification = this.deviceManagementMapper.map(request.getCertification(), Certification.class);
final String correlationUid = this.deviceManagementService.enqueueUpdateDeviceSslCertificationRequest(organisationIdentification, request.getDeviceIdentification(), certification, MessagePriorityEnum.getMessagePriority(messagePriority));
final AsyncResponse asyncResponse = new AsyncResponse();
asyncResponse.setCorrelationUid(correlationUid);
asyncResponse.setDeviceId(request.getDeviceIdentification());
response.setAsyncResponse(asyncResponse);
} catch (final ConstraintViolationException e) {
throw new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, ComponentType.WS_CORE, new ValidationException(e.getConstraintViolations()));
} catch (final Exception e) {
this.handleException(e);
}
return response;
}
use of org.opensmartgridplatform.domain.core.exceptions.ValidationException in project open-smart-grid-platform by OSGP.
the class DeviceManagementEndpoint method setDeviceVerificationKey.
@PayloadRoot(localPart = "SetDeviceVerificationKeyRequest", namespace = DEVICE_MANAGEMENT_NAMESPACE)
@ResponsePayload
public SetDeviceVerificationKeyAsyncResponse setDeviceVerificationKey(@OrganisationIdentification final String organisationIdentification, @RequestPayload final SetDeviceVerificationKeyRequest request, @MessagePriority final String messagePriority) throws OsgpException {
LOGGER.info("Set Device Verification Key Request received from organisation: {} for device: {} with message priority: {}.", organisationIdentification, request.getDeviceIdentification(), messagePriority);
final SetDeviceVerificationKeyAsyncResponse response = new SetDeviceVerificationKeyAsyncResponse();
try {
final String correlationUid = this.deviceManagementService.enqueueSetDeviceVerificationKeyRequest(organisationIdentification, request.getDeviceIdentification(), request.getVerificationKey(), MessagePriorityEnum.getMessagePriority(messagePriority));
final AsyncResponse asyncResponse = new AsyncResponse();
asyncResponse.setCorrelationUid(correlationUid);
asyncResponse.setDeviceId(request.getDeviceIdentification());
response.setAsyncResponse(asyncResponse);
} catch (final ConstraintViolationException e) {
throw new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, ComponentType.WS_CORE, new ValidationException(e.getConstraintViolations()));
} catch (final Exception e) {
this.handleException(e);
}
return response;
}
Aggregations