56 lines
1.4 KiB
Java
56 lines
1.4 KiB
Java
package de.ph87.data.location;
|
|
|
|
import de.ph87.data.series.SeriesDto;
|
|
import jakarta.annotation.Nullable;
|
|
import lombok.Data;
|
|
import lombok.NonNull;
|
|
|
|
import static de.ph87.data.Helpers.map;
|
|
|
|
@Data
|
|
public class LocationDto {
|
|
|
|
public final long id;
|
|
|
|
public final long version;
|
|
|
|
public final String name;
|
|
|
|
public final double latitude;
|
|
|
|
public final double longitude;
|
|
|
|
@Nullable
|
|
public final SeriesDto energyPurchase;
|
|
|
|
@Nullable
|
|
public final SeriesDto energyDeliver;
|
|
|
|
@Nullable
|
|
public final SeriesDto energyProduce;
|
|
|
|
@Nullable
|
|
public final SeriesDto powerPurchase;
|
|
|
|
@Nullable
|
|
public final SeriesDto powerDeliver;
|
|
|
|
@Nullable
|
|
public final SeriesDto powerProduce;
|
|
|
|
public LocationDto(@NonNull final Location location) {
|
|
this.id = location.getId();
|
|
this.version = location.getVersion();
|
|
this.name = location.getName();
|
|
this.latitude = location.getLatitude();
|
|
this.longitude = location.getLongitude();
|
|
this.energyPurchase = map(location.getEnergyPurchase(), SeriesDto::new);
|
|
this.energyDeliver = map(location.getEnergyDeliver(), SeriesDto::new);
|
|
this.energyProduce = map(location.getEnergyProduce(), SeriesDto::new);
|
|
this.powerPurchase = map(location.getPowerPurchase(), SeriesDto::new);
|
|
this.powerDeliver = map(location.getPowerDeliver(), SeriesDto::new);
|
|
this.powerProduce = map(location.getPowerProduce(), SeriesDto::new);
|
|
}
|
|
|
|
}
|