Skip to content

Comments

feature/migrate-rest-api-to-spring#747

Draft
vpaturet wants to merge 7 commits intomasterfrom
feature/migrate-rest-api-to-spring
Draft

feature/migrate-rest-api-to-spring#747
vpaturet wants to merge 7 commits intomasterfrom
feature/migrate-rest-api-to-spring

Conversation

@vpaturet
Copy link
Contributor

No description provided.

vpaturet and others added 7 commits December 10, 2025 11:44
Introduce ExchangeBuilder class to reduce boilerplate when creating
Camel Exchange objects in Spring REST controllers. The builder provides
withHeader(), withBody(), and withPattern() methods for a fluent API.

Changes:
- Add ExchangeBuilder with fluent builder pattern
- Add AdminRestController mirroring AdminRestRouteBuilder endpoints
- Refactor AdminExternalRestController to use ExchangeBuilder
- Add AdminRestControllerIntegrationTest with 11 tests
Migrate 10 more endpoints from Camel-based AdminRestRouteBuilder to Spring REST:
- DELETE /jobs - Cancel all Chouette jobs for all providers
- POST /validate/prevalidation - Trigger prevalidation for all providers
- POST /validate/level2 - Trigger level2 validation for all providers
- POST /stop_places/clean - Clean all stop places in Chouette
- POST /line_statistics/refresh - Refresh line statistics cache
- POST /routing_graph/build_base - Trigger OTP base graph build
- POST /routing_graph/build_candidate/{graphType} - Trigger candidate graph build
- GET /routing_graph/graphs - List OTP2 graphs
- DELETE /{providerId}/jobs - Cancel all jobs for a provider
- POST /{providerId}/flex/import - Flex data import

All 23 integration tests pass.
Add remaining timetable_admin endpoints:
- GET /line_statistics/{filter} - Get line statistics for multiple providers
- POST /export/gtfs/merged - Trigger merged GTFS export
- GET /{providerId}/files/{fileName} - Download file for reimport
- GET /{providerId}/line_statistics - Get provider line statistics
- GET /{providerId}/jobs - List jobs for provider
- POST /{providerId}/export - Trigger provider export
- POST /{providerId}/validate - Trigger provider validation
- POST /{providerId}/clean - Clean provider dataspace
- POST /{providerId}/transfer - Transfer provider data
- POST /{providerId}/flex/files - Upload flexible line file

Add map_admin endpoint:
- POST /map_admin_new/download - Trigger OSM data download

Include integration tests for all new endpoints.
Add the remaining two deprecated endpoints from AdminRestRouteBuilder:
- POST /timetable_admin_new/upload/{codespace} - upload NeTEx file by codespace
- GET /timetable_admin_new/download_netex_blocks/{codespace} - download NeTEx blocks

These endpoints use codespace (referential name) instead of providerId and are
marked as deprecated in favor of the provider-specific endpoints.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Expose the openapi.yaml file at /services/timetable-management/openapi.yaml
following the same approach used in entur/nuska.
…ration

Replace the Camel REST DSL routes with Spring REST controller endpoints by
removing the _new suffix from AdminRestController paths and deleting the
legacy AdminRestRouteBuilder.

Changes:
- Remove AdminRestRouteBuilder.java (Camel-based REST API)
- Remove AdminRestMardukRouteBuilderIntegrationTest.java (legacy tests)
- Update AdminRestController endpoints: timetable_admin_new → timetable_admin,
  map_admin_new → map_admin
- Add test configuration to AdminRestControllerIntegrationTest
- Update CLAUDE.MD documentation
Remove camel-platform-http-starter and camel-openapi-java-starter
dependencies which are no longer needed after migrating from Camel
REST DSL to Spring REST controllers.

Add swagger-annotations as a direct dependency since the OpenAPI
generated code requires it (was previously a transitive dependency
of camel-openapi-java-starter).
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
B Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

*/
@PostMapping("/timetable_admin/clean/{filter}")
public ResponseEntity<Void> cleanDataspaces(@PathVariable String filter) {
LOG.info("Cleaning dataspaces with filter {} via Spring endpoint", filter);

Check notice

Code scanning / SonarCloud

Logging should not be vulnerable to injection attacks Low

Change this code to not log user-controlled data. See more on SonarQube Cloud
*/
@PostMapping("/timetable_admin/routing_graph/build_candidate/{graphType}")
public ResponseEntity<String> buildCandidateGraph(@PathVariable String graphType) {
LOG.info("Triggering OTP candidate graph build for type {} via Spring endpoint", graphType);

Check notice

Code scanning / SonarCloud

Logging should not be vulnerable to injection attacks Low

Change this code to not log user-controlled data. See more on SonarQube Cloud
public ResponseEntity<String> getLineStatistics(
@PathVariable String filter,
@RequestParam(required = false) String providerIds) {
LOG.info("Getting line statistics with filter {} via Spring endpoint", filter);

Check notice

Code scanning / SonarCloud

Logging should not be vulnerable to injection attacks Low

Change this code to not log user-controlled data. See more on SonarQube Cloud
public ResponseEntity<byte[]> downloadProviderFile(
@PathVariable Long providerId,
@PathVariable String fileName) {
LOG.info("Downloading file {} for provider {} via Spring endpoint", fileName, providerId);

Check notice

Code scanning / SonarCloud

Logging should not be vulnerable to injection attacks Low

Change this code to not log user-controlled data. See more on SonarQube Cloud
@PathVariable String codespace,
@RequestParam("file") MultipartFile file) throws IOException {
String correlationId = UUID.randomUUID().toString();
LOG.info("[{}] Uploading file for codespace {} via Spring endpoint", correlationId, codespace);

Check notice

Code scanning / SonarCloud

Logging should not be vulnerable to injection attacks Low

Change this code to not log user-controlled data. See more on SonarQube Cloud
@GetMapping("/timetable_admin/download_netex_blocks/{codespace}")
public ResponseEntity<byte[]> downloadNetexBlocks(@PathVariable String codespace) {
String correlationId = UUID.randomUUID().toString();
LOG.info("[{}] Downloading NeTEx blocks for codespace {} via Spring endpoint", correlationId, codespace);

Check notice

Code scanning / SonarCloud

Logging should not be vulnerable to injection attacks Low

Change this code to not log user-controlled data. See more on SonarQube Cloud
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.

1 participant