Commit 7f726378 authored by Volker Krause's avatar Volker Krause
Browse files

Add post-processing rules for ferry/boat trips

parent 11bd502f
......@@ -23,6 +23,7 @@
#include "knowledgedb/trainstationdb.h"
#include <KItinerary/Action>
#include <KItinerary/BoatTrip>
#include <KItinerary/BusTrip>
#include <KItinerary/Event>
#include <KItinerary/Flight>
......@@ -101,6 +102,8 @@ void ExtractorPostprocessor::process(const QVector<QVariant> &data)
elem = d->processTouristAttractionVisit(elem.value<TouristAttractionVisit>());
} else if (JsonLd::isA<BusReservation>(elem)) {
elem = d->processBusReservation(elem.value<BusReservation>());
} else if (JsonLd::isA<BoatReservation>(elem)) {
elem = d->processBoatReservation(elem.value<BoatReservation>());
} else if (JsonLd::isA<EventReservation>(elem)) {
elem = d->processEventReservation(elem.value<EventReservation>());
} else if (JsonLd::isA<RentalCarReservation>(elem)) {
......@@ -348,6 +351,23 @@ BusTrip ExtractorPostprocessorPrivate::processBusTrip(BusTrip trip) const
return trip;
}
BoatReservation ExtractorPostprocessorPrivate::processBoatReservation(BoatReservation res) const
{
if (res.reservationFor().isValid()) {
res.setReservationFor(processBoatTrip(res.reservationFor().value<BoatTrip>()));
}
return res;
}
BoatTrip ExtractorPostprocessorPrivate::processBoatTrip(BoatTrip trip) const
{
trip.setDepartureBoatTerminal(processPlace(trip.departureBoatTerminal()));
trip.setArrivalBoatTerminal(processPlace(trip.arrivalBoatTerminal()));
trip.setDepartureTime(processTimeForLocation(trip.departureTime(), trip.departureBoatTerminal()));
trip.setArrivalTime(processTimeForLocation(trip.arrivalTime(), trip.arrivalBoatTerminal()));
return trip;
}
LodgingReservation ExtractorPostprocessorPrivate::processLodgingReservation(LodgingReservation res) const
{
if (res.reservationFor().isValid()) {
......
......@@ -16,6 +16,8 @@
namespace KItinerary {
class BoatReservation;
class BoatTrip;
class BusReservation;
class BusTrip;
class Event;
......@@ -52,6 +54,9 @@ public:
BusReservation processBusReservation(BusReservation res) const;
BusTrip processBusTrip(BusTrip trip) const;
BoatReservation processBoatReservation(BoatReservation res) const;
BoatTrip processBoatTrip(BoatTrip trip) const;
LodgingReservation processLodgingReservation(LodgingReservation res) const;
FoodEstablishmentReservation processFoodEstablishmentReservation(FoodEstablishmentReservation res) const;
TouristAttractionVisit processTouristAttractionVisit(TouristAttractionVisit visit) const;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment