Search in sources :

Example 1 with OslpLogItemRequestMessage

use of org.opensmartgridplatform.adapter.protocol.oslp.elster.infra.messaging.OslpLogItemRequestMessage in project open-smart-grid-platform by OSGP.

the class LoggingService method logMessage.

public void logMessage(final OslpEnvelope message, final boolean incoming) {
    final String deviceUid = Base64.encodeBase64String(message.getDeviceId());
    String deviceIdentification = this.getDeviceIdentificationFromMessage(message.getPayloadMessage());
    if (StringUtils.isEmpty(deviceIdentification)) {
        deviceIdentification = this.getDeviceIdentification(deviceUid);
    }
    // Assume outgoing messages always valid.
    final boolean isValid = !incoming || message.isValid();
    final OslpLogItemRequestMessage oslpLogItemRequestMessage = new OslpLogItemRequestMessage(null, deviceUid, deviceIdentification, incoming, isValid, message.getPayloadMessage(), message.getSize());
    this.oslpLogItemRequestMessageSender.send(oslpLogItemRequestMessage);
}
Also used : OslpLogItemRequestMessage(org.opensmartgridplatform.adapter.protocol.oslp.elster.infra.messaging.OslpLogItemRequestMessage)

Example 2 with OslpLogItemRequestMessage

use of org.opensmartgridplatform.adapter.protocol.oslp.elster.infra.messaging.OslpLogItemRequestMessage in project open-smart-grid-platform 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(org.opensmartgridplatform.adapter.protocol.oslp.elster.infra.messaging.OslpLogItemRequestMessage) OslpDevice(org.opensmartgridplatform.adapter.protocol.oslp.elster.domain.entities.OslpDevice)

Example 3 with OslpLogItemRequestMessage

use of org.opensmartgridplatform.adapter.protocol.oslp.elster.infra.messaging.OslpLogItemRequestMessage in project open-smart-grid-platform 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(org.opensmartgridplatform.adapter.protocol.oslp.elster.infra.messaging.OslpLogItemRequestMessage) OslpDevice(org.opensmartgridplatform.adapter.protocol.oslp.elster.domain.entities.OslpDevice)

Aggregations

OslpLogItemRequestMessage (org.opensmartgridplatform.adapter.protocol.oslp.elster.infra.messaging.OslpLogItemRequestMessage)3 OslpDevice (org.opensmartgridplatform.adapter.protocol.oslp.elster.domain.entities.OslpDevice)2