use of org.rutebanken.netex.model.GroupsOfTariffZonesInFrame_RelStructure in project tiamat by entur.
the class StreamingPublicationDelivery method prepareGroupOfTariffZones.
private void prepareGroupOfTariffZones(ExportParams exportParams, Set<Long> stopPlaceIds, AtomicInteger mappedGroupOfTariffZonesCount, SiteFrame netexSiteFrame, EntitiesEvictor evicter) {
Iterator<GroupOfTariffZones> groupOfTariffZonesIterator;
if (exportParams.getGroupOfTariffZonesExportMode() == null || exportParams.getGroupOfTariffZonesExportMode().equals(ExportParams.ExportMode.ALL)) {
logger.info("Prepare scrolling for all group of tariff zones");
groupOfTariffZonesIterator = groupOfTariffZonesRepository.scrollGroupOfTariffZones();
} else if (exportParams.getGroupOfTariffZonesExportMode().equals(ExportParams.ExportMode.RELEVANT)) {
logger.info("Prepare scrolling relevant group of tariff zones");
groupOfTariffZonesIterator = groupOfTariffZonesRepository.scrollGroupOfTariffZones(stopPlaceIds);
} else {
logger.info("Group of tariff zones export mode is {}. Will not export group of tariff zones", exportParams.getGroupOfStopPlacesExportMode());
groupOfTariffZonesIterator = Collections.emptyIterator();
}
if (groupOfTariffZonesIterator.hasNext()) {
NetexMappingIterator<GroupOfTariffZones, org.rutebanken.netex.model.GroupOfTariffZones> netexMappingIterator = new NetexMappingIterator<>(netexMapper, groupOfTariffZonesIterator, org.rutebanken.netex.model.GroupOfTariffZones.class, mappedGroupOfTariffZonesCount, evicter);
List<org.rutebanken.netex.model.GroupOfTariffZones> groupOfTariffZonesList = new NetexMappingIteratorList<>(() -> netexMappingIterator);
final GroupsOfTariffZonesInFrame_RelStructure groupsOfTariffZonesInFrame_relStructure = new GroupsOfTariffZonesInFrame_RelStructure();
setField(GroupsOfTariffZonesInFrame_RelStructure.class, "groupOfTariffZones", groupsOfTariffZonesInFrame_relStructure, groupOfTariffZonesList);
netexSiteFrame.setGroupsOfTariffZones(groupsOfTariffZonesInFrame_relStructure);
}
}
Aggregations