Search in sources :

Example 1 with ApiRoute

use of org.opentripplanner.api.model.ApiRoute in project OpenTripPlanner by opentripplanner.

the class RouteMapper method mapToApi.

public static ApiRoute mapToApi(Route domain) {
    if (domain == null) {
        return null;
    }
    ApiRoute api = new ApiRoute();
    api.id = FeedScopedIdMapper.mapToApi(domain.getId());
    api.agency = AgencyMapper.mapToApi(domain.getAgency());
    api.shortName = domain.getShortName();
    api.longName = domain.getLongName();
    api.mode = TraverseModeMapper.mapToApi(domain.getMode());
    api.type = domain.getGtfsType() != null ? domain.getGtfsType() : RouteTypeMapper.mapToApi(domain.getMode());
    api.desc = domain.getDesc();
    api.url = domain.getUrl();
    api.color = domain.getColor();
    api.textColor = domain.getTextColor();
    api.bikesAllowed = BikeAccessMapper.mapToApi(domain.getBikesAllowed());
    api.sortOrder = domain.isSortOrderSet() ? domain.getSortOrder() : null;
    Branding branding = domain.getBranding();
    if (branding != null) {
        api.brandingUrl = branding.getUrl();
    }
    return api;
}
Also used : ApiRoute(org.opentripplanner.api.model.ApiRoute) Branding(org.opentripplanner.model.Branding)

Aggregations

ApiRoute (org.opentripplanner.api.model.ApiRoute)1 Branding (org.opentripplanner.model.Branding)1