Search in sources :

Example 91 with ResponseMessage

use of org.opensmartgridplatform.shared.infra.jms.ResponseMessage in project open-smart-grid-platform by OSGP.

the class ConfigurationService method handleSetMbusUserKeyByChannelResponse.

public void handleSetMbusUserKeyByChannelResponse(final MessageMetadata messageMetadata, final ResponseMessageResultType responseMessageResultType, final OsgpException exception) {
    log.info("handleSetMbusUserKeyByChannelResponse for MessageType: {}", messageMetadata.getMessageType());
    ResponseMessageResultType result = responseMessageResultType;
    if (exception != null) {
        log.error("Set M-Bus User Key By Channel Response not ok. Unexpected Exception", exception);
        result = ResponseMessageResultType.NOT_OK;
    }
    final ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder().withMessageMetadata(messageMetadata).withResult(result).withOsgpException(exception).build();
    this.webServiceResponseMessageSender.send(responseMessage, messageMetadata.getMessageType());
}
Also used : ResponseMessage(org.opensmartgridplatform.shared.infra.jms.ResponseMessage) ResponseMessageResultType(org.opensmartgridplatform.shared.infra.jms.ResponseMessageResultType)

Example 92 with ResponseMessage

use of org.opensmartgridplatform.shared.infra.jms.ResponseMessage in project open-smart-grid-platform by OSGP.

the class ConfigurationService method handleSpecialDaysResponse.

public void handleSpecialDaysResponse(final MessageMetadata messageMetadata, final ResponseMessageResultType deviceResult, final OsgpException exception) {
    log.info("handleSpecialDaysresponse for MessageType: {}", messageMetadata.getMessageType());
    ResponseMessageResultType result = deviceResult;
    if (exception != null) {
        log.error(DEVICE_RESPONSE_NOT_OK_LOG_MSG, exception);
        result = ResponseMessageResultType.NOT_OK;
    }
    final ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder().withMessageMetadata(messageMetadata).withResult(result).withOsgpException(exception).build();
    this.webServiceResponseMessageSender.send(responseMessage, messageMetadata.getMessageType());
}
Also used : ResponseMessage(org.opensmartgridplatform.shared.infra.jms.ResponseMessage) ResponseMessageResultType(org.opensmartgridplatform.shared.infra.jms.ResponseMessageResultType)

Example 93 with ResponseMessage

use of org.opensmartgridplatform.shared.infra.jms.ResponseMessage in project open-smart-grid-platform by OSGP.

the class ConfigurationService method handleConfigureDefinableLoadProfileResponse.

public void handleConfigureDefinableLoadProfileResponse(final MessageMetadata messageMetadata, final ResponseMessageResultType deviceResult, final OsgpException exception) {
    log.info("handleConfigureDefinableLoadProfileResponse for MessageType: {}", messageMetadata.getMessageType());
    ResponseMessageResultType result = deviceResult;
    if (exception != null) {
        log.error("Configure Definable Load Profile Response not ok. Unexpected Exception", exception);
        result = ResponseMessageResultType.NOT_OK;
    }
    final ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder().withMessageMetadata(messageMetadata).withResult(result).withOsgpException(exception).build();
    this.webServiceResponseMessageSender.send(responseMessage, messageMetadata.getMessageType());
}
Also used : ResponseMessage(org.opensmartgridplatform.shared.infra.jms.ResponseMessage) ResponseMessageResultType(org.opensmartgridplatform.shared.infra.jms.ResponseMessageResultType)

Example 94 with ResponseMessage

use of org.opensmartgridplatform.shared.infra.jms.ResponseMessage in project open-smart-grid-platform by OSGP.

the class ConfigurationService method handleGetKeysResponse.

public void handleGetKeysResponse(final MessageMetadata messageMetadata, final ResponseMessageResultType resultType, final OsgpException exception, final GetKeysResponseDto getKeysResponseDto) {
    log.info("handleGetKeysResponse for MessageType: {}", messageMetadata.getMessageType());
    final List<KeyDto> keys = getKeysResponseDto.getKeys();
    final List<GetKeysResponseData> getKeysResponseData = keys.stream().map(key -> new GetKeysResponseData(SecretType.valueOf(key.getSecretType().name()), key.getSecret())).collect(Collectors.toList());
    final GetKeysResponse getKeysResponse = new GetKeysResponse(getKeysResponseData);
    final ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder().withMessageMetadata(messageMetadata).withResult(resultType).withOsgpException(exception).withDataObject(getKeysResponse).build();
    this.webServiceResponseMessageSender.send(responseMessage, messageMetadata.getMessageType());
}
Also used : Arrays(java.util.Arrays) AdministrativeStatusType(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.AdministrativeStatusType) SpecialDaysRequest(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SpecialDaysRequest) ResponseMessageResultType(org.opensmartgridplatform.shared.infra.jms.ResponseMessageResultType) SetKeysRequestDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.SetKeysRequestDto) MessageMetadata(org.opensmartgridplatform.shared.infra.jms.MessageMetadata) Autowired(org.springframework.beans.factory.annotation.Autowired) GetKeysRequestData(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.GetKeysRequestData) SetRandomisationSettingsRequestData(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SetRandomisationSettingsRequestData) GetConfigurationObjectResponse(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.GetConfigurationObjectResponse) ChannelDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.ChannelDto) AlarmNotifications(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.AlarmNotifications) SetKeysRequestData(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SetKeysRequestData) UpdateFirmwareResponse(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.UpdateFirmwareResponse) GetKeysResponseData(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.GetKeysResponseData) DefinableLoadProfileConfigurationDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.DefinableLoadProfileConfigurationDto) GetMbusEncryptionKeyStatusRequestDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.GetMbusEncryptionKeyStatusRequestDto) SetConfigurationObjectRequestDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.SetConfigurationObjectRequestDto) GetMbusEncryptionKeyStatusByChannelRequestData(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.GetMbusEncryptionKeyStatusByChannelRequestData) AdministrativeStatusTypeDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.AdministrativeStatusTypeDto) PushSetupAlarmDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.PushSetupAlarmDto) GetKeysResponse(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.GetKeysResponse) PushSetupSmsDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.PushSetupSmsDto) FirmwareVersionGasResponse(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.FirmwareVersionGasResponse) UpdateFirmwareRequestData(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.UpdateFirmwareRequestData) FirmwareVersionGasDto(org.opensmartgridplatform.dto.valueobjects.FirmwareVersionGasDto) Collectors(java.util.stream.Collectors) ActivityCalendar(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.ActivityCalendar) GetMbusEncryptionKeyStatusByChannelRequestDataDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.GetMbusEncryptionKeyStatusByChannelRequestDataDto) PushSetupAlarm(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.PushSetupAlarm) List(java.util.List) Slf4j(lombok.extern.slf4j.Slf4j) ConfigurationMapper(org.opensmartgridplatform.adapter.domain.smartmetering.application.mapping.ConfigurationMapper) GetKeysRequestDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.GetKeysRequestDto) SetRandomisationSettingsRequestDataDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.SetRandomisationSettingsRequestDataDto) SmartMeter(org.opensmartgridplatform.domain.core.entities.SmartMeter) AlarmNotificationsDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.AlarmNotificationsDto) JmsMessageSender(org.opensmartgridplatform.adapter.domain.smartmetering.infra.jms.core.JmsMessageSender) GetMbusEncryptionKeyStatusResponseDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.GetMbusEncryptionKeyStatusResponseDto) GMeterInfoDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.GMeterInfoDto) GetMbusEncryptionKeyStatusByChannelResponseDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.GetMbusEncryptionKeyStatusByChannelResponseDto) ResponseMessage(org.opensmartgridplatform.shared.infra.jms.ResponseMessage) FunctionalException(org.opensmartgridplatform.shared.exceptionhandling.FunctionalException) SecretType(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SecretType) FunctionalExceptionType(org.opensmartgridplatform.shared.exceptionhandling.FunctionalExceptionType) GetFirmwareVersionQueryDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.GetFirmwareVersionQueryDto) WebServiceResponseMessageSender(org.opensmartgridplatform.adapter.domain.smartmetering.infra.jms.ws.WebServiceResponseMessageSender) SetConfigurationObjectRequest(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SetConfigurationObjectRequest) DefinableLoadProfileConfigurationData(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.DefinableLoadProfileConfigurationData) Service(org.springframework.stereotype.Service) GetFirmwareVersionQuery(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.GetFirmwareVersionQuery) Qualifier(org.springframework.beans.factory.annotation.Qualifier) GetConfigurationObjectRequestDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.GetConfigurationObjectRequestDto) KeyDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.KeyDto) UpdateFirmwareResponseDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.UpdateFirmwareResponseDto) ComponentType(org.opensmartgridplatform.shared.exceptionhandling.ComponentType) EncryptionKeyStatusType(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.EncryptionKeyStatusType) SetClockConfigurationRequestDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.SetClockConfigurationRequestDto) UpdateFirmwareRequestDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.UpdateFirmwareRequestDto) GetConfigurationObjectRequest(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.GetConfigurationObjectRequest) OsgpException(org.opensmartgridplatform.shared.exceptionhandling.OsgpException) FirmwareVersionDto(org.opensmartgridplatform.dto.valueobjects.FirmwareVersionDto) GatewayDeviceNotSetForMbusDeviceException(org.opensmartgridplatform.domain.smartmetering.exceptions.GatewayDeviceNotSetForMbusDeviceException) SpecialDaysRequestDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.SpecialDaysRequestDto) SecretTypeDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.SecretTypeDto) SetClockConfigurationRequestData(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SetClockConfigurationRequestData) FirmwareVersion(org.opensmartgridplatform.domain.core.valueobjects.FirmwareVersion) GetConfigurationObjectResponseDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.GetConfigurationObjectResponseDto) Device(org.opensmartgridplatform.domain.core.entities.Device) FirmwareVersionResponse(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.FirmwareVersionResponse) GetKeysResponseDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.GetKeysResponseDto) SetMbusUserKeyByChannelRequestData(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SetMbusUserKeyByChannelRequestData) PushSetupSms(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.PushSetupSms) SetMbusUserKeyByChannelRequestDataDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.SetMbusUserKeyByChannelRequestDataDto) ActivityCalendarDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.ActivityCalendarDto) Transactional(org.springframework.transaction.annotation.Transactional) KeyDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.KeyDto) GetKeysResponseData(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.GetKeysResponseData) ResponseMessage(org.opensmartgridplatform.shared.infra.jms.ResponseMessage) GetKeysResponse(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.GetKeysResponse)

Example 95 with ResponseMessage

use of org.opensmartgridplatform.shared.infra.jms.ResponseMessage in project open-smart-grid-platform by OSGP.

the class ConfigurationService method handleReplaceKeysResponse.

public void handleReplaceKeysResponse(final MessageMetadata messageMetadata, final ResponseMessageResultType deviceResult, final OsgpException exception) {
    log.info("handleReplaceKeysResponse for MessageType: {}", messageMetadata.getMessageType());
    ResponseMessageResultType result = deviceResult;
    if (exception != null) {
        log.error("Replace Keys Response not ok. Unexpected Exception", exception);
        result = ResponseMessageResultType.NOT_OK;
    }
    final ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder().withMessageMetadata(messageMetadata).withResult(result).withOsgpException(exception).build();
    this.webServiceResponseMessageSender.send(responseMessage, messageMetadata.getMessageType());
}
Also used : ResponseMessage(org.opensmartgridplatform.shared.infra.jms.ResponseMessage) ResponseMessageResultType(org.opensmartgridplatform.shared.infra.jms.ResponseMessageResultType)

Aggregations

ResponseMessage (org.opensmartgridplatform.shared.infra.jms.ResponseMessage)144 ResponseMessageResultType (org.opensmartgridplatform.shared.infra.jms.ResponseMessageResultType)78 OsgpException (org.opensmartgridplatform.shared.exceptionhandling.OsgpException)66 FunctionalException (org.opensmartgridplatform.shared.exceptionhandling.FunctionalException)33 JMSException (javax.jms.JMSException)29 TechnicalException (org.opensmartgridplatform.shared.exceptionhandling.TechnicalException)23 PayloadRoot (org.springframework.ws.server.endpoint.annotation.PayloadRoot)20 ResponsePayload (org.springframework.ws.server.endpoint.annotation.ResponsePayload)20 ConstraintViolationException (javax.validation.ConstraintViolationException)19 Test (org.junit.jupiter.api.Test)19 CorrelationIds (org.opensmartgridplatform.shared.infra.jms.CorrelationIds)18 ValidationException (org.opensmartgridplatform.domain.core.exceptions.ValidationException)16 MessageMetadata (org.opensmartgridplatform.shared.infra.jms.MessageMetadata)12 ObjectMessage (javax.jms.ObjectMessage)9 ProtocolResponseMessage (org.opensmartgridplatform.shared.infra.jms.ProtocolResponseMessage)8 Transactional (org.springframework.transaction.annotation.Transactional)5 ArrayList (java.util.ArrayList)4 Device (org.opensmartgridplatform.domain.core.entities.Device)4 UnknownEntityException (org.opensmartgridplatform.domain.core.exceptions.UnknownEntityException)4 FirmwareVersion (org.opensmartgridplatform.domain.core.valueobjects.FirmwareVersion)4