use of org.opensmartgridplatform.dto.valueobjects.TransitionMessageDataContainerDto in project open-smart-grid-platform by OSGP.
the class PublicLightingSetTransitionRequestMessageProcessor method processMessage.
@Override
public void processMessage(final ObjectMessage message) throws JMSException {
LOGGER.debug("Processing public lighting set transition request message");
MessageMetadata messageMetadata;
TransitionMessageDataContainerDto transitionMessageDataContainer;
try {
messageMetadata = MessageMetadata.fromMessage(message);
transitionMessageDataContainer = (TransitionMessageDataContainerDto) message.getObject();
} catch (final JMSException e) {
LOGGER.error("UNRECOVERABLE ERROR, unable to read ObjectMessage instance, giving up.", e);
return;
}
final RequestMessageData requestMessageData = RequestMessageData.newBuilder().messageMetadata(messageMetadata).build();
this.printDomainInfo(requestMessageData);
final Iec61850DeviceResponseHandler iec61850DeviceResponseHandler = this.createIec61850DeviceResponseHandler(requestMessageData, message);
final DeviceRequest.Builder deviceRequestBuilder = DeviceRequest.newBuilder().messageMetaData(messageMetadata);
this.deviceService.setTransition(new SetTransitionDeviceRequest(deviceRequestBuilder, transitionMessageDataContainer), iec61850DeviceResponseHandler);
}
use of org.opensmartgridplatform.dto.valueobjects.TransitionMessageDataContainerDto in project open-smart-grid-platform by OSGP.
the class PublicLightingSetTransitionRequestMessageProcessor method processMessage.
@Override
public void processMessage(final ObjectMessage message) {
LOGGER.debug("Processing public lighting set transition request message");
MessageMetadata messageMetadata;
TransitionMessageDataContainerDto transitionMessageDataContainer;
try {
messageMetadata = MessageMetadata.fromMessage(message);
transitionMessageDataContainer = (TransitionMessageDataContainerDto) message.getObject();
} catch (final JMSException e) {
LOGGER.error("UNRECOVERABLE ERROR, unable to read ObjectMessage instance, giving up.", e);
return;
}
try {
this.printDomainInfo(messageMetadata.getMessageType(), messageMetadata.getDomain(), messageMetadata.getDomainVersion());
final SetTransitionDeviceRequest deviceRequest = new SetTransitionDeviceRequest(DeviceRequest.newBuilder().messageMetaData(messageMetadata), transitionMessageDataContainer);
this.deviceService.setTransition(deviceRequest);
} catch (final RuntimeException e) {
this.handleError(e, messageMetadata);
}
}
use of org.opensmartgridplatform.dto.valueobjects.TransitionMessageDataContainerDto in project open-smart-grid-platform by OSGP.
the class SetTransitionService method setTransitionForDevice.
private void setTransitionForDevice(final MessageMetadata metadata, final String ipAddress, @NotNull final TransitionType transitionType, final DateTime transitionTime) {
final String organisationIdentification = metadata.getOrganisationIdentification();
final String deviceIdentification = metadata.getDeviceIdentification();
LOGGER.debug("Private setTransitionForDevice called for device {} with organisation {}", deviceIdentification, organisationIdentification);
final TransitionMessageDataContainerDto transitionMessageDataContainerDto = new TransitionMessageDataContainerDto(this.domainCoreMapper.map(transitionType, org.opensmartgridplatform.dto.valueobjects.TransitionTypeDto.class), transitionTime);
this.osgpCoreRequestMessageSender.send(new RequestMessage(metadata.getCorrelationUid(), organisationIdentification, deviceIdentification, transitionMessageDataContainerDto), metadata.getMessageType(), metadata.getMessagePriority(), ipAddress);
}
Aggregations