use of org.opensmartgridplatform.dto.valueobjects.smartmetering.ActualMeterReadsDataGasDto in project open-smart-grid-platform by OSGP.
the class GetActualMeterReadsGasCommandExecutor method fromBundleRequestInput.
@Override
public ActualMeterReadsQueryDto fromBundleRequestInput(final ActionRequestDto bundleInput) throws ProtocolAdapterException {
this.checkActionRequestType(bundleInput);
final ActualMeterReadsDataGasDto actualMeterReadsDataGasDto = (ActualMeterReadsDataGasDto) bundleInput;
return new ActualMeterReadsQueryDto(actualMeterReadsDataGasDto.getChannel());
}
use of org.opensmartgridplatform.dto.valueobjects.smartmetering.ActualMeterReadsDataGasDto in project open-smart-grid-platform by OSGP.
the class ActualMeterReadsRequestGasRequestDataConverter method convert.
@Override
public ActualMeterReadsDataGasDto convert(final ActualMeterReadsGasRequestData value, final SmartMeter smartMeter) throws FunctionalException {
final SmartMeter gasMeter = this.domainHelperService.findSmartMeter(value.getDeviceIdentification());
if (gasMeter.getChannel() == null) {
/*
* For now, throw a FunctionalException. As soon as we can
* communicate with some types of gas meters directly, and not
* through an M-Bus port of an energy meter, this will have to be
* changed.
*/
throw new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, ComponentType.DOMAIN_SMART_METERING, new AssertionError("Meter for gas reads should have a channel configured."));
}
final Device gatewayDevice = gasMeter.getGatewayDevice();
if (gatewayDevice == null) {
/*
* For now throw a FunctionalException, based on the same reasoning
* as with the channel a couple of lines up. As soon as we have
* scenario's with direct communication with gas meters this will
* have to be changed.
*/
throw new FunctionalException(FunctionalExceptionType.VALIDATION_ERROR, ComponentType.DOMAIN_SMART_METERING, new AssertionError("Meter for gas reads should have an energy meter as gateway device."));
}
return new ActualMeterReadsDataGasDto(ChannelDto.fromNumber(gasMeter.getChannel()));
}
Aggregations