mirror of
https://gitlab.com/oeffi/public-transport-enabler.git
synced 2025-07-13 08:10:46 +00:00
AbstractNavitiaProvider: Handle section type 'on_demand_transport'.
This commit is contained in:
parent
ff085d1245
commit
976e5567d7
1 changed files with 5 additions and 3 deletions
|
@ -400,7 +400,7 @@ public abstract class AbstractNavitiaProvider extends AbstractNetworkProvider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Line parseLineFromSection(final JSONObject section) throws IOException {
|
private Line parseLineFromSection(final JSONObject section, final SectionType type) throws IOException {
|
||||||
try {
|
try {
|
||||||
final JSONArray links = section.getJSONArray("links");
|
final JSONArray links = section.getJSONArray("links");
|
||||||
String lineId = null;
|
String lineId = null;
|
||||||
|
@ -414,7 +414,8 @@ public abstract class AbstractNavitiaProvider extends AbstractNetworkProvider {
|
||||||
modeId = link.getString("id");
|
modeId = link.getString("id");
|
||||||
}
|
}
|
||||||
|
|
||||||
final Product product = parseLineProductFromMode(modeId);
|
final Product product = type == SectionType.ON_DEMAND_TRANSPORT ? Product.ON_DEMAND
|
||||||
|
: parseLineProductFromMode(modeId);
|
||||||
final JSONObject displayInfo = section.getJSONObject("display_informations");
|
final JSONObject displayInfo = section.getJSONObject("display_informations");
|
||||||
final String network = Strings.emptyToNull(displayInfo.optString("network"));
|
final String network = Strings.emptyToNull(displayInfo.optString("network"));
|
||||||
final String code = displayInfo.getString("code");
|
final String code = displayInfo.getString("code");
|
||||||
|
@ -477,9 +478,10 @@ public abstract class AbstractNavitiaProvider extends AbstractNetworkProvider {
|
||||||
return new Individual(individualType, legInfo.departure, legInfo.departureTime, legInfo.arrival,
|
return new Individual(individualType, legInfo.departure, legInfo.departureTime, legInfo.arrival,
|
||||||
legInfo.arrivalTime, legInfo.path, legInfo.distance);
|
legInfo.arrivalTime, legInfo.path, legInfo.distance);
|
||||||
}
|
}
|
||||||
|
case ON_DEMAND_TRANSPORT:
|
||||||
case PUBLIC_TRANSPORT: {
|
case PUBLIC_TRANSPORT: {
|
||||||
// Build line.
|
// Build line.
|
||||||
final Line line = parseLineFromSection(section);
|
final Line line = parseLineFromSection(section, sectionType);
|
||||||
|
|
||||||
// Build destination.
|
// Build destination.
|
||||||
final JSONObject displayInfo = section.getJSONObject("display_informations");
|
final JSONObject displayInfo = section.getJSONObject("display_informations");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue