Search in sources :

Example 1 with GetMbusEncryptionKeyStatusRequestDto

use of org.opensmartgridplatform.dto.valueobjects.smartmetering.GetMbusEncryptionKeyStatusRequestDto in project open-smart-grid-platform by OSGP.

the class GetMbusEncryptionKeyStatusRequestMessageProcessor method handleMessage.

@Override
protected Serializable handleMessage(final DlmsConnectionManager conn, final DlmsDevice device, final Serializable requestObject, final MessageMetadata messageMetadata) throws OsgpException {
    this.assertRequestObjectType(GetMbusEncryptionKeyStatusRequestDto.class, requestObject);
    final GetMbusEncryptionKeyStatusRequestDto request = (GetMbusEncryptionKeyStatusRequestDto) requestObject;
    return this.configurationService.requestGetMbusEncryptionKeyStatus(conn, device, request, messageMetadata);
}
Also used : GetMbusEncryptionKeyStatusRequestDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.GetMbusEncryptionKeyStatusRequestDto)

Example 2 with GetMbusEncryptionKeyStatusRequestDto

use of org.opensmartgridplatform.dto.valueobjects.smartmetering.GetMbusEncryptionKeyStatusRequestDto in project open-smart-grid-platform by OSGP.

the class GetMbusEncryptionKeyStatusRequestDataMapperTest method shouldConvertValueObjectToDto.

@Test
public void shouldConvertValueObjectToDto() {
    final GetMbusEncryptionKeyStatusRequestData source = this.makeRequest();
    final GetMbusEncryptionKeyStatusRequestDto result = this.mapper.map(source, GetMbusEncryptionKeyStatusRequestDto.class);
    assertThat(result).withFailMessage(MAPPED_OBJECT_VALUE_MESSAGE).isNotNull();
    assertThat(result.getMbusDeviceIdentification()).withFailMessage(MAPPED_FIELD_VALUE_MESSAGE).isEqualTo(source.getMbusDeviceIdentification());
    assertThat(result.getChannel()).withFailMessage(MAPPED_FIELD_VALUE_MESSAGE).isEqualTo(source.getChannel());
}
Also used : GetMbusEncryptionKeyStatusRequestDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.GetMbusEncryptionKeyStatusRequestDto) GetMbusEncryptionKeyStatusRequestData(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.GetMbusEncryptionKeyStatusRequestData) Test(org.junit.jupiter.api.Test)

Example 3 with GetMbusEncryptionKeyStatusRequestDto

use of org.opensmartgridplatform.dto.valueobjects.smartmetering.GetMbusEncryptionKeyStatusRequestDto in project open-smart-grid-platform by OSGP.

the class ConfigurationService method getMbusEncryptionKeyStatus.

public void getMbusEncryptionKeyStatus(final MessageMetadata messageMetadata) throws FunctionalException {
    log.info("getMbusEncryptionKeyStatus for organisationIdentification: {} for deviceIdentification: {}", messageMetadata.getOrganisationIdentification(), messageMetadata.getDeviceIdentification());
    final SmartMeter mbusDevice = this.domainHelperService.findSmartMeter(messageMetadata.getDeviceIdentification());
    final Device gatewayDevice = mbusDevice.getGatewayDevice();
    if (gatewayDevice == null) {
        throw new FunctionalException(FunctionalExceptionType.GATEWAY_DEVICE_NOT_SET_FOR_MBUS_DEVICE, ComponentType.DOMAIN_SMART_METERING, new GatewayDeviceNotSetForMbusDeviceException());
    }
    final GetMbusEncryptionKeyStatusRequestDto requestDto = new GetMbusEncryptionKeyStatusRequestDto(mbusDevice.getDeviceIdentification(), mbusDevice.getChannel());
    this.osgpCoreRequestMessageSender.send(requestDto, messageMetadata.builder().withDeviceIdentification(gatewayDevice.getDeviceIdentification()).withIpAddress(gatewayDevice.getIpAddress()).withNetworkSegmentIds(gatewayDevice.getBtsId(), gatewayDevice.getCellId()).build());
}
Also used : GetMbusEncryptionKeyStatusRequestDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.GetMbusEncryptionKeyStatusRequestDto) GatewayDeviceNotSetForMbusDeviceException(org.opensmartgridplatform.domain.smartmetering.exceptions.GatewayDeviceNotSetForMbusDeviceException) Device(org.opensmartgridplatform.domain.core.entities.Device) SmartMeter(org.opensmartgridplatform.domain.core.entities.SmartMeter) FunctionalException(org.opensmartgridplatform.shared.exceptionhandling.FunctionalException)

Aggregations

GetMbusEncryptionKeyStatusRequestDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.GetMbusEncryptionKeyStatusRequestDto)3 Test (org.junit.jupiter.api.Test)1 Device (org.opensmartgridplatform.domain.core.entities.Device)1 SmartMeter (org.opensmartgridplatform.domain.core.entities.SmartMeter)1 GetMbusEncryptionKeyStatusRequestData (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.GetMbusEncryptionKeyStatusRequestData)1 GatewayDeviceNotSetForMbusDeviceException (org.opensmartgridplatform.domain.smartmetering.exceptions.GatewayDeviceNotSetForMbusDeviceException)1 FunctionalException (org.opensmartgridplatform.shared.exceptionhandling.FunctionalException)1