Search in sources :

Example 6 with DeviceStatus

use of org.opensmartgridplatform.domain.core.valueobjects.DeviceStatus in project open-smart-grid-platform by OSGP.

the class DeviceInstallationEndpoint method getGetStatusResponse.

@PayloadRoot(localPart = "GetStatusAsyncRequest", namespace = DEVICE_INSTALLATION_NAMESPACE)
@ResponsePayload
public GetStatusResponse getGetStatusResponse(@OrganisationIdentification final String organisationIdentification, @RequestPayload final GetStatusAsyncRequest request) throws OsgpException {
    LOGGER.info("Get Status Response received from organisation: {}.", organisationIdentification);
    final GetStatusResponse response = new GetStatusResponse();
    try {
        final ResponseMessage responseMessage = this.getResponseMessage(request.getAsyncRequest());
        if (responseMessage != null) {
            throwExceptionIfResultNotOk(responseMessage, "getting status");
            response.setResult(OsgpResultType.fromValue(responseMessage.getResult().getValue()));
            final DeviceStatus deviceStatus = (DeviceStatus) responseMessage.getDataObject();
            if (deviceStatus != null) {
                response.setDeviceStatus(this.deviceInstallationMapper.map(deviceStatus, org.opensmartgridplatform.adapter.ws.schema.core.deviceinstallation.DeviceStatus.class));
            }
        }
    } catch (final Exception e) {
        this.handleException(e);
    }
    return response;
}
Also used : GetStatusResponse(org.opensmartgridplatform.adapter.ws.schema.core.deviceinstallation.GetStatusResponse) DeviceStatus(org.opensmartgridplatform.domain.core.valueobjects.DeviceStatus) ResponseMessage(org.opensmartgridplatform.shared.infra.jms.ResponseMessage) ValidationException(org.opensmartgridplatform.domain.core.exceptions.ValidationException) TechnicalException(org.opensmartgridplatform.shared.exceptionhandling.TechnicalException) FunctionalException(org.opensmartgridplatform.shared.exceptionhandling.FunctionalException) OsgpException(org.opensmartgridplatform.shared.exceptionhandling.OsgpException) ConstraintViolationException(javax.validation.ConstraintViolationException) ResponsePayload(org.springframework.ws.server.endpoint.annotation.ResponsePayload) PayloadRoot(org.springframework.ws.server.endpoint.annotation.PayloadRoot)

Aggregations

DeviceStatus (org.opensmartgridplatform.domain.core.valueobjects.DeviceStatus)6 ResponseMessage (org.opensmartgridplatform.shared.infra.jms.ResponseMessage)4 Device (org.opensmartgridplatform.domain.core.entities.Device)3 LightMeasurementDevice (org.opensmartgridplatform.domain.core.entities.LightMeasurementDevice)3 FunctionalException (org.opensmartgridplatform.shared.exceptionhandling.FunctionalException)3 Test (org.junit.jupiter.api.Test)2 GetStatusResponse (org.opensmartgridplatform.adapter.domain.shared.GetStatusResponse)2 Ssld (org.opensmartgridplatform.domain.core.entities.Ssld)2 OsgpException (org.opensmartgridplatform.shared.exceptionhandling.OsgpException)2 TechnicalException (org.opensmartgridplatform.shared.exceptionhandling.TechnicalException)2 HashMap (java.util.HashMap)1 ConstraintViolationException (javax.validation.ConstraintViolationException)1 GetStatusResponse (org.opensmartgridplatform.adapter.ws.schema.core.deviceinstallation.GetStatusResponse)1 DeviceOutputSetting (org.opensmartgridplatform.domain.core.entities.DeviceOutputSetting)1 RtuDevice (org.opensmartgridplatform.domain.core.entities.RtuDevice)1 ValidationException (org.opensmartgridplatform.domain.core.exceptions.ValidationException)1 CdmaDevice (org.opensmartgridplatform.domain.core.valueobjects.CdmaDevice)1 DeviceStatusMapped (org.opensmartgridplatform.domain.core.valueobjects.DeviceStatusMapped)1 LightSensorStatus (org.opensmartgridplatform.domain.core.valueobjects.LightSensorStatus)1 Status (org.opensmartgridplatform.domain.core.valueobjects.Status)1