package net.contargo.iris.connection.dto;

import net.contargo.iris.route.RoutePartData;

import java.math.BigDecimal;


/**
 * Dto for {@link RoutePartData}.
 *
 * @author  Sandra Thieme - thieme@synyx.de
 */
public class RoutePartDataDto {

    private BigDecimal airlineDistance;
    private BigDecimal distance;
    private BigDecimal dieselDistance;
    private BigDecimal electricDistance;
    private BigDecimal tollDistance;
    private BigDecimal duration;
    private BigDecimal co2;

    public RoutePartDataDto() {

        // needed for Spring MVC instantiation of Controller parameter
    }


    public RoutePartDataDto(RoutePartData data) {

        if (data != null) {
            this.airlineDistance = data.getAirLineDistance();
            this.distance = data.getDistance();
            this.dieselDistance = data.getDieselDistance();
            this.electricDistance = data.getElectricDistance();
            this.tollDistance = data.getTollDistance();
            this.duration = data.getDuration();
            this.co2 = data.getCo2();
        }
    }

    public RoutePartData toRoutePartData() {

        RoutePartData routePartData = new RoutePartData();
        routePartData.setAirLineDistance(airlineDistance);
        routePartData.setDistance(distance);
        routePartData.setDieselDistance(dieselDistance);
        routePartData.setElectricDistance(electricDistance);
        routePartData.setTollDistance(tollDistance);
        routePartData.setDuration(duration);
        routePartData.setCo2(co2);

        return routePartData;
    }


    public BigDecimal getAirlineDistance() {

        return airlineDistance;
    }


    public BigDecimal getDistance() {

        return distance;
    }


    public BigDecimal getDieselDistance() {

        return dieselDistance;
    }


    public BigDecimal getElectricDistance() {

        return electricDistance;
    }


    public BigDecimal getTollDistance() {

        return tollDistance;
    }


    public BigDecimal getDuration() {

        return duration;
    }


    public BigDecimal getCo2() {

        return co2;
    }
}

@@ -340,32 +340,119 @@
 dieselDistance;%0A
+    private BigDecimal bargeDieselDistance;%0A    private BigDecimal railDieselDistance;%0A
     private BigD
@@ -468,32 +468,32 @@
 ectricDistance;%0A
-
     private BigD
@@ -928,32 +928,170 @@
 eselDistance();%0A
+            this.bargeDieselDistance = data.getBargeDieselDistance();%0A            this.railDieselDistance = data.getRailDieselDistance();%0A
             this
@@ -1555,32 +1555,164 @@
 ieselDistance);%0A
+        routePartData.setBargeDieselDistance(bargeDieselDistance);%0A        routePartData.setRailDieselDistance(railDieselDistance);%0A
         routePar
@@ -2123,32 +2123,32 @@
 elDistance() %7B%0A%0A
-
         return d
@@ -2162,32 +2162,218 @@
 stance;%0A    %7D%0A%0A%0A
+    public BigDecimal getBargeDieselDistance() %7B%0A%0A        return bargeDieselDistance;%0A    %7D%0A%0A%0A    public BigDecimal getRailDieselDistance() %7B%0A%0A        return railDieselDistance;%0A    %7D%0A%0A%0A
     public BigDe

Add missing fields to routepartdata dto