use of org.opensmartgridplatform.domain.core.valueobjects.DaliConfiguration in project open-smart-grid-platform by OSGP.
the class DaliConfigurationConverter method convertFrom.
@Override
public org.opensmartgridplatform.adapter.ws.schema.core.configurationmanagement.DaliConfiguration convertFrom(final DaliConfiguration source, final Type<org.opensmartgridplatform.adapter.ws.schema.core.configurationmanagement.DaliConfiguration> destinationType, final MappingContext context) {
if (source == null) {
return null;
}
final org.opensmartgridplatform.adapter.ws.schema.core.configurationmanagement.DaliConfiguration dest = new org.opensmartgridplatform.adapter.ws.schema.core.configurationmanagement.DaliConfiguration();
dest.setNumberOfLights(source.getNumberOfLights());
for (final Map.Entry<Integer, Integer> indexAddressMap : source.getIndexAddressMap().entrySet()) {
final IndexAddressMap addressMap = new IndexAddressMap();
addressMap.setIndex(indexAddressMap.getKey());
addressMap.setAddress(indexAddressMap.getValue());
dest.getIndexAddressMap().add(addressMap);
}
return dest;
}
use of org.opensmartgridplatform.domain.core.valueobjects.DaliConfiguration in project open-smart-grid-platform by OSGP.
the class ConfigurationConverter method convertTo.
@Override
public Configuration convertTo(final org.opensmartgridplatform.dto.valueobjects.ConfigurationDto source, final Type<Configuration> destinationType, final MappingContext context) {
final LightType lightType = this.mapperFacade.map(source.getLightType(), LightType.class);
final DaliConfiguration daliConfiguration = this.mapperFacade.map(source.getDaliConfiguration(), DaliConfiguration.class);
final RelayConfiguration relayConfiguration = this.mapperFacade.map(source.getRelayConfiguration(), RelayConfiguration.class);
final LinkType preferredLinkType = this.mapperFacade.map(source.getPreferredLinkType(), LinkType.class);
final Configuration.Builder builder = new Configuration.Builder().withLightType(lightType).withDaliConfiguration(daliConfiguration).withRelayConfiguration(relayConfiguration).withPreferredLinkType(preferredLinkType).withTimeSyncFrequency(source.getTimeSyncFrequency()).withDhcpEnabled(source.isDhcpEnabled()).withTlsEnabled(source.isTlsEnabled()).withTlsPortNumber(source.getTlsPortNumber()).withCommonNameString(source.getCommonNameString()).withCommunicationTimeout(source.getCommunicationTimeout()).withCommunicationNumberOfRetries(source.getCommunicationNumberOfRetries()).withCommunicationPauseTimeBetweenConnectionTrials(source.getCommunicationPauseTimeBetweenConnectionTrials()).withOsgpIpAddress(source.getOsgpIpAddres()).withOsgpPortNumber(source.getOsgpPortNumber()).withNtpHost(source.getNtpHost()).withNtpEnabled(source.getNtpEnabled()).withNtpSyncInterval(source.getNtpSyncInterval()).withTestButtonEnabled(source.isTestButtonEnabled()).withAutomaticSummerTimingEnabled(source.isAutomaticSummerTimingEnabled()).withAstroGateSunRiseOffset(source.getAstroGateSunRiseOffset()).withAstroGateSunSetOffset(source.getAstroGateSunSetOffset()).withSwitchingDelays(source.getSwitchingDelays()).withRelayRefreshing(source.isRelayRefreshing()).withSummerTimeDetails(source.getSummerTimeDetails()).withWinterTimeDetails(source.getWinterTimeDetails());
if (source.getRelayLinking() != null) {
builder.withRelayLinking(this.mapperFacade.mapAsList(source.getRelayLinking(), org.opensmartgridplatform.domain.core.valueobjects.RelayMatrix.class));
}
if (source.getDeviceFixedIp() != null) {
builder.withDeviceFixedIp(this.mapperFacade.map(source.getDeviceFixedIp(), DeviceFixedIp.class));
}
return builder.build();
}
Aggregations