Search in sources :

Example 1 with BlockInstanceBean

use of org.onebusaway.transit_data.model.blocks.BlockInstanceBean in project onebusaway-application-modules by camsys.

the class SiriSupportV2 method fillMonitoredVehicleJourney.

/**
 * NOTE: The tripDetails bean here may not be for the trip the vehicle is
 * currently on in the case of A-D for stop!
 * @param filters
 */
public static void fillMonitoredVehicleJourney(MonitoredVehicleJourneyStructure monitoredVehicleJourney, TripBean framedJourneyTripBean, TripStatusBean currentVehicleTripStatus, StopBean monitoredCallStopBean, OnwardCallsMode onwardCallsMode, PresentationService presentationService, TransitDataService transitDataService, int maximumOnwardCalls, List<TimepointPredictionRecord> stopLevelPredictions, boolean hasRealtimeData, DetailLevel detailLevel, long responseTimestamp, Map<Filters, String> filters) {
    BlockInstanceBean blockInstance = transitDataService.getBlockInstance(currentVehicleTripStatus.getActiveTrip().getBlockId(), currentVehicleTripStatus.getServiceDate());
    List<BlockTripBean> blockTrips = blockInstance.getBlockConfiguration().getTrips();
    if (monitoredCallStopBean == null) {
        monitoredCallStopBean = currentVehicleTripStatus.getNextStop();
    }
    /**
     *******************************************
     */
    // Route ID
    LineRefStructure lineRef = new LineRefStructure();
    lineRef.setValue(framedJourneyTripBean.getRoute().getId());
    DirectionRefStructure directionRef = new DirectionRefStructure();
    directionRef.setValue(framedJourneyTripBean.getDirectionId());
    // Route Short Name
    NaturalLanguageStringStructure routeShortName = new NaturalLanguageStringStructure();
    String shortName = framedJourneyTripBean.getRoute().getShortName();
    if (!isBlank(currentVehicleTripStatus.getActiveTrip().getRouteShortName())) {
        // look for an override like an express desginator
        shortName = currentVehicleTripStatus.getActiveTrip().getRouteShortName();
    }
    if (shortName == null) {
        shortName = framedJourneyTripBean.getRoute().getId().split("_")[1];
    }
    routeShortName.setValue(shortName);
    // Agency Id
    OperatorRefStructure operatorRef = new OperatorRefStructure();
    operatorRef.setValue(AgencySupportLibrary.getAgencyForId(framedJourneyTripBean.getRoute().getId()));
    // Framed Journey
    FramedVehicleJourneyRefStructure framedJourney = new FramedVehicleJourneyRefStructure();
    DataFrameRefStructure dataFrame = new DataFrameRefStructure();
    dataFrame.setValue(String.format("%1$tY-%1$tm-%1$td", currentVehicleTripStatus.getServiceDate()));
    framedJourney.setDataFrameRef(dataFrame);
    framedJourney.setDatedVehicleJourneyRef(framedJourneyTripBean.getId());
    // Shape Id
    JourneyPatternRefStructure journeyPattern = new JourneyPatternRefStructure();
    journeyPattern.setValue(framedJourneyTripBean.getShapeId());
    // Destination
    NaturalLanguageStringStructure headsign = new NaturalLanguageStringStructure();
    headsign.setValue(framedJourneyTripBean.getTripHeadsign());
    // Vehicle Id
    VehicleRefStructure vehicleRef = new VehicleRefStructure();
    if (currentVehicleTripStatus.getVehicleId() == null) {
        String tripId = framedJourneyTripBean.getId();
        String blockId = framedJourneyTripBean.getBlockId();
        String directionId = framedJourneyTripBean.getDirectionId();
        String vehicleIdHash = Integer.toString((tripId + blockId + directionId).hashCode());
        String agencyName = tripId.split("_")[0];
        String vehicleId = agencyName + "_" + vehicleIdHash;
        vehicleRef.setValue(vehicleId);
    } else {
        vehicleRef.setValue(currentVehicleTripStatus.getVehicleId());
    }
    // Set Origin and Destination stops from Block trips.
    StopBean lastStop = new StopBean();
    JourneyPlaceRefStructure origin = new JourneyPlaceRefStructure();
    for (int i = 0; i < blockTrips.size(); i++) {
        BlockTripBean blockTrip = blockTrips.get(i);
        if (blockTrip.getTrip().getId().equals(framedJourneyTripBean.getId())) {
            List<BlockStopTimeBean> stops = blockTrip.getBlockStopTimes();
            origin.setValue(stops.get(0).getStopTime().getStop().getId());
            lastStop = stops.get(stops.size() - 1).getStopTime().getStop();
            break;
        }
    }
    // location
    // if vehicle is detected to be on detour, use actual lat/lon, not
    // snapped location.
    LocationStructure location = new LocationStructure();
    DecimalFormat df = new DecimalFormat();
    df.setMaximumFractionDigits(6);
    if (presentationService.isOnDetour(currentVehicleTripStatus)) {
        location.setLatitude(new BigDecimal(df.format(currentVehicleTripStatus.getLastKnownLocation().getLat())));
        location.setLongitude(new BigDecimal(df.format(currentVehicleTripStatus.getLastKnownLocation().getLon())));
    } else {
        location.setLatitude(new BigDecimal(df.format(currentVehicleTripStatus.getLocation().getLat())));
        location.setLongitude(new BigDecimal(df.format(currentVehicleTripStatus.getLocation().getLon())));
    }
    // progress status
    List<String> progressStatuses = new ArrayList<String>();
    if (presentationService.isInLayover(currentVehicleTripStatus)) {
        progressStatuses.add("layover");
    }
    // "prevTrip" really means not on the framedvehiclejourney trip
    if (!framedJourneyTripBean.getId().equals(currentVehicleTripStatus.getActiveTrip().getId())) {
        progressStatuses.add("prevTrip");
    }
    if (!progressStatuses.isEmpty()) {
        NaturalLanguageStringStructure progressStatus = new NaturalLanguageStringStructure();
        progressStatus.setValue(StringUtils.join(progressStatuses, ","));
        monitoredVehicleJourney.getProgressStatus().add(progressStatus);
    }
    // scheduled depature time
    if (presentationService.isBlockLevelInference(currentVehicleTripStatus) && (presentationService.isInLayover(currentVehicleTripStatus) || !framedJourneyTripBean.getId().equals(currentVehicleTripStatus.getActiveTrip().getId()))) {
        BlockStopTimeBean originDepartureStopTime = null;
        for (int t = 0; t < blockTrips.size(); t++) {
            BlockTripBean thisTrip = blockTrips.get(t);
            BlockTripBean nextTrip = null;
            if (t + 1 < blockTrips.size()) {
                nextTrip = blockTrips.get(t + 1);
            }
            if (thisTrip.getTrip().getId().equals(currentVehicleTripStatus.getActiveTrip().getId())) {
                // just started new trip
                if (currentVehicleTripStatus.getDistanceAlongTrip() < (0.5 * currentVehicleTripStatus.getTotalDistanceAlongTrip())) {
                    originDepartureStopTime = thisTrip.getBlockStopTimes().get(0);
                // at end of previous trip
                } else {
                    if (nextTrip != null) {
                        originDepartureStopTime = nextTrip.getBlockStopTimes().get(0);
                    }
                }
                break;
            }
        }
        if (originDepartureStopTime != null) {
            long departureTime = currentVehicleTripStatus.getServiceDate() + (originDepartureStopTime.getStopTime().getDepartureTime() * 1000);
            monitoredVehicleJourney.setOriginAimedDepartureTime(DateUtil.toXmlGregorianCalendar(departureTime));
        }
    }
    Map<String, TimepointPredictionRecord> stopIdToPredictionRecordMap = new HashMap<String, TimepointPredictionRecord>();
    // (build map of stop IDs to TPRs)
    if (stopLevelPredictions != null) {
        for (TimepointPredictionRecord tpr : stopLevelPredictions) {
            stopIdToPredictionRecordMap.put(AgencyAndId.convertToString(tpr.getTimepointId()), tpr);
        }
    }
    // monitored call
    if (!presentationService.isOnDetour(currentVehicleTripStatus))
        fillMonitoredCall(monitoredVehicleJourney, blockInstance, currentVehicleTripStatus, monitoredCallStopBean, presentationService, transitDataService, stopIdToPredictionRecordMap, hasRealtimeData, detailLevel, responseTimestamp);
    // detail level - minimal
    if (detailLevel.equals(DetailLevel.MINIMUM) || detailLevel.equals(DetailLevel.BASIC) || detailLevel.equals(DetailLevel.NORMAL) || detailLevel.equals(DetailLevel.CALLS)) {
        monitoredVehicleJourney.getPublishedLineName().add(routeShortName);
        monitoredVehicleJourney.getDestinationName().add(headsign);
        monitoredVehicleJourney.setMonitored(currentVehicleTripStatus.isPredicted());
        monitoredVehicleJourney.getVehicleMode().add(toVehicleMode(currentVehicleTripStatus.getVehicleType()));
        monitoredVehicleJourney.setVehicleRef(vehicleRef);
        monitoredVehicleJourney.setBearing((float) currentVehicleTripStatus.getOrientation());
        monitoredVehicleJourney.setVehicleLocation(location);
    }
    // detail level - basic
    if (detailLevel.equals(DetailLevel.BASIC) || detailLevel.equals(DetailLevel.NORMAL) || detailLevel.equals(DetailLevel.CALLS)) {
        monitoredVehicleJourney.setFramedVehicleJourneyRef(framedJourney);
        monitoredVehicleJourney.setDirectionRef(directionRef);
        // since LineRef is fully qualified with operatorref, moving OperatorRef to normal detail
        // monitoredVehicleJourney.setOperatorRef(operatorRef);
        DestinationRefStructure dest = new DestinationRefStructure();
        dest.setValue(lastStop.getId());
        monitoredVehicleJourney.setDestinationRef(dest);
        monitoredVehicleJourney.setLineRef(lineRef);
        monitoredVehicleJourney.setProgressRate(getProgressRateForPhaseAndStatus(currentVehicleTripStatus.getStatus(), currentVehicleTripStatus.getPhase()));
    }
    // detail level - normal
    if (detailLevel.equals(DetailLevel.NORMAL) || detailLevel.equals(DetailLevel.CALLS)) {
        monitoredVehicleJourney.setOperatorRef(operatorRef);
        // block ref
        if (presentationService.isBlockLevelInference(currentVehicleTripStatus)) {
            BlockRefStructure blockRef = new BlockRefStructure();
            blockRef.setValue(framedJourneyTripBean.getBlockId());
            monitoredVehicleJourney.setBlockRef(blockRef);
        }
        monitoredVehicleJourney.setOriginRef(origin);
        monitoredVehicleJourney.setJourneyPatternRef(journeyPattern);
    }
    // onward calls
    if (detailLevel.equals(DetailLevel.CALLS)) {
        if (!presentationService.isOnDetour(currentVehicleTripStatus))
            fillOnwardCalls(monitoredVehicleJourney, blockInstance, framedJourneyTripBean, currentVehicleTripStatus, onwardCallsMode, presentationService, transitDataService, stopIdToPredictionRecordMap, maximumOnwardCalls, responseTimestamp);
    }
    // situations
    fillSituations(monitoredVehicleJourney, currentVehicleTripStatus);
    return;
}
Also used : NaturalLanguageStringStructure(uk.org.siri.siri_2.NaturalLanguageStringStructure) BlockTripBean(org.onebusaway.transit_data.model.blocks.BlockTripBean) HashMap(java.util.HashMap) DestinationRefStructure(uk.org.siri.siri_2.DestinationRefStructure) DecimalFormat(java.text.DecimalFormat) ArrayList(java.util.ArrayList) LocationStructure(uk.org.siri.siri_2.LocationStructure) DataFrameRefStructure(uk.org.siri.siri_2.DataFrameRefStructure) BlockStopTimeBean(org.onebusaway.transit_data.model.blocks.BlockStopTimeBean) OperatorRefStructure(uk.org.siri.siri_2.OperatorRefStructure) JourneyPlaceRefStructure(uk.org.siri.siri_2.JourneyPlaceRefStructure) FramedVehicleJourneyRefStructure(uk.org.siri.siri_2.FramedVehicleJourneyRefStructure) JourneyPatternRefStructure(uk.org.siri.siri_2.JourneyPatternRefStructure) BlockRefStructure(uk.org.siri.siri_2.BlockRefStructure) LineRefStructure(uk.org.siri.siri_2.LineRefStructure) BigDecimal(java.math.BigDecimal) BlockInstanceBean(org.onebusaway.transit_data.model.blocks.BlockInstanceBean) TimepointPredictionRecord(org.onebusaway.realtime.api.TimepointPredictionRecord) StopBean(org.onebusaway.transit_data.model.StopBean) DirectionRefStructure(uk.org.siri.siri_2.DirectionRefStructure) VehicleRefStructure(uk.org.siri.siri_2.VehicleRefStructure)

Example 2 with BlockInstanceBean

use of org.onebusaway.transit_data.model.blocks.BlockInstanceBean in project onebusaway-application-modules by camsys.

the class BlockInstanceAction method show.

public DefaultHttpHeaders show() throws ServiceException {
    if (!isVersion(V2))
        return setUnknownVersionResponse();
    if (hasErrors())
        return setValidationErrorsResponse();
    BlockInstanceBean blockInstance = _service.getBlockInstance(_id, _serviceDate);
    if (blockInstance == null)
        return setResourceNotFoundResponse();
    BeanFactoryV2 factory = getBeanFactoryV2();
    BlockInstanceV2Bean bean = factory.getBlockInstance(blockInstance);
    EntryWithReferencesBean<BlockInstanceV2Bean> response = factory.entry(bean);
    return setOkResponse(response);
}
Also used : BlockInstanceV2Bean(org.onebusaway.api.model.transit.blocks.BlockInstanceV2Bean) BlockInstanceBean(org.onebusaway.transit_data.model.blocks.BlockInstanceBean) BeanFactoryV2(org.onebusaway.api.model.transit.BeanFactoryV2)

Example 3 with BlockInstanceBean

use of org.onebusaway.transit_data.model.blocks.BlockInstanceBean in project onebusaway-application-modules by camsys.

the class SiriSupport method fillMonitoredVehicleJourney.

/**
 * NOTE: The tripDetails bean here may not be for the trip the vehicle is currently on
 * in the case of A-D for stop!
 */
@SuppressWarnings("unused")
public static void fillMonitoredVehicleJourney(MonitoredVehicleJourneyStructure monitoredVehicleJourney, TripBean framedJourneyTripBean, TripStatusBean currentVehicleTripStatus, StopBean monitoredCallStopBean, OnwardCallsMode onwardCallsMode, PresentationService presentationService, TransitDataService transitDataService, int maximumOnwardCalls, List<TimepointPredictionRecord> stopLevelPredictions, boolean hasRealtimeData, long responseTimestamp, boolean showRawLocation) {
    BlockInstanceBean blockInstance = transitDataService.getBlockInstance(currentVehicleTripStatus.getActiveTrip().getBlockId(), currentVehicleTripStatus.getServiceDate());
    List<BlockTripBean> blockTrips = blockInstance.getBlockConfiguration().getTrips();
    if (monitoredCallStopBean == null) {
        monitoredCallStopBean = currentVehicleTripStatus.getNextStop();
    }
    // ///////////
    LineRefStructure lineRef = new LineRefStructure();
    lineRef.setValue(framedJourneyTripBean.getRoute().getId());
    monitoredVehicleJourney.setLineRef(lineRef);
    OperatorRefStructure operatorRef = new OperatorRefStructure();
    operatorRef.setValue(framedJourneyTripBean.getRoute().getId().split("_")[0]);
    monitoredVehicleJourney.setOperatorRef(operatorRef);
    DirectionRefStructure directionRef = new DirectionRefStructure();
    directionRef.setValue(framedJourneyTripBean.getDirectionId());
    monitoredVehicleJourney.setDirectionRef(directionRef);
    NaturalLanguageStringStructure routeShortName = new NaturalLanguageStringStructure();
    String shortName = framedJourneyTripBean.getRoute().getShortName();
    if (shortName == null) {
        shortName = framedJourneyTripBean.getRoute().getId().split("_")[1];
    }
    if (!isBlank(currentVehicleTripStatus.getActiveTrip().getRouteShortName())) {
        // look for an override like an express desginator
        routeShortName.setValue(currentVehicleTripStatus.getActiveTrip().getRouteShortName());
    } else {
        routeShortName.setValue(shortName);
    }
    monitoredVehicleJourney.setPublishedLineName(routeShortName);
    JourneyPatternRefStructure journeyPattern = new JourneyPatternRefStructure();
    journeyPattern.setValue(framedJourneyTripBean.getShapeId());
    monitoredVehicleJourney.setJourneyPatternRef(journeyPattern);
    NaturalLanguageStringStructure headsign = new NaturalLanguageStringStructure();
    headsign.setValue(framedJourneyTripBean.getTripHeadsign());
    monitoredVehicleJourney.setDestinationName(headsign);
    VehicleRefStructure vehicleRef = new VehicleRefStructure();
    if (currentVehicleTripStatus.getVehicleId() == null) {
        String tripId = framedJourneyTripBean.getId();
        String blockId = framedJourneyTripBean.getBlockId();
        String directionId = framedJourneyTripBean.getDirectionId();
        String vehicleIdHash = Integer.toString((tripId + blockId + directionId).hashCode());
        String agencyName = tripId.split("_")[0];
        String vehicleId = agencyName + "_" + vehicleIdHash;
        vehicleRef.setValue(vehicleId);
    } else {
        vehicleRef.setValue(currentVehicleTripStatus.getVehicleId());
    }
    monitoredVehicleJourney.setVehicleRef(vehicleRef);
    monitoredVehicleJourney.getVehicleMode().add(toVehicleMode(currentVehicleTripStatus.getVehicleType()));
    monitoredVehicleJourney.setMonitored(currentVehicleTripStatus.isPredicted());
    monitoredVehicleJourney.setBearing((float) currentVehicleTripStatus.getOrientation());
    monitoredVehicleJourney.setProgressRate(getProgressRateForPhaseAndStatus(currentVehicleTripStatus.getStatus(), currentVehicleTripStatus.getPhase()));
    // origin-destination
    for (int i = 0; i < blockTrips.size(); i++) {
        BlockTripBean blockTrip = blockTrips.get(i);
        if (blockTrip.getTrip().getId().equals(framedJourneyTripBean.getId())) {
            List<BlockStopTimeBean> stops = blockTrip.getBlockStopTimes();
            JourneyPlaceRefStructure origin = new JourneyPlaceRefStructure();
            origin.setValue(stops.get(0).getStopTime().getStop().getId());
            monitoredVehicleJourney.setOriginRef(origin);
            StopBean lastStop = stops.get(stops.size() - 1).getStopTime().getStop();
            DestinationRefStructure dest = new DestinationRefStructure();
            dest.setValue(lastStop.getId());
            monitoredVehicleJourney.setDestinationRef(dest);
            break;
        }
    }
    // framed journey
    FramedVehicleJourneyRefStructure framedJourney = new FramedVehicleJourneyRefStructure();
    DataFrameRefStructure dataFrame = new DataFrameRefStructure();
    dataFrame.setValue(String.format("%1$tY-%1$tm-%1$td", currentVehicleTripStatus.getServiceDate()));
    framedJourney.setDataFrameRef(dataFrame);
    framedJourney.setDatedVehicleJourneyRef(framedJourneyTripBean.getId());
    monitoredVehicleJourney.setFramedVehicleJourneyRef(framedJourney);
    // location
    // if vehicle is detected to be on detour, use actual lat/lon, not snapped location.
    LocationStructure location = new LocationStructure();
    DecimalFormat df = new DecimalFormat();
    df.setMaximumFractionDigits(6);
    // if we want to show the raw location AND we have realtime or if its on detour, show actual location
    if ((showRawLocation && currentVehicleTripStatus.getLastKnownLocation() != null) || (presentationService.isOnDetour(currentVehicleTripStatus))) {
        location.setLatitude(new BigDecimal(df.format(currentVehicleTripStatus.getLastKnownLocation().getLat())));
        location.setLongitude(new BigDecimal(df.format(currentVehicleTripStatus.getLastKnownLocation().getLon())));
    } else {
        // show snapped location
        if (currentVehicleTripStatus.getLocation() != null) {
            location.setLatitude(new BigDecimal(df.format(currentVehicleTripStatus.getLocation().getLat())));
            location.setLongitude(new BigDecimal(df.format(currentVehicleTripStatus.getLocation().getLon())));
        }
    }
    monitoredVehicleJourney.setVehicleLocation(location);
    // progress status
    List<String> progressStatuses = new ArrayList<String>();
    if (presentationService.isInLayover(currentVehicleTripStatus)) {
        progressStatuses.add("layover");
    }
    // "prevTrip" really means not on the framedvehiclejourney trip
    if (!framedJourneyTripBean.getId().equals(currentVehicleTripStatus.getActiveTrip().getId())) {
        progressStatuses.add("prevTrip");
    }
    if (!progressStatuses.isEmpty()) {
        NaturalLanguageStringStructure progressStatus = new NaturalLanguageStringStructure();
        progressStatus.setValue(StringUtils.join(progressStatuses, ","));
        monitoredVehicleJourney.setProgressStatus(progressStatus);
    }
    // block ref
    if (presentationService.isBlockLevelInference(currentVehicleTripStatus)) {
        BlockRefStructure blockRef = new BlockRefStructure();
        blockRef.setValue(framedJourneyTripBean.getBlockId());
        monitoredVehicleJourney.setBlockRef(blockRef);
    }
    // scheduled depature time
    if (presentationService.isBlockLevelInference(currentVehicleTripStatus) && (presentationService.isInLayover(currentVehicleTripStatus) || !framedJourneyTripBean.getId().equals(currentVehicleTripStatus.getActiveTrip().getId()))) {
        BlockStopTimeBean originDepartureStopTime = null;
        for (int t = 0; t < blockTrips.size(); t++) {
            BlockTripBean thisTrip = blockTrips.get(t);
            BlockTripBean nextTrip = null;
            if (t + 1 < blockTrips.size()) {
                nextTrip = blockTrips.get(t + 1);
            }
            if (thisTrip.getTrip().getId().equals(currentVehicleTripStatus.getActiveTrip().getId())) {
                // just started new trip
                if (currentVehicleTripStatus.getDistanceAlongTrip() < (0.5 * currentVehicleTripStatus.getTotalDistanceAlongTrip())) {
                    originDepartureStopTime = thisTrip.getBlockStopTimes().get(0);
                // at end of previous trip
                } else {
                    if (nextTrip != null) {
                        originDepartureStopTime = nextTrip.getBlockStopTimes().get(0);
                    }
                }
                break;
            }
        }
        if (originDepartureStopTime != null) {
            Date departureTime = new Date(currentVehicleTripStatus.getServiceDate() + (originDepartureStopTime.getStopTime().getDepartureTime() * 1000));
            monitoredVehicleJourney.setOriginAimedDepartureTime(departureTime);
        }
    }
    Map<String, TimepointPredictionRecord> stopIdToPredictionRecordMap = new HashMap<String, TimepointPredictionRecord>();
    // (build map of vehicle IDs to TPRs)
    if (stopLevelPredictions != null) {
        for (TimepointPredictionRecord tpr : stopLevelPredictions) {
            stopIdToPredictionRecordMap.put(AgencyAndId.convertToString(tpr.getTimepointId()), tpr);
        }
    }
    // monitored call
    if (!presentationService.isOnDetour(currentVehicleTripStatus))
        fillMonitoredCall(monitoredVehicleJourney, blockInstance, currentVehicleTripStatus, monitoredCallStopBean, presentationService, transitDataService, stopIdToPredictionRecordMap, hasRealtimeData, responseTimestamp);
    // onward calls
    if (!presentationService.isOnDetour(currentVehicleTripStatus))
        fillOnwardCalls(monitoredVehicleJourney, blockInstance, framedJourneyTripBean, currentVehicleTripStatus, onwardCallsMode, presentationService, transitDataService, stopIdToPredictionRecordMap, maximumOnwardCalls, hasRealtimeData, responseTimestamp);
    // situations
    fillSituations(monitoredVehicleJourney, currentVehicleTripStatus);
    return;
}
Also used : NaturalLanguageStringStructure(uk.org.siri.siri.NaturalLanguageStringStructure) BlockTripBean(org.onebusaway.transit_data.model.blocks.BlockTripBean) DestinationRefStructure(uk.org.siri.siri.DestinationRefStructure) HashMap(java.util.HashMap) DecimalFormat(java.text.DecimalFormat) ArrayList(java.util.ArrayList) LocationStructure(uk.org.siri.siri.LocationStructure) BlockStopTimeBean(org.onebusaway.transit_data.model.blocks.BlockStopTimeBean) DataFrameRefStructure(uk.org.siri.siri.DataFrameRefStructure) OperatorRefStructure(uk.org.siri.siri.OperatorRefStructure) JourneyPlaceRefStructure(uk.org.siri.siri.JourneyPlaceRefStructure) FramedVehicleJourneyRefStructure(uk.org.siri.siri.FramedVehicleJourneyRefStructure) JourneyPatternRefStructure(uk.org.siri.siri.JourneyPatternRefStructure) BlockRefStructure(uk.org.siri.siri.BlockRefStructure) LineRefStructure(uk.org.siri.siri.LineRefStructure) BigDecimal(java.math.BigDecimal) Date(java.util.Date) BlockInstanceBean(org.onebusaway.transit_data.model.blocks.BlockInstanceBean) TimepointPredictionRecord(org.onebusaway.realtime.api.TimepointPredictionRecord) StopBean(org.onebusaway.transit_data.model.StopBean) DirectionRefStructure(uk.org.siri.siri.DirectionRefStructure) VehicleRefStructure(uk.org.siri.siri.VehicleRefStructure)

Example 4 with BlockInstanceBean

use of org.onebusaway.transit_data.model.blocks.BlockInstanceBean in project onebusaway-application-modules by camsys.

the class BlockBeanServiceImpl method getBlockInstanceAsBean.

/**
 **
 * Private Methods
 ***
 */
private BlockInstanceBean getBlockInstanceAsBean(BlockInstance blockInstance) {
    BlockInstanceBean bean = new BlockInstanceBean();
    BlockConfigurationBean blockConfig = getBlockConfigurationAsBean(blockInstance.getBlock());
    bean.setBlockId(blockConfig.getBlockId());
    bean.setBlockConfiguration(blockConfig);
    long serviceDate = blockInstance.getServiceDate();
    bean.setServiceDate(serviceDate);
    return bean;
}
Also used : BlockInstanceBean(org.onebusaway.transit_data.model.blocks.BlockInstanceBean) BlockConfigurationBean(org.onebusaway.transit_data.model.blocks.BlockConfigurationBean)

Aggregations

BlockInstanceBean (org.onebusaway.transit_data.model.blocks.BlockInstanceBean)4 BigDecimal (java.math.BigDecimal)2 DecimalFormat (java.text.DecimalFormat)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 TimepointPredictionRecord (org.onebusaway.realtime.api.TimepointPredictionRecord)2 StopBean (org.onebusaway.transit_data.model.StopBean)2 BlockStopTimeBean (org.onebusaway.transit_data.model.blocks.BlockStopTimeBean)2 BlockTripBean (org.onebusaway.transit_data.model.blocks.BlockTripBean)2 Date (java.util.Date)1 BeanFactoryV2 (org.onebusaway.api.model.transit.BeanFactoryV2)1 BlockInstanceV2Bean (org.onebusaway.api.model.transit.blocks.BlockInstanceV2Bean)1 BlockConfigurationBean (org.onebusaway.transit_data.model.blocks.BlockConfigurationBean)1 BlockRefStructure (uk.org.siri.siri.BlockRefStructure)1 DataFrameRefStructure (uk.org.siri.siri.DataFrameRefStructure)1 DestinationRefStructure (uk.org.siri.siri.DestinationRefStructure)1 DirectionRefStructure (uk.org.siri.siri.DirectionRefStructure)1 FramedVehicleJourneyRefStructure (uk.org.siri.siri.FramedVehicleJourneyRefStructure)1 JourneyPatternRefStructure (uk.org.siri.siri.JourneyPatternRefStructure)1 JourneyPlaceRefStructure (uk.org.siri.siri.JourneyPlaceRefStructure)1