Search in sources :

Example 1 with OslpLogItemRequestMessage

use of com.alliander.osgp.adapter.protocol.oslp.elster.infra.messaging.OslpLogItemRequestMessage in project Protocol-Adapter-OSLP by OSGP.

the class OslpDeviceService method saveOslpRequestLogEntry.

private void saveOslpRequestLogEntry(final DeviceRequest deviceRequest, final OslpEnvelope oslpRequest) {
    final OslpDevice oslpDevice = this.oslpDeviceSettingsService.getDeviceByDeviceIdentification(deviceRequest.getDeviceIdentification());
    final OslpLogItemRequestMessage oslpLogItemRequestMessage = new OslpLogItemRequestMessage(deviceRequest.getOrganisationIdentification(), oslpDevice.getDeviceUid(), deviceRequest.getDeviceIdentification(), false, true, oslpRequest.getPayloadMessage(), oslpRequest.getSize());
    this.oslpLogItemRequestMessageSender.send(oslpLogItemRequestMessage);
}
Also used : OslpLogItemRequestMessage(com.alliander.osgp.adapter.protocol.oslp.elster.infra.messaging.OslpLogItemRequestMessage) OslpDevice(com.alliander.osgp.adapter.protocol.oslp.elster.domain.entities.OslpDevice)

Example 2 with OslpLogItemRequestMessage

use of com.alliander.osgp.adapter.protocol.oslp.elster.infra.messaging.OslpLogItemRequestMessage in project Protocol-Adapter-OSLP by OSGP.

the class OslpDeviceService method saveOslpResponseLogEntry.

private void saveOslpResponseLogEntry(final DeviceRequest deviceRequest, final OslpEnvelope oslpResponse) {
    final OslpDevice oslpDevice = this.oslpDeviceSettingsService.getDeviceByDeviceIdentification(deviceRequest.getDeviceIdentification());
    final OslpLogItemRequestMessage oslpLogItemRequestMessage = new OslpLogItemRequestMessage(deviceRequest.getOrganisationIdentification(), oslpDevice.getDeviceUid(), deviceRequest.getDeviceIdentification(), true, oslpResponse.isValid(), oslpResponse.getPayloadMessage(), oslpResponse.getSize());
    this.oslpLogItemRequestMessageSender.send(oslpLogItemRequestMessage);
}
Also used : OslpLogItemRequestMessage(com.alliander.osgp.adapter.protocol.oslp.elster.infra.messaging.OslpLogItemRequestMessage) OslpDevice(com.alliander.osgp.adapter.protocol.oslp.elster.domain.entities.OslpDevice)

Example 3 with OslpLogItemRequestMessage

use of com.alliander.osgp.adapter.protocol.oslp.elster.infra.messaging.OslpLogItemRequestMessage in project Protocol-Adapter-OSLP by OSGP.

the class OslpChannelHandler method logMessage.

protected void logMessage(final OslpEnvelope message, final boolean incoming) {
    final String deviceUid = Base64.encodeBase64String(message.getDeviceId());
    String deviceIdentification = this.getDeviceIdentificationFromMessage(message.getPayloadMessage());
    // Assume outgoing messages always valid.
    final boolean isValid = incoming ? message.isValid() : true;
    if (StringUtils.isEmpty(deviceIdentification)) {
        // Getting the deviceIdentification from the oslpDevice instance
        final OslpDevice oslpDevice = this.oslpDeviceRepository.findByDeviceUid(deviceUid);
        if (oslpDevice != null) {
            deviceIdentification = oslpDevice.getDeviceIdentification();
        }
    }
    final OslpLogItemRequestMessage oslpLogItemRequestMessage = new OslpLogItemRequestMessage(null, deviceUid, deviceIdentification, incoming, isValid, message.getPayloadMessage(), message.getSize());
    this.oslpLogItemRequestMessageSender.send(oslpLogItemRequestMessage);
}
Also used : OslpLogItemRequestMessage(com.alliander.osgp.adapter.protocol.oslp.elster.infra.messaging.OslpLogItemRequestMessage) OslpDevice(com.alliander.osgp.adapter.protocol.oslp.elster.domain.entities.OslpDevice)

Aggregations

OslpDevice (com.alliander.osgp.adapter.protocol.oslp.elster.domain.entities.OslpDevice)3 OslpLogItemRequestMessage (com.alliander.osgp.adapter.protocol.oslp.elster.infra.messaging.OslpLogItemRequestMessage)3