Search in sources :

Example 1 with GroupsOfTariffZonesInFrame_RelStructure

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);
    }
}
Also used : NetexMappingIteratorList(org.rutebanken.tiamat.exporter.async.NetexMappingIteratorList) NetexMappingIterator(org.rutebanken.tiamat.exporter.async.NetexMappingIterator) GroupOfTariffZones(org.rutebanken.tiamat.model.GroupOfTariffZones) GroupsOfTariffZonesInFrame_RelStructure(org.rutebanken.netex.model.GroupsOfTariffZonesInFrame_RelStructure)

Aggregations

GroupsOfTariffZonesInFrame_RelStructure (org.rutebanken.netex.model.GroupsOfTariffZonesInFrame_RelStructure)1 NetexMappingIterator (org.rutebanken.tiamat.exporter.async.NetexMappingIterator)1 NetexMappingIteratorList (org.rutebanken.tiamat.exporter.async.NetexMappingIteratorList)1 GroupOfTariffZones (org.rutebanken.tiamat.model.GroupOfTariffZones)1