Skip to content

Commit

Permalink
Merge pull request #5851 from ibi-group/remove-fare-id
Browse files Browse the repository at this point in the history
Remove non-standard trip fare ID
  • Loading branch information
leonardehrenfried authored May 16, 2024
2 parents dac395d + 6282200 commit c3147f5
Show file tree
Hide file tree
Showing 6 changed files with 1 addition and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ public static ApiTrip mapToApi(Trip obj) {
api.shapeId = FeedScopedIdMapper.mapToApi(obj.getShapeId());
api.wheelchairAccessible = WheelchairAccessibilityMapper.mapToApi(obj.getWheelchairBoarding());
api.bikesAllowed = BikeAccessMapper.mapToApi(obj.getBikesAllowed());
api.fareId = obj.getGtfsFareId();

return api;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ private Trip doMap(org.onebusaway.gtfs.model.Trip rhs) {
lhs.withShapeId(AgencyAndIdMapper.mapAgencyAndId(rhs.getShapeId()));
lhs.withWheelchairBoarding(WheelchairAccessibilityMapper.map(rhs.getWheelchairAccessible()));
lhs.withBikesAllowed(BikeAccessMapper.mapForTrip(rhs));
lhs.withGtfsFareId(rhs.getFareId());

return lhs.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ public final class Trip extends AbstractTransitEntity<Trip, TripBuilder> impleme
private final Accessibility wheelchairBoarding;

private final String gtfsBlockId;
private final String gtfsFareId;

private final String netexInternalPlanningCode;
private final TripAlteration netexAlteration;
Expand Down Expand Up @@ -65,7 +64,6 @@ public final class Trip extends AbstractTransitEntity<Trip, TripBuilder> impleme
this.headsign = builder.getHeadsign();
this.shapeId = builder.getShapeId();
this.gtfsBlockId = builder.getGtfsBlockId();
this.gtfsFareId = builder.getGtfsFareId();
this.netexInternalPlanningCode = builder.getNetexInternalPlanningCode();
}

Expand Down Expand Up @@ -149,12 +147,6 @@ public String getGtfsBlockId() {
return gtfsBlockId;
}

/** Custom extension for KCM to specify a fare per-trip */
@Nullable
public String getGtfsFareId() {
return gtfsFareId;
}

/**
* Internal code (non-public identifier) for the journey (e.g. train- or trip number from the
* planners' tool). This is kept to ensure compatibility with legacy planning systems. In NeTEx
Expand Down Expand Up @@ -209,8 +201,7 @@ public boolean sameAs(@Nonnull Trip other) {
Objects.equals(this.direction, other.direction) &&
Objects.equals(this.bikesAllowed, other.bikesAllowed) &&
Objects.equals(this.wheelchairBoarding, other.wheelchairBoarding) &&
Objects.equals(this.netexAlteration, other.netexAlteration) &&
Objects.equals(this.gtfsFareId, other.gtfsFareId)
Objects.equals(this.netexAlteration, other.netexAlteration)
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public class TripBuilder extends AbstractEntityBuilder<Trip, TripBuilder> {
private BikeAccess bikesAllowed;
private Accessibility wheelchairBoarding;
private String gtfsBlockId;
private String gtfsFareId;
private String netexInternalPlanningCode;
private TripAlteration netexAlteration;

Expand All @@ -47,7 +46,6 @@ public class TripBuilder extends AbstractEntityBuilder<Trip, TripBuilder> {
this.bikesAllowed = original.getBikesAllowed();
this.wheelchairBoarding = original.getWheelchairBoarding();
this.netexInternalPlanningCode = original.getNetexInternalPlanningCode();
this.gtfsFareId = original.getGtfsFareId();
}

public Operator getOperator() {
Expand Down Expand Up @@ -176,15 +174,6 @@ public TripBuilder withNetexAlteration(TripAlteration netexAlteration) {
return this;
}

public String getGtfsFareId() {
return gtfsFareId;
}

public TripBuilder withGtfsFareId(String gtfsFareId) {
this.gtfsFareId = gtfsFareId;
return this;
}

@Override
protected Trip buildFromValues() {
return new Trip(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public class TripMapperTest {
private static final int BIKES_ALLOWED = 1;
private static final String BLOCK_ID = "Block Id";
private static final int DIRECTION_ID = 1;
private static final String FARE_ID = "Fare Id";
private static final String TRIP_HEADSIGN = "Trip Headsign";
private static final String TRIP_SHORT_NAME = "Trip Short Name";

Expand All @@ -46,7 +45,6 @@ public class TripMapperTest {
TRIP.setBikesAllowed(BIKES_ALLOWED);
TRIP.setBlockId(BLOCK_ID);
TRIP.setDirectionId(Integer.toString(DIRECTION_ID));
TRIP.setFareId(FARE_ID);
TRIP.setRoute(data.route);
TRIP.setServiceId(AGENCY_AND_ID);
TRIP.setShapeId(AGENCY_AND_ID);
Expand All @@ -69,7 +67,6 @@ public void testMap() throws Exception {
assertEquals("A:1", result.getId().toString());
assertEquals(BLOCK_ID, result.getGtfsBlockId());
assertEquals(Direction.INBOUND, result.getDirection());
assertEquals(FARE_ID, result.getGtfsFareId());
assertNotNull(result.getRoute());
assertEquals("A:1", result.getServiceId().toString());
assertEquals("A:1", result.getShapeId().toString());
Expand All @@ -91,7 +88,6 @@ public void testMapWithNulls() throws Exception {
assertNotNull(result.getRoute());

assertNull(result.getGtfsBlockId());
assertNull(result.getGtfsFareId());
assertNull(result.getServiceId());
assertNull(result.getShapeId());
assertNull(result.getHeadsign());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ class TripTest {
private static final BikeAccess BIKE_ACCESS = BikeAccess.ALLOWED;
private static final TransitMode TRANSIT_MODE = TransitMode.BUS;
private static final String BLOCK_ID = "blockId";
private static final String FARE_ID = "fareId";
private static final TripAlteration TRIP_ALTERATION = TripAlteration.CANCELLATION;
private static final String NETEX_SUBMODE_NAME = "submode";
private static final SubMode NETEX_SUBMODE = SubMode.of(NETEX_SUBMODE_NAME);
Expand All @@ -46,7 +45,6 @@ class TripTest {
.withBikesAllowed(BIKE_ACCESS)
.withMode(TRANSIT_MODE)
.withGtfsBlockId(BLOCK_ID)
.withGtfsFareId(FARE_ID)
.withNetexAlteration(TRIP_ALTERATION)
.withNetexSubmode(NETEX_SUBMODE_NAME)
.withNetexInternalPlanningCode(NETEX_INTERNAL_PLANNING_CODE)
Expand Down Expand Up @@ -88,7 +86,6 @@ void copy() {
assertEquals(BIKE_ACCESS, copy.getBikesAllowed());
assertEquals(TRANSIT_MODE, copy.getMode());
assertEquals(BLOCK_ID, copy.getGtfsBlockId());
assertEquals(FARE_ID, copy.getGtfsFareId());
assertEquals(TRIP_ALTERATION, copy.getNetexAlteration());
assertEquals(NETEX_SUBMODE, copy.getNetexSubMode());
assertEquals(NETEX_INTERNAL_PLANNING_CODE, copy.getNetexInternalPlanningCode());
Expand All @@ -115,7 +112,6 @@ void sameAs() {
assertFalse(subject.sameAs(subject.copy().withBikesAllowed(BikeAccess.NOT_ALLOWED).build()));
assertFalse(subject.sameAs(subject.copy().withMode(TransitMode.RAIL).build()));
assertFalse(subject.sameAs(subject.copy().withGtfsBlockId("X").build()));
assertFalse(subject.sameAs(subject.copy().withGtfsFareId("X").build()));
assertFalse(
subject.sameAs(subject.copy().withNetexAlteration(TripAlteration.REPLACED).build())
);
Expand Down

0 comments on commit c3147f5

Please sign in to comment.