use of org.opensmartgridplatform.adapter.ws.domain.entities.ResponseData in project open-smart-grid-platform by OSGP.
the class SmartMeteringMonitoringEndpoint method getRetrievePushNotificationAlarmResponse.
@PayloadRoot(localPart = "RetrievePushNotificationAlarmRequest", namespace = SMARTMETER_MONITORING_NAMESPACE)
@ResponsePayload
public RetrievePushNotificationAlarmResponse getRetrievePushNotificationAlarmResponse(@OrganisationIdentification final String organisationIdentification, @RequestPayload final RetrievePushNotificationAlarmRequest request) throws OsgpException {
log.info("Incoming RetrievePushNotificationAlarmRequest for correlation UID: {}", request.getCorrelationUid());
RetrievePushNotificationAlarmResponse response = null;
try {
final ResponseData responseData = this.responseDataService.get(request.getCorrelationUid(), PushNotificationAlarm.class, ComponentType.WS_SMART_METERING);
this.throwExceptionIfResultNotOk(responseData, "retrieving the push notification alarm");
response = this.monitoringMapper.map(responseData.getMessageData(), RetrievePushNotificationAlarmResponse.class);
} catch (final FunctionalException e) {
throw e;
} catch (final Exception e) {
log.error("Exception: {} while sending RetrievePushNotificationAlarmRequest for correlation UID: {} for organisation {}.", e.getMessage(), request.getCorrelationUid(), organisationIdentification);
this.handleException(e);
}
return response;
}
use of org.opensmartgridplatform.adapter.ws.domain.entities.ResponseData in project open-smart-grid-platform by OSGP.
the class SmartMeteringInstallationEndpoint method getDecoupleMbusDeviceResponse.
/**
* @param request the request message containing the correlationUid
* @return the response message containing the OsgpResultType and optional a message
* @throws OsgpException
*/
@PayloadRoot(localPart = "DecoupleMbusDeviceAsyncRequest", namespace = SMARTMETER_INSTALLATION_NAMESPACE)
@ResponsePayload
public DecoupleMbusDeviceResponse getDecoupleMbusDeviceResponse(@RequestPayload final DecoupleMbusDeviceAsyncRequest request) throws OsgpException {
DecoupleMbusDeviceResponse response = null;
try {
response = new DecoupleMbusDeviceResponse();
final ResponseData responseData = this.responseDataService.get(request.getCorrelationUid(), ComponentType.WS_SMART_METERING);
this.throwExceptionIfResultNotOk(responseData, "Decouple Mbus Device");
response.setResult(OsgpResultType.fromValue(responseData.getResultType().getValue()));
if (responseData.getMessageData() instanceof String) {
response.setDescription((String) responseData.getMessageData());
}
} catch (final Exception e) {
this.handleException(e);
}
return response;
}
use of org.opensmartgridplatform.adapter.ws.domain.entities.ResponseData in project open-smart-grid-platform by OSGP.
the class SmartMeteringConfigurationEndpoint method getGetMBusEncryptionKeyStatusByChannelResponse.
@PayloadRoot(localPart = "GetMbusEncryptionKeyStatusByChannelAsyncRequest", namespace = SMARTMETER_CONFIGURATION_NAMESPACE)
@ResponsePayload
public GetMbusEncryptionKeyStatusByChannelResponse getGetMBusEncryptionKeyStatusByChannelResponse(@RequestPayload final GetMbusEncryptionKeyStatusByChannelAsyncRequest request) throws OsgpException {
GetMbusEncryptionKeyStatusByChannelResponse response = null;
try {
final ResponseData responseData = this.responseDataService.get(request.getCorrelationUid(), ComponentType.WS_SMART_METERING);
this.throwExceptionIfResultNotOk(responseData, "retrieving the M-Bus encryption key status by channel.");
response = new GetMbusEncryptionKeyStatusByChannelResponse();
response.setResult(OsgpResultType.fromValue(responseData.getResultType().getValue()));
response.setEncryptionKeyStatus(EncryptionKeyStatus.fromValue(((EncryptionKeyStatusType) responseData.getMessageData()).name()));
} catch (final Exception e) {
this.handleException(e);
}
return response;
}
use of org.opensmartgridplatform.adapter.ws.domain.entities.ResponseData in project open-smart-grid-platform by OSGP.
the class DomainResponseMessageProcessor method handleMessage.
protected void handleMessage(final CorrelationIds ids, final String messageType, final ResponseMessageResultType resultType, final String resultDescription, final Serializable dataObject) {
final short numberOfNotificationsSent = 0;
final Serializable responseObject;
if (dataObject == null) {
responseObject = resultDescription;
} else {
responseObject = dataObject;
}
final ResponseData responseData = new ResponseData(ids, messageType, resultType, responseObject, numberOfNotificationsSent);
this.responseDataService.enqueue(responseData);
}
use of org.opensmartgridplatform.adapter.ws.domain.entities.ResponseData in project open-smart-grid-platform by OSGP.
the class SmartMeteringManagementEndpoint method getEnableDebuggingResponse.
@PayloadRoot(localPart = "EnableDebuggingAsyncRequest", namespace = NAMESPACE)
@ResponsePayload
public EnableDebuggingResponse getEnableDebuggingResponse(@OrganisationIdentification final String organisationIdentification, @RequestPayload final EnableDebuggingAsyncRequest request) throws OsgpException {
log.info("EnableDebugging response for organisation: {} and device: {}.", organisationIdentification, request.getDeviceIdentification());
EnableDebuggingResponse response = null;
try {
response = new EnableDebuggingResponse();
final ResponseData responseData = this.responseDataService.get(request.getCorrelationUid(), ComponentType.WS_SMART_METERING);
this.throwExceptionIfResultNotOk(responseData, "Enable Debugging");
response.setResult(OsgpResultType.fromValue(responseData.getResultType().getValue()));
if (responseData.getMessageData() instanceof String) {
response.setDescription((String) responseData.getMessageData());
}
} catch (final ConstraintViolationException e) {
throw new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, ComponentType.WS_SMART_METERING, new ValidationException(e.getConstraintViolations()));
} catch (final Exception e) {
this.handleException(e);
}
return response;
}
Aggregations