Skip to content

MODEXPS-323 - Add endpoint to return the effective export configurations - #389

Merged
markusweigelt merged 17 commits into
masterfrom
MODEXPS-323
Nov 9, 2026
Merged

markusweigelt merged 17 commits into
masterfrom
MODEXPS-323

Conversation

@markusweigelt

@markusweigelt markusweigelt commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

MODEXPS-323 - Add endpoint to return the effective export configurations

Purpose

This PR adds an endpoint that returns the integrations of one export type that match the given criteria. The criteria are field values rather than a PO line id, so unsaved form values and new lines work, and no call to mod-orders is needed.

GET /data-export-spring/effective-configs?vendorId=<uuid>&type=EDIFACT_ORDERS_EXPORT|CLAIMS[&acquisitionMethod=<uuid>][&vendorAccount=<string>][&transmissionMethod=FTP|File download|Email][&scheduled=true|false]
→ 200 { "configs": [ matching ExportConfig, ... ], "totalRecords": <number of matches> }

Current use cases

Usage in PO line

ui-orders (UIOR-1556, PR #1890) shows which integration will pick up a PO line. It currently re-implements the worker's selection on the client, so every backend rule change has to be repeated in the UI.

Manual ordering export

POST /data-export-spring/configs/{id}/execute (MODEXPS-316) needs a config id, so the caller has to know first which integration applies to the PO line.

Claims in mod-orders

POST /orders/pieces/claim finds integrations by the CLAIMS_<vendorId> name prefix and sends every claimed piece to all of them. With this endpoint, it routes by acquisition method without its own copy of the rule, and creates one job per integration with only its pieces.

Single-piece claim in ui-receiving

ui-receiving checks configName==CLAIMS_<organizationId>* to choose between a claim job and a manual Claim sent. With routing by acquisition method, it could offer a job that mod-orders rejects with 422 instead of the manual claim. This endpoint gives it the same answer as mod-orders.

Approach

Matching (EffectiveConfigMatcher, with one EffectiveConfigMatchRule per type). All configs of the type and vendor are loaded, because the rules need them. Matches are sorted by configName, and there is no limit.

  • EDIFACT_ORDERS_EXPORT (OrderingMatchRule) uses the worker's rule from MapToEdifactOrdersTasklet#getPoLineQuery / #getVendorAccountFilter:
    • acquisitionMethod must be in defaultAcquisitionMethods, so without it no config matches.
    • An absent vendorAccount applies no account filter. An empty vendorAccount= means a line without an account number.
    • A non-default config with account numbers matches only a listed account. One without account numbers matches any account, or an empty one.
    • A default config matches unless the account is listed on a non-default config of the vendor.
  • CLAIMS (ClaimsMatchRule) ignores vendorAccount and isDefaultConfig:
    • Without acquisitionMethod, every config of the vendor matches.
    • A config with selected methods matches only those.
    • A config without selected methods matches only methods that no other Claims config of the vendor selects.
  • transmissionMethod and scheduled narrow the result after matching. Configs they filter out still count for the rules above. A config is scheduled if enableScheduledExport is true and schedulePeriod is set and not NONE.

API and data

  • type is a local enum (effectiveConfigType), because the BURSAR_FEES_FINES default of the shared exportType.json would turn a missing type into a valid request.
  • transmissionMethod references the vendor config schema's enum. TransmissionMethodConverter binds it by API value (File download).
  • 400 is returned for a missing vendorId or type, any other type, an unknown transmissionMethod, a non-boolean scheduled and non-UUID ids.
  • New permission data-export.effective-configs.collection.get, part of data-export.config.all. It is separate because a permission may protect only one endpoint.
  • New index on (type, vendorEdiOrdersExportConfig.vendorId), backing the native query in ExportConfigRepository.
  • No interface bump: data-export-spring is already 2.1 through the unreleased MODEXPS-316 - Add endpoint to execute an orders export configuration for given PO lines #385, so both ship under 2.1.

Tests: EffectiveConfigMatcherTest (rules) and EffectiveConfigsControllerTest (API, status codes).

Notes for review

  • Two default-integration limitations match the worker and need a joint change, so they are out of scope:
    • The default excludes every account listed on another integration, even one that cannot take the acquisition method, so such a combination returns an empty list. This is covered by a test.
    • A non-default CSV integration without account numbers and a default integration with the same method both match, and the worker exports the line through both.

Clients pass the PO line's vendor, acquisition method and account to
GET /configs and get the matching integrations, so the worker's rule no
longer has to be repeated in the UI. Calls without these params are unchanged.
The matching works on export config criteria, so the names no longer
refer to PO lines. This includes the two new error codes, which are unreleased.
The PO line parameters describe a line rather than filter configs, so they get
their own endpoint with its own permission, and GET /configs goes back to query
and limit only. The endpoint requires vendorId, returns all matches, and accepts
the shared export type.
…configs

The parameter now uses the enum from the vendor config schema instead of its own
copy of the values. Also rename the criteria record to ConfigCriteria and the
generated enum and its converter to TransmissionMethod.
There is no default type anymore, so a missing or empty type returns 400, and the
query and matcher handle a single type. ConfigsController goes back to its state
on master.
The shared export type schema brings a Bursar default, which would turn a missing
type into a valid request. Only types with a matching rule are accepted now, so
other types return 400. Also rename ConfigMatchRule to EffectiveConfigMatchRule.
A Claims config with selected methods applies only to those, and one
without selected methods applies to the methods no other Claims config
of the vendor selects. Without an acquisition method, every Claims
config of the vendor matches.
An absent vendorAccount now applies no account filter, so every Ordering
config with the acquisition method matches. An empty vendorAccount means
a PO line without an account number, which absent meant before.
@sonarqubecloud

sonarqubecloud Bot commented Nov 9, 2026

Copy link
Copy Markdown

@markusweigelt
markusweigelt merged commit 49e14b4 into master Nov 9, 2026
18 checks passed
@markusweigelt
markusweigelt deleted the MODEXPS-323 branch November 9, 2026 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants