Search in sources :

Example 96 with ResponseMessage

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

the class ConfigurationService method handleGenerateAndReplaceKeysResponse.

public void handleGenerateAndReplaceKeysResponse(final MessageMetadata messageMetadata, final ResponseMessageResultType deviceResult, final OsgpException exception) {
    log.info("Handle generate and replace keys response for MessageType: {}", messageMetadata.getMessageType());
    ResponseMessageResultType result = deviceResult;
    if (exception != null) {
        log.error("Generate and 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)

Example 97 with ResponseMessage

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

the class ConfigurationService method handleSetEncryptionKeyExchangeOnGMeterResponse.

public void handleSetEncryptionKeyExchangeOnGMeterResponse(final MessageMetadata messageMetadata, final ResponseMessageResultType responseMessageResultType, final OsgpException exception) {
    log.info("handleSetEncryptionKeyExchangeOnGMeterResponse for MessageType: {}", messageMetadata.getMessageType());
    ResponseMessageResultType result = responseMessageResultType;
    if (exception != null) {
        log.error("Set Encryption Key Exchange On G-Meter 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 98 with ResponseMessage

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

the class ManagementService method handleFindEventsResponse.

public void handleFindEventsResponse(final MessageMetadata messageMetadata, final ResponseMessageResultType resultType, final OsgpException osgpException, final EventMessageDataResponseDto eventMessageDataContainerDto) throws FunctionalException {
    this.eventService.enrichEvents(messageMetadata, eventMessageDataContainerDto);
    final EventMessagesResponse eventMessageDataContainer = this.managementMapper.map(eventMessageDataContainerDto, EventMessagesResponse.class);
    // Send the response containing the events to the webservice-adapter
    final ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder().withMessageMetadata(messageMetadata).withResult(resultType).withOsgpException(osgpException).withDataObject(eventMessageDataContainer).build();
    this.webServiceResponseMessageSender.send(responseMessage, messageMetadata.getMessageType());
}
Also used : EventMessagesResponse(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.EventMessagesResponse) ResponseMessage(org.opensmartgridplatform.shared.infra.jms.ResponseMessage)

Example 99 with ResponseMessage

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

the class NotificationService method handlePushNotificationAlarm.

public void handlePushNotificationAlarm(final MessageMetadata messageMetadata, final PushNotificationAlarmDto pushNotificationAlarm) {
    LOGGER.info("handlePushNotificationAlarm for MessageType: {}", messageMetadata.getMessageType());
    final PushNotificationAlarm pushNotificationAlarmDomain = this.mapperFactory.getMapperFacade().map(pushNotificationAlarm, PushNotificationAlarm.class);
    /*
     * Send the push notification alarm as a response message to the web service, so
     * it can be handled similar to response messages based on earlier web service
     * requests.
     */
    final ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder().withMessageMetadata(messageMetadata).withResult(ResponseMessageResultType.OK).withDataObject(pushNotificationAlarmDomain).build();
    this.webServiceResponseMessageSender.send(responseMessage, messageMetadata.getMessageType());
}
Also used : PushNotificationAlarm(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.PushNotificationAlarm) ResponseMessage(org.opensmartgridplatform.shared.infra.jms.ResponseMessage)

Example 100 with ResponseMessage

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

the class MonitoringService method handleGetPowerQualityProfileResponse.

public void handleGetPowerQualityProfileResponse(final MessageMetadata messageMetadata, final ResponseMessageResultType deviceResult, final OsgpException exception, final GetPowerQualityProfileResponseDto getPowerQualityProfileResponseDto) {
    LOGGER.info("GetPowerQualityProfileResponse for MessageType: {}", messageMetadata.getMessageType());
    ResponseMessageResultType result = deviceResult;
    if (exception != null) {
        LOGGER.error(DEVICE_RESPONSE_NOT_OK_LOG_MSG, exception);
        result = ResponseMessageResultType.NOT_OK;
    }
    final GetPowerQualityProfileResponse getPowerQualityProfileResponse = this.monitoringMapper.map(getPowerQualityProfileResponseDto, GetPowerQualityProfileResponse.class);
    final ResponseMessage responseMessage = ResponseMessage.newResponseMessageBuilder().withMessageMetadata(messageMetadata).withResult(result).withOsgpException(exception).withDataObject(getPowerQualityProfileResponse).build();
    this.webServiceResponseMessageSender.send(responseMessage, messageMetadata.getMessageType());
}
Also used : GetPowerQualityProfileResponse(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.GetPowerQualityProfileResponse) 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