use of org.opensmartgridplatform.shared.exceptionhandling.OsgpException in project open-smart-grid-platform by OSGP.
the class SmartMeteringMonitoringEndpoint method getPeriodicMeterReadsGasResponse.
@PayloadRoot(localPart = "PeriodicMeterReadsGasAsyncRequest", namespace = SMARTMETER_MONITORING_NAMESPACE)
@ResponsePayload
public PeriodicMeterReadsGasResponse getPeriodicMeterReadsGasResponse(@OrganisationIdentification final String organisationIdentification, @RequestPayload final PeriodicMeterReadsGasAsyncRequest request) throws OsgpException {
log.debug("Incoming PeriodicMeterReadsGasAsyncRequest for meter: {}.", request.getDeviceIdentification());
PeriodicMeterReadsGasResponse response = null;
try {
final ResponseData responseData = this.responseDataService.get(request.getCorrelationUid(), PeriodicMeterReadsContainerGas.class, ComponentType.WS_SMART_METERING);
this.throwExceptionIfResultNotOk(responseData, "retrieving the periodic meter reads for gas");
response = this.monitoringMapper.map(responseData.getMessageData(), org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.PeriodicMeterReadsGasResponse.class);
} catch (final Exception e) {
this.handleRetrieveException(e, request, organisationIdentification);
}
return response;
}
use of org.opensmartgridplatform.shared.exceptionhandling.OsgpException in project open-smart-grid-platform by OSGP.
the class SmartMeteringMonitoringEndpoint method getActualMeterReadsResponse.
@PayloadRoot(localPart = "ActualMeterReadsAsyncRequest", namespace = SMARTMETER_MONITORING_NAMESPACE)
@ResponsePayload
public ActualMeterReadsResponse getActualMeterReadsResponse(@OrganisationIdentification final String organisationIdentification, @RequestPayload final ActualMeterReadsAsyncRequest request) throws OsgpException {
log.debug("Incoming ActualMeterReadsAsyncRequest for meter: {}", request.getDeviceIdentification());
ActualMeterReadsResponse response = null;
try {
final ResponseData responseData = this.responseDataService.get(request.getCorrelationUid(), MeterReads.class, ComponentType.WS_SMART_METERING);
this.throwExceptionIfResultNotOk(responseData, "retrieving the actual meter reads");
response = this.monitoringMapper.map(responseData.getMessageData(), ActualMeterReadsResponse.class);
} catch (final Exception e) {
this.handleRetrieveException(e, request, organisationIdentification);
}
return response;
}
use of org.opensmartgridplatform.shared.exceptionhandling.OsgpException in project open-smart-grid-platform by OSGP.
the class SmartMeteringMonitoringEndpoint method getSystemEventResponse.
@PayloadRoot(localPart = "GetSystemEventAsyncRequest", namespace = SMARTMETER_MONITORING_NAMESPACE)
@ResponsePayload
public GetSystemEventResponse getSystemEventResponse(@OrganisationIdentification final String organisationIdentification, @RequestPayload final GetSystemEventAsyncRequest request) throws OsgpException {
log.debug("Incoming GetSystemEventAsyncRequest for meter: {}.", request.getDeviceIdentification());
GetSystemEventResponse response = null;
try {
final ResponseData responseData = this.responseDataService.get(request.getCorrelationUid(), ComponentType.WS_SMART_METERING);
this.throwExceptionIfResultNotOk(responseData, "retrieving system event data");
response = this.monitoringMapper.map(responseData.getMessageData(), org.opensmartgridplatform.adapter.ws.schema.smartmetering.monitoring.GetSystemEventResponse.class);
} catch (final Exception e) {
this.handleRetrieveException(e, request, organisationIdentification);
}
return response;
}
use of org.opensmartgridplatform.shared.exceptionhandling.OsgpException 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.shared.exceptionhandling.OsgpException 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;
}
Aggregations