Search in sources :

Example 21 with OsgpException

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;
}
Also used : GetPushNotificationAlarmResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetPushNotificationAlarmResponse) PushNotificationAlarm(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.PushNotificationAlarm) 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) ResponsePayload(org.springframework.ws.server.endpoint.annotation.ResponsePayload) PayloadRoot(org.springframework.ws.server.endpoint.annotation.PayloadRoot)

Example 22 with OsgpException

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;
}
Also used : GetKeysResponseData(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetKeysResponseData) ResponseData(org.opensmartgridplatform.adapter.ws.domain.entities.ResponseData) GetConfigurationObjectResponse(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetConfigurationObjectResponse) 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 23 with OsgpException

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;
}
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 24 with OsgpException

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;
}
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 25 with OsgpException

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;
}
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)

Aggregations

OsgpException (org.opensmartgridplatform.shared.exceptionhandling.OsgpException)235 PayloadRoot (org.springframework.ws.server.endpoint.annotation.PayloadRoot)153 ResponsePayload (org.springframework.ws.server.endpoint.annotation.ResponsePayload)153 FunctionalException (org.opensmartgridplatform.shared.exceptionhandling.FunctionalException)128 ConstraintViolationException (javax.validation.ConstraintViolationException)98 ValidationException (org.opensmartgridplatform.domain.core.exceptions.ValidationException)75 ResponseMessage (org.opensmartgridplatform.shared.infra.jms.ResponseMessage)67 TechnicalException (org.opensmartgridplatform.shared.exceptionhandling.TechnicalException)64 ResponseMessageResultType (org.opensmartgridplatform.shared.infra.jms.ResponseMessageResultType)54 ResponseData (org.opensmartgridplatform.adapter.ws.domain.entities.ResponseData)51 JMSException (javax.jms.JMSException)40 IOException (java.io.IOException)30 GetKeysResponseData (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.GetKeysResponseData)23 CorrelationIds (org.opensmartgridplatform.shared.infra.jms.CorrelationIds)18 MessageMetadata (org.opensmartgridplatform.shared.infra.jms.MessageMetadata)17 AsyncResponse (org.opensmartgridplatform.adapter.ws.schema.core.common.AsyncResponse)15 ProtocolResponseMessage (org.opensmartgridplatform.shared.infra.jms.ProtocolResponseMessage)15 ResponseNotFoundException (org.opensmartgridplatform.adapter.ws.da.application.exceptionhandling.ResponseNotFoundException)10 Device (org.opensmartgridplatform.domain.core.entities.Device)10 ArrayList (java.util.ArrayList)9