Search in sources :

Example 1 with LinkType

use of org.opensmartgridplatform.domain.core.valueobjects.LinkType 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();
}
Also used : LightType(org.opensmartgridplatform.domain.core.valueobjects.LightType) DaliConfiguration(org.opensmartgridplatform.domain.core.valueobjects.DaliConfiguration) DeviceFixedIp(org.opensmartgridplatform.domain.core.valueobjects.DeviceFixedIp) Configuration(org.opensmartgridplatform.domain.core.valueobjects.Configuration) DaliConfiguration(org.opensmartgridplatform.domain.core.valueobjects.DaliConfiguration) RelayConfiguration(org.opensmartgridplatform.domain.core.valueobjects.RelayConfiguration) RelayConfiguration(org.opensmartgridplatform.domain.core.valueobjects.RelayConfiguration) LinkType(org.opensmartgridplatform.domain.core.valueobjects.LinkType)

Aggregations

Configuration (org.opensmartgridplatform.domain.core.valueobjects.Configuration)1 DaliConfiguration (org.opensmartgridplatform.domain.core.valueobjects.DaliConfiguration)1 DeviceFixedIp (org.opensmartgridplatform.domain.core.valueobjects.DeviceFixedIp)1 LightType (org.opensmartgridplatform.domain.core.valueobjects.LightType)1 LinkType (org.opensmartgridplatform.domain.core.valueobjects.LinkType)1 RelayConfiguration (org.opensmartgridplatform.domain.core.valueobjects.RelayConfiguration)1