use of org.opensmartgridplatform.shared.exceptionhandling.OsgpException in project open-smart-grid-platform by OSGP.
the class SmartMeteringConfigurationEndpoint method getPushNotificationAlarm.
@PayloadRoot(localPart = "GetPushNotificationAlarmAsyncRequest", namespace = SMARTMETER_CONFIGURATION_NAMESPACE)
@ResponsePayload
public GetPushNotificationAlarmResponse getPushNotificationAlarm(@OrganisationIdentification final String organisationIdentification, @RequestPayload final GetPushNotificationAlarmAsyncRequest request) throws OsgpException {
log.info("GetPushNotificationAlarmRequest Request received from organisation {} for device: {}.", organisationIdentification, request.getDeviceIdentification());
final GetPushNotificationAlarmResponse response = new GetPushNotificationAlarmResponse();
try {
final ResponseData responseData = this.responseDataService.get(request.getCorrelationUid(), ComponentType.WS_SMART_METERING);
response.setResult(OsgpResultType.fromValue(responseData.getResultType().getValue()));
if (responseData != null) {
final PushNotificationAlarm p = (PushNotificationAlarm) responseData.getMessageData();
response.setDecodedMessage(p.toString());
response.setEncodedMessage(p.getAlarmBytes());
response.getAlarm().addAll(this.configurationMapper.mapAsList(p.getAlarms(), org.opensmartgridplatform.adapter.ws.schema.smartmetering.common.AlarmType.class));
}
} catch (final Exception e) {
this.handleException(e);
}
return response;
}
use of org.opensmartgridplatform.shared.exceptionhandling.OsgpException in project open-smart-grid-platform by OSGP.
the class SmartMeteringConfigurationEndpoint method getGetConfigurationObjectResponse.
@PayloadRoot(localPart = "GetConfigurationObjectAsyncRequest", namespace = SMARTMETER_CONFIGURATION_NAMESPACE)
@ResponsePayload
public GetConfigurationObjectResponse getGetConfigurationObjectResponse(@RequestPayload final GetConfigurationObjectAsyncRequest request) throws OsgpException {
GetConfigurationObjectResponse response = null;
try {
final ResponseData responseData = this.responseDataService.get(request.getCorrelationUid(), org.opensmartgridplatform.domain.core.valueobjects.smartmetering.GetConfigurationObjectResponse.class, ComponentType.WS_SMART_METERING);
this.throwExceptionIfResultNotOk(responseData, "retrieving the configuration object");
response = this.configurationMapper.map(responseData.getMessageData(), GetConfigurationObjectResponse.class);
} catch (final Exception e) {
this.handleException(e);
}
return response;
}
use of org.opensmartgridplatform.shared.exceptionhandling.OsgpException in project open-smart-grid-platform by OSGP.
the class SmartMeteringConfigurationEndpoint method getUpdateFirmwareResponse.
@PayloadRoot(localPart = "UpdateFirmwareAsyncRequest", namespace = SMARTMETER_CONFIGURATION_NAMESPACE)
@ResponsePayload
public org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.UpdateFirmwareResponse getUpdateFirmwareResponse(@OrganisationIdentification final String organisationIdentification, @RequestPayload final UpdateFirmwareAsyncRequest request) throws OsgpException {
log.info("GetUpdateFirmwareResponse Request received from organisation {} for device: {}.", organisationIdentification, request.getDeviceIdentification());
UpdateFirmwareResponse response = null;
try {
final ResponseData responseData = this.responseDataService.get(request.getCorrelationUid(), ComponentType.WS_SMART_METERING);
this.throwExceptionIfResultNotOk(responseData, "updating firmware");
response = new UpdateFirmwareResponse();
response.setResult(OsgpResultType.fromValue(responseData.getResultType().getValue()));
} catch (final Exception e) {
this.handleException(e);
}
return response;
}
use of org.opensmartgridplatform.shared.exceptionhandling.OsgpException in project open-smart-grid-platform by OSGP.
the class SmartMeteringConfigurationEndpoint method getSetPushSetupAlarmResponse.
@PayloadRoot(localPart = "SetPushSetupAlarmAsyncRequest", namespace = SMARTMETER_CONFIGURATION_NAMESPACE)
@ResponsePayload
public SetPushSetupAlarmResponse getSetPushSetupAlarmResponse(@OrganisationIdentification final String organisationIdentification, @RequestPayload final SetPushSetupAlarmAsyncRequest request) throws OsgpException {
log.info("Incoming SetPushSetupAlarmAsyncRequest for organisation {} for meter: {}.", organisationIdentification, request.getDeviceIdentification());
SetPushSetupAlarmResponse response = null;
try {
response = new SetPushSetupAlarmResponse();
final ResponseData responseData = this.responseDataService.get(request.getCorrelationUid(), ComponentType.WS_SMART_METERING);
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.shared.exceptionhandling.OsgpException in project open-smart-grid-platform by OSGP.
the class SmartMeteringConfigurationEndpoint method getConfigureDefinableLoadProfileResponse.
@PayloadRoot(localPart = "ConfigureDefinableLoadProfileAsyncRequest", namespace = SMARTMETER_CONFIGURATION_NAMESPACE)
@ResponsePayload
public ConfigureDefinableLoadProfileResponse getConfigureDefinableLoadProfileResponse(@RequestPayload final ConfigureDefinableLoadProfileAsyncRequest request) throws OsgpException {
ConfigureDefinableLoadProfileResponse response = null;
try {
final ResponseData responseData = this.responseDataService.get(request.getCorrelationUid(), ComponentType.WS_SMART_METERING);
response = new ConfigureDefinableLoadProfileResponse();
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