[ext-fintraffic] Add FintrafficParking extension with persisted paymentMethods - #422
Open
teppope wants to merge 11 commits into
Open
[ext-fintraffic] Add FintrafficParking extension with persisted paymentMethods#422teppope wants to merge 11 commits into
teppope wants to merge 11 commits into
Conversation
teppope
force-pushed
the
feat/ext-fintraffic-parking-entity-factory
branch
6 times, most recently
from
July 17, 2026 05:43
f64166a to
15410c6
Compare
Implements the extension hook infrastructure from feat/parking-extension-hooks to persist and expose paymentMethods on the Fintraffic Parking entity: - FintrafficParking: @entity subclass with @ElementCollection paymentMethods - FintrafficParkingEntityFactory: produces FintrafficParking instances - FintrafficMergingParkingImporter: copies paymentMethods into the persisted entity - FintrafficParkingGraphQLTypeContributor: adds paymentMethods to the GraphQL schema - FintrafficParkingUpdater: populates and preserves paymentMethods on GraphQL mutations - FintrafficParkingMapperContributor: bridges paymentMethods between NeTEx and Tiamat enums - V3__FintrafficParkingExtensions: Flyway migration adding dtype column and payment methods table - Full test coverage: unit + integration tests for all components Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…Factory Orika cannot auto-map paymentMethods because the NeTEx and Tiamat enum types differ. The FintrafficParkingMapperContributor already handles the conversion explicitly, so including paymentMethods in the Orika classmap was redundant and confusing. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…xtProvider static field Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
teppope
force-pushed
the
feat/ext-fintraffic-parking-entity-factory
branch
from
July 17, 2026 05:54
15410c6 to
de576f5
Compare
This was referenced Jul 20, 2026
…cognized JPA entity Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 task
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This is the first increment of the Fintraffic parking extension, focused on
paymentMethods. Further fields (e.g.vehicleEntrances, availability conditions) will follow in subsequent PRs once the underlying data model and import pipeline are in place.Implements the Fintraffic parking extension on top of the
feat/parking-extension-hooksinfrastructure (#421).FintrafficParking— JPA subclass ofParkingwith apaymentMethodscolumn (stored as a PostgreSQL array via Hibernate's@JdbcTypeCode(SqlTypes.ARRAY)). A Flyway migration (V3__FintrafficParkingExtensions) adds the backing column.FintrafficParkingEntityFactory—@Primaryfactory that instantiatesFintrafficParkingand registersFintrafficParking.classwith Orika.paymentMethodsis kept in the exclusion list; enum conversion is handled by the contributor instead.FintrafficParkingMapperContributor— translatespaymentMethodsbetweenorg.rutebanken.netex.model.PaymentMethodEnumerationandorg.rutebanken.tiamat.model.PaymentMethodEnumerationin both import and export directions. Unknown enum values are silently skipped.FintrafficMergingParkingImporter— extends themergeExtendedFieldshook to persistpaymentMethodsfrom the incoming entity onto the existing DB entity.FintrafficParkingGraphQLTypeContributor— addspaymentMethodsas a[PaymentMethodsEnumeration]field to both the parking output and input GraphQL types, including enum type registration.FintrafficParkingUpdater— extends the mutation hook to copypaymentMethodsfrom the GraphQL input onto the Tiamat entity before save.All components are activated by the
fintrafficSpring profile.Type of change
Dependencies
Depends on #421 — that branch must be merged first (or this PR rebased onto master after that merge).
Tests
FintrafficParkingIntegrationTest— NeTEx import round-trip: verifiespaymentMethodssurvives import and is present on the persisted entity.FintrafficGraphQLParkingIntegrationTest— GraphQL mutation and query: verifiespaymentMethodscan be set via mutation and read back viaparking(id: "...").FintrafficParkingMapperContributorTest— unit tests for enum conversion in both directions, including unknown value handling.FintrafficMergingParkingImporterTest— verifies merge behaviour: values copied from incoming to existing entity.FintrafficParkingEntityFactoryTest— verifies correct class, exclusion list, and instance type.Follow-up fix (added after initial review)
Added
FintrafficEntityScanConfig— an ext-only,@Profile("fintraffic")-guarded@Configurationthat registersorg.rutebanken.tiamat.ext.fintraffic.modelfor JPAentity scanning via Spring's additive
EntityScanPackages.register().TiamatApplication's@EntityScan(basePackageClasses = {StopPlace.class, ...})only coversorg.rutebanken.tiamat.model, so without this, Hibernate never registeredFintrafficParkingas an entity and everymutateParking/parkingGraphQL operationfailed under the
fintrafficprofile with"... is not an entity". This does not modifyTiamatApplication.java— the registration is purely additive.This fix has also been merged forward into every dependent branch in the stack
(
feat/ext-fintraffic-info-links,feat/ext-fintraffic-vehicle-entrances,feat/ext-fintraffic-parking-lighting,feat/ext-fintraffic-parking-opening-hours)so their PRs remain buildable/testable independently of merge order.
Follow-up fix: Parking never appears in the Read API cache
ReadApiNetexMarshallingService.createEntityRecordderived the Read API cache table'stypecolumn viaentity.getClass().getSimpleName(). Under thefintrafficprofile,every Parking is actually persisted/loaded as a
FintrafficParkinginstance (thisbranch's subclass), so the column got
"FintrafficParking"instead of"Parking"—never matching the repository's
type IN (...)query filter. The row was writtensuccessfully (no exception), but was permanently invisible to every Read API query.
Fixed by adding an
entityTypeName(EntityInVersionStructure)helper that maps the knownTiamat model supertypes (
StopPlace,Parking,TopographicPlace,FareZone) to theirNeTEx element type name via
instanceofchecks, instead of relying on the runtime classname. Verified end-to-end with a new
ReadApiParkingIncrementalSyncIntegrationTestthatactivates the real
fintraffic-read-apiSpring profile (not mocked) and asserts the newParking is both written with
type='Parking'and returned by the realstreamStopPlacesquery used by the Read API.