use of org.opensmartgridplatform.adapter.ws.domain.entities.ResponseData in project open-smart-grid-platform by OSGP.
the class SmartMeteringConfigurationEndpoint method getSetClockConfigurationResponse.
@PayloadRoot(localPart = "SetClockConfigurationAsyncRequest", namespace = SMARTMETER_CONFIGURATION_NAMESPACE)
@ResponsePayload
public SetClockConfigurationResponse getSetClockConfigurationResponse(@RequestPayload final SetClockConfigurationAsyncRequest request) throws OsgpException {
SetClockConfigurationResponse response = null;
try {
final ResponseData responseData = this.responseDataService.get(request.getCorrelationUid(), ComponentType.WS_SMART_METERING);
response = new SetClockConfigurationResponse();
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 SmartMeteringManagementEndpoint method getDisableDebuggingResponse.
@PayloadRoot(localPart = "DisableDebuggingAsyncRequest", namespace = NAMESPACE)
@ResponsePayload
public DisableDebuggingResponse getDisableDebuggingResponse(@OrganisationIdentification final String organisationIdentification, @RequestPayload final DisableDebuggingAsyncRequest request) throws OsgpException {
log.info("DisableDebugging response for organisation: {} and device: {}.", organisationIdentification, request.getDeviceIdentification());
DisableDebuggingResponse response = null;
try {
response = new DisableDebuggingResponse();
final ResponseData responseData = this.responseDataService.get(request.getCorrelationUid(), ComponentType.WS_SMART_METERING);
this.throwExceptionIfResultNotOk(responseData, "Disable 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;
}
use of org.opensmartgridplatform.adapter.ws.domain.entities.ResponseData in project open-smart-grid-platform by OSGP.
the class SmartMeteringManagementEndpoint method clearMBusStatusOnAllChannelsResponse.
@PayloadRoot(localPart = "ClearMBusStatusOnAllChannelsAsyncRequest", namespace = NAMESPACE)
@ResponsePayload
public ClearMBusStatusOnAllChannelsResponse clearMBusStatusOnAllChannelsResponse(@OrganisationIdentification final String organisationIdentification, @RequestPayload final ClearMBusStatusOnAllChannelsAsyncRequest request) throws OsgpException {
log.info("Clear M-Bus Status On All Channels response for organisation: {} and device: {}.", organisationIdentification, request.getDeviceIdentification());
ClearMBusStatusOnAllChannelsResponse response = null;
try {
response = new ClearMBusStatusOnAllChannelsResponse();
final ResponseData responseData = this.responseDataService.get(request.getCorrelationUid(), ComponentType.WS_SMART_METERING);
this.throwExceptionIfResultNotOk(responseData, "Clear M-Bus Status On All Channels");
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;
}
use of org.opensmartgridplatform.adapter.ws.domain.entities.ResponseData 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.adapter.ws.domain.entities.ResponseData 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;
}
Aggregations