Skip to content

Commit

Permalink
update station mapper with OdP fields
Browse files Browse the repository at this point in the history
  • Loading branch information
gioelemella committed Sep 26, 2024
1 parent e4550ec commit 7d6e4ad
Showing 1 changed file with 75 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,79 +8,81 @@

public class ConvertStazioniToStationDetails implements Converter<Stazioni, Station> {

@Override
public Station convert(MappingContext<Stazioni, Station> context) {
Stazioni source = context.getSource();
Proxy proxy = null;
@Override
public Station convert(MappingContext<Stazioni, Station> context) {
Stazioni source = context.getSource();
Proxy proxy = null;

if (Boolean.TRUE.equals(source.getProxyEnabled())) {
proxy =
Proxy.builder()
.proxyHost(source.getProxyHost())
.proxyPort(source.getProxyPort())
.proxyUsername(source.getProxyUsername())
.proxyPassword(source.getProxyPassword())
.build();
}
if (Boolean.TRUE.equals(source.getProxyEnabled())) {
proxy =
Proxy.builder()
.proxyHost(source.getProxyHost())
.proxyPort(source.getProxyPort())
.proxyUsername(source.getProxyUsername())
.proxyPassword(source.getProxyPassword())
.build();
}

return Station.builder()
.stationCode(source.getIdStazione())
.enabled(source.getEnabled())
.version(source.getVersione())
.password(source.getPassword())
.connection(
Connection.builder()
.protocol(Protocol.fromValue(source.getProtocollo()))
.ip(source.getIp())
.port(source.getPorta())
.build())
.service(
Service.builder()
.path(source.getServizio())
.targetHost(source.getTargetHost())
.targetPort(source.getTargetPort())
.targetPath(source.getTargetPath())
.build())
.pofService(
Service.builder()
.path(source.getServizioPof())
.targetHost(source.getTargetHostPof())
.targetPort(source.getTargetPortPof())
.targetPath(source.getTargetPathPof())
.build())
.mod4Service(
Service.builder()
.path(source.getServizio4Mod())
.targetHost(source.getTargetHost())
.targetPort(source.getTargetPort())
.targetPath(source.getTargetPath())
.build())
.mod4connection(
Connection.builder()
.protocol(Protocol.fromValue(source.getProtocollo4Mod()))
.ip(source.getIp4Mod())
.port(source.getPorta4Mod())
.build())
.brokerCode(source.getIntermediarioPa().getIdIntermediarioPa())
.redirect(
Redirect.builder()
.protocol(Protocol.fromValue(source.getRedirectProtocollo()))
.ip(source.getRedirectIp())
.port(source.getRedirectPorta())
.path(source.getRedirectPath())
.queryString(source.getRedirectQueryString())
.build())
.proxy(proxy)
.threadNumber(source.getNumThread())
.timeouts(
Timeouts.builder()
.timeoutA(source.getTimeoutA())
.timeoutB(source.getTimeoutB())
.timeoutC(source.getTimeoutC())
.build())
.rtInstantaneousDispatch(source.getInvioRtIstantaneo())
.primitiveVersion(source.getVersionePrimitive())
.flagStandIn(source.getFlagStandin())
.build();
}
return Station.builder()
.stationCode(source.getIdStazione())
.enabled(source.getEnabled())
.version(source.getVersione())
.password(source.getPassword())
.connection(
Connection.builder()
.protocol(Protocol.fromValue(source.getProtocollo()))
.ip(source.getIp())
.port(source.getPorta())
.build())
.service(
Service.builder()
.path(source.getServizio())
.targetHost(source.getTargetHost())
.targetPort(source.getTargetPort())
.targetPath(source.getTargetPath())
.build())
.pofService(
Service.builder()
.path(source.getServizioPof())
.targetHost(source.getTargetHostPof())
.targetPort(source.getTargetPortPof())
.targetPath(source.getTargetPathPof())
.build())
.mod4Service(
Service.builder()
.path(source.getServizio4Mod())
.targetHost(source.getTargetHost())
.targetPort(source.getTargetPort())
.targetPath(source.getTargetPath())
.build())
.mod4connection(
Connection.builder()
.protocol(Protocol.fromValue(source.getProtocollo4Mod()))
.ip(source.getIp4Mod())
.port(source.getPorta4Mod())
.build())
.brokerCode(source.getIntermediarioPa().getIdIntermediarioPa())
.redirect(
Redirect.builder()
.protocol(Protocol.fromValue(source.getRedirectProtocollo()))
.ip(source.getRedirectIp())
.port(source.getRedirectPorta())
.path(source.getRedirectPath())
.queryString(source.getRedirectQueryString())
.build())
.proxy(proxy)
.threadNumber(source.getNumThread())
.timeouts(
Timeouts.builder()
.timeoutA(source.getTimeoutA())
.timeoutB(source.getTimeoutB())
.timeoutC(source.getTimeoutC())
.build())
.rtInstantaneousDispatch(source.getInvioRtIstantaneo())
.primitiveVersion(source.getVersionePrimitive())
.flagStandIn(source.getFlagStandin())
.isPaymentOptionsEnabled(source.getIsPaymentOptionsEnabled())
.restEndpoint(source.getRestEndpoint())
.build();
}
}

0 comments on commit 7d6e4ad

Please sign in to comment.