Search in sources :

Example 16 with ResponseData

use of org.opensmartgridplatform.adapter.ws.domain.entities.ResponseData 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;
}
Also used : GetKeysResponseData(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetKeysResponseData) ResponseData(org.opensmartgridplatform.adapter.ws.domain.entities.ResponseData) UpdateFirmwareResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.UpdateFirmwareResponse) IOException(java.io.IOException) OsgpException(org.opensmartgridplatform.shared.exceptionhandling.OsgpException) ResponsePayload(org.springframework.ws.server.endpoint.annotation.ResponsePayload) PayloadRoot(org.springframework.ws.server.endpoint.annotation.PayloadRoot)

Example 17 with ResponseData

use of org.opensmartgridplatform.adapter.ws.domain.entities.ResponseData 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;
}
Also used : GetKeysResponseData(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetKeysResponseData) ResponseData(org.opensmartgridplatform.adapter.ws.domain.entities.ResponseData) SetPushSetupAlarmResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SetPushSetupAlarmResponse) IOException(java.io.IOException) OsgpException(org.opensmartgridplatform.shared.exceptionhandling.OsgpException) ResponsePayload(org.springframework.ws.server.endpoint.annotation.ResponsePayload) PayloadRoot(org.springframework.ws.server.endpoint.annotation.PayloadRoot)

Example 18 with ResponseData

use of org.opensmartgridplatform.adapter.ws.domain.entities.ResponseData 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;
}
Also used : GetKeysResponseData(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetKeysResponseData) ResponseData(org.opensmartgridplatform.adapter.ws.domain.entities.ResponseData) IOException(java.io.IOException) OsgpException(org.opensmartgridplatform.shared.exceptionhandling.OsgpException) ConfigureDefinableLoadProfileResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.ConfigureDefinableLoadProfileResponse) ResponsePayload(org.springframework.ws.server.endpoint.annotation.ResponsePayload) PayloadRoot(org.springframework.ws.server.endpoint.annotation.PayloadRoot)

Example 19 with ResponseData

use of org.opensmartgridplatform.adapter.ws.domain.entities.ResponseData in project open-smart-grid-platform by OSGP.

the class SmartMeteringConfigurationEndpoint method retrieveGetAdministrativeStatusResponse.

@PayloadRoot(localPart = "GetAdministrativeStatusAsyncRequest", namespace = SMARTMETER_CONFIGURATION_NAMESPACE)
@ResponsePayload
public GetAdministrativeStatusResponse retrieveGetAdministrativeStatusResponse(@RequestPayload final GetAdministrativeStatusAsyncRequest request) throws OsgpException {
    GetAdministrativeStatusResponse response = null;
    try {
        final ResponseData responseData = this.responseDataService.get(request.getCorrelationUid(), ComponentType.WS_SMART_METERING);
        this.throwExceptionIfResultNotOk(responseData, "retrieving the administrative status");
        response = new GetAdministrativeStatusResponse();
        final AdministrativeStatusType dataRequest = this.configurationMapper.map(responseData.getMessageData(), AdministrativeStatusType.class);
        response.setEnabled(dataRequest);
    } catch (final Exception e) {
        this.handleException(e);
    }
    return response;
}
Also used : AdministrativeStatusType(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.AdministrativeStatusType) GetKeysResponseData(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetKeysResponseData) ResponseData(org.opensmartgridplatform.adapter.ws.domain.entities.ResponseData) GetAdministrativeStatusResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetAdministrativeStatusResponse) IOException(java.io.IOException) OsgpException(org.opensmartgridplatform.shared.exceptionhandling.OsgpException) ResponsePayload(org.springframework.ws.server.endpoint.annotation.ResponsePayload) PayloadRoot(org.springframework.ws.server.endpoint.annotation.PayloadRoot)

Example 20 with ResponseData

use of org.opensmartgridplatform.adapter.ws.domain.entities.ResponseData in project open-smart-grid-platform by OSGP.

the class SmartMeteringInstallationEndpoint method getAddDeviceResponse.

@PayloadRoot(localPart = "AddDeviceAsyncRequest", namespace = SMARTMETER_INSTALLATION_NAMESPACE)
@ResponsePayload
public AddDeviceResponse getAddDeviceResponse(@RequestPayload final AddDeviceAsyncRequest request) throws OsgpException {
    AddDeviceResponse response = null;
    try {
        response = new AddDeviceResponse();
        final ResponseData responseData = this.responseDataService.get(request.getCorrelationUid(), ComponentType.WS_SMART_METERING);
        this.throwExceptionIfResultNotOk(responseData, "Add 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;
}
Also used : ResponseData(org.opensmartgridplatform.adapter.ws.domain.entities.ResponseData) AddDeviceResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.installation.AddDeviceResponse) ValidationException(org.opensmartgridplatform.domain.core.exceptions.ValidationException) 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

ResponseData (org.opensmartgridplatform.adapter.ws.domain.entities.ResponseData)86 PayloadRoot (org.springframework.ws.server.endpoint.annotation.PayloadRoot)52 ResponsePayload (org.springframework.ws.server.endpoint.annotation.ResponsePayload)52 OsgpException (org.opensmartgridplatform.shared.exceptionhandling.OsgpException)51 IOException (java.io.IOException)23 GetKeysResponseData (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetKeysResponseData)23 FunctionalException (org.opensmartgridplatform.shared.exceptionhandling.FunctionalException)23 ConstraintViolationException (javax.validation.ConstraintViolationException)13 ValidationException (org.opensmartgridplatform.domain.core.exceptions.ValidationException)13 TechnicalException (org.opensmartgridplatform.shared.exceptionhandling.TechnicalException)11 Then (io.cucumber.java.en.Then)8 Serializable (java.io.Serializable)7 GetGsmDiagnosticResponseData (org.opensmartgridplatform.adapter.ws.schema.smartmetering.management.GetGsmDiagnosticResponseData)6 SetDeviceLifecycleStatusByChannelResponseData (org.opensmartgridplatform.adapter.ws.schema.smartmetering.management.SetDeviceLifecycleStatusByChannelResponseData)6 ScanMbusChannelsResponseData (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.ScanMbusChannelsResponseData)5 Field (java.lang.reflect.Field)4 ResponseDataBuilder (org.opensmartgridplatform.cucumber.platform.glue.steps.database.ws.ResponseDataBuilder)4 Given (io.cucumber.java.en.Given)3 ResponseMessage (org.opensmartgridplatform.shared.infra.jms.ResponseMessage)3 Transactional (org.springframework.transaction.annotation.Transactional)3