Skip to content

Commit

Permalink
SMHE-1602: Add devicemodelcode to MessageMetadata for the protocol ad…
Browse files Browse the repository at this point in the history
…apter

Signed-off-by: Andre Bolder <[email protected]>
  • Loading branch information
Andre Bolder committed Oct 23, 2023
1 parent ea857bb commit 72d14a1
Show file tree
Hide file tree
Showing 12 changed files with 339 additions and 294 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

package org.opensmartgridplatform.adapter.domain.smartmetering.application.services;

import static org.opensmartgridplatform.adapter.domain.smartmetering.application.services.utils.MessageMetadataUtil.*;

import java.io.Serializable;
import lombok.extern.slf4j.Slf4j;
import ma.glasnost.orika.MapperFactory;
Expand Down Expand Up @@ -79,13 +81,7 @@ public void synchronizeTime(
.getMapperFacade()
.map(synchronizeTimeRequestData, SynchronizeTimeRequestDto.class);

this.osgpCoreRequestMessageSender.send(
requestDto,
messageMetadata
.builder()
.withNetworkAddress(smartMeter.getNetworkAddress())
.withNetworkSegmentIds(smartMeter.getBtsId(), smartMeter.getCellId())
.build());
this.osgpCoreRequestMessageSender.send(requestDto, buildMetadata(messageMetadata, smartMeter));
}

public void scheduleTestAlarm(
Expand All @@ -106,13 +102,7 @@ public void scheduleTestAlarm(
.getMapperFacade()
.map(testAlarmSchedulerRequestData, TestAlarmSchedulerRequestDto.class);

this.osgpCoreRequestMessageSender.send(
requestDto,
messageMetadata
.builder()
.withNetworkAddress(smartMeter.getNetworkAddress())
.withNetworkSegmentIds(smartMeter.getBtsId(), smartMeter.getCellId())
.build());
this.osgpCoreRequestMessageSender.send(requestDto, buildMetadata(messageMetadata, smartMeter));
}

public void handleSynchronizeTimeResponse(
Expand Down Expand Up @@ -141,13 +131,7 @@ public void getAllAttributeValues(final MessageMetadata messageMetadata)

final GetAllAttributeValuesRequestDto requestDto = new GetAllAttributeValuesRequestDto();

this.osgpCoreRequestMessageSender.send(
requestDto,
messageMetadata
.builder()
.withNetworkAddress(smartMeter.getNetworkAddress())
.withNetworkSegmentIds(smartMeter.getBtsId(), smartMeter.getCellId())
.build());
this.osgpCoreRequestMessageSender.send(requestDto, buildMetadata(messageMetadata, smartMeter));
}

public void handleGetAllAttributeValuesResponse(
Expand Down Expand Up @@ -179,13 +163,7 @@ public void getAssociationLnObjects(final MessageMetadata messageMetadata)

final GetAssociationLnObjectsRequestDto requestDto = new GetAssociationLnObjectsRequestDto();

this.osgpCoreRequestMessageSender.send(
requestDto,
messageMetadata
.builder()
.withNetworkAddress(smartMeter.getNetworkAddress())
.withNetworkSegmentIds(smartMeter.getBtsId(), smartMeter.getCellId())
.build());
this.osgpCoreRequestMessageSender.send(requestDto, buildMetadata(messageMetadata, smartMeter));
}

public void handleGetAssocationLnObjectsResponse(
Expand Down Expand Up @@ -223,13 +201,7 @@ public void getSpecificAttributeValue(
.getMapperFacade()
.map(request.getObisCode(), ObisCodeValuesDto.class));

this.osgpCoreRequestMessageSender.send(
requestDto,
messageMetadata
.builder()
.withNetworkAddress(smartMeter.getNetworkAddress())
.withNetworkSegmentIds(smartMeter.getBtsId(), smartMeter.getCellId())
.build());
this.osgpCoreRequestMessageSender.send(requestDto, buildMetadata(messageMetadata, smartMeter));
}

public void handleGetSpecificAttributeValueResponse(
Expand Down Expand Up @@ -260,13 +232,7 @@ public void scanMbusChannels(final MessageMetadata messageMetadata) throws Funct

final ScanMbusChannelsRequestDataDto requestDto = new ScanMbusChannelsRequestDataDto();

this.osgpCoreRequestMessageSender.send(
requestDto,
messageMetadata
.builder()
.withNetworkAddress(smartMeter.getNetworkAddress())
.withNetworkSegmentIds(smartMeter.getBtsId(), smartMeter.getCellId())
.build());
this.osgpCoreRequestMessageSender.send(requestDto, buildMetadata(messageMetadata, smartMeter));
}

public void handleScanMbusChannelsResponse(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

package org.opensmartgridplatform.adapter.domain.smartmetering.application.services;

import static org.opensmartgridplatform.adapter.domain.smartmetering.application.services.utils.MessageMetadataUtil.buildMetadata;

import java.util.Arrays;
import java.util.List;
import org.opensmartgridplatform.adapter.domain.smartmetering.application.mapping.ConfigurationMapper;
Expand Down Expand Up @@ -86,13 +88,7 @@ public void handleBundle(

LOGGER.info("Sending request message to core.");

this.osgpCoreRequestMessageSender.send(
requestDto,
messageMetadata
.builder()
.withNetworkAddress(smartMeter.getNetworkAddress())
.withNetworkSegmentIds(smartMeter.getBtsId(), smartMeter.getCellId())
.build());
this.osgpCoreRequestMessageSender.send(requestDto, buildMetadata(messageMetadata, smartMeter));
}

@Transactional(value = "transactionManager")
Expand Down
Loading

0 comments on commit 72d14a1

Please sign in to comment.