Skip to content

Commit

Permalink
Apply OpenRewrite cleanup recipes
Browse files Browse the repository at this point in the history
  • Loading branch information
perdian committed Feb 23, 2024
1 parent cd14367 commit 2305d6a
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 16 deletions.
7 changes: 7 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@
<configuration>
<activeRecipes>
<recipe>org.openrewrite.java.migrate.UpgradeToJava21</recipe>
<recipe>org.openrewrite.java.spring.boot3.UpgradeSpringBoot_3_2</recipe>
<recipe>org.openrewrite.java.spring.boot3.MigrateThymeleafDependencies</recipe>
</activeRecipes>
</configuration>
<dependencies>
Expand All @@ -222,6 +224,11 @@
<artifactId>rewrite-migrate-java</artifactId>
<version>2.9.0</version>
</dependency>
<dependency>
<groupId>org.openrewrite.recipe</groupId>
<artifactId>rewrite-spring</artifactId>
<version>5.5.0</version>
</dependency>
</dependencies>
</plugin>
</plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ String doImportFileGet() {
}

@PostMapping(value = "/import/file", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
String doImportFilePost(@ModelAttribute("exchangeEditor") FlightsExchangeEditor exchangeEditor, Model model) {
String doImportFilePost(@ModelAttribute FlightsExchangeEditor exchangeEditor, Model model) {
try {
if (exchangeEditor.getFile() == null || exchangeEditor.getFile().isEmpty()) {
throw new FileNotFoundException("No uploaded file found");
Expand All @@ -56,7 +56,7 @@ String doImportFilePost(@ModelAttribute("exchangeEditor") FlightsExchangeEditor
}

@PostMapping("/import/verify")
String doImportVerifyPost(@ModelAttribute("exchangeEditor") FlightsExchangeEditor exchangeEditor) {
String doImportVerifyPost(@ModelAttribute FlightsExchangeEditor exchangeEditor) {
this.getExchangeService().importPackage(exchangeEditor.getExchangePackage(), this.getUserHolder().getCurrentUser());
return "flights/import/done";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ String doListForPageZero(FlightQuery flightQuery, Model model) {
}

@RequestMapping(path = "/list/{pageNumber}")
String doListForPage(@PathVariable("pageNumber") int pageNumber, FlightQuery flightQuery, Model model) {
String doListForPage(@PathVariable int pageNumber, FlightQuery flightQuery, Model model) {
PaginationRequest paginationRequest = new PaginationRequest(pageNumber, 75);
return this.doList(flightQuery, paginationRequest, model);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ class FlightUpdateController {

@GetMapping(path = "/add")
String doAddGet(
@ModelAttribute(name = "flightLookupRequest") FlightLookupRequest flightLookupRequest,
@ModelAttribute(name = "flightUpdateEditor") FlightUpdateEditor flightUpdateEditor,
@RequestParam(name = "showLookupForm", required = false) Boolean showLookupForm,
@ModelAttribute FlightLookupRequest flightLookupRequest,
@ModelAttribute FlightUpdateEditor flightUpdateEditor,
@RequestParam(required = false) Boolean showLookupForm,
Model model
) {
if (showLookupForm != null) {
Expand All @@ -46,8 +46,8 @@ String doAddGet(

@RequestMapping(path = "/add")
String doAddPost(
@ModelAttribute(name = "flightLookupRequest") FlightLookupRequest flightLookupRequest,
@ModelAttribute(name = "flightUpdateEditor") @Valid FlightUpdateEditor flightUpdateEditor, BindingResult flightUpdateEditorBindingResult,
@ModelAttribute FlightLookupRequest flightLookupRequest,
@ModelAttribute @Valid FlightUpdateEditor flightUpdateEditor, BindingResult flightUpdateEditorBindingResult,
RedirectAttributes redirectAttributes,
Model model
) {
Expand All @@ -70,8 +70,8 @@ String doAddPost(

@RequestMapping(path = "/add/lookup")
String doAddLookup(
@ModelAttribute(name = "flightLookupRequest") FlightLookupRequest flightLookupRequest,
@ModelAttribute(name = "flightUpdateEditor") FlightUpdateEditor flightUpdateEditor,
@ModelAttribute FlightLookupRequest flightLookupRequest,
@ModelAttribute FlightUpdateEditor flightUpdateEditor,
Model model
) {
if (flightLookupRequest.isPopulated()) {
Expand All @@ -89,8 +89,8 @@ String doAddLookup(

@GetMapping(path = "/edit/{flightEntityId}")
String doEditGet(
@ModelAttribute(name = "flightUpdateEditor") FlightUpdateEditor flightUpdateEditor,
@PathVariable(name = "flightEntityId") UUID flightEntityId,
@ModelAttribute FlightUpdateEditor flightUpdateEditor,
@PathVariable UUID flightEntityId,
Model model
) {
FlightQuery flightQuery = new FlightQuery().withUser(this.getUserHolder().getCurrentUser());
Expand All @@ -107,8 +107,8 @@ String doEditGet(

@PostMapping(path = "/edit/{flightEntityId}")
String doEditPost(
@ModelAttribute(name = "flightUpdateEditor") @Valid FlightUpdateEditor flightUpdateEditor, BindingResult flightUpdateEditorBindingResult,
@PathVariable(name = "flightEntityId") UUID flightEntityId,
@ModelAttribute @Valid FlightUpdateEditor flightUpdateEditor, BindingResult flightUpdateEditorBindingResult,
@PathVariable UUID flightEntityId,
RedirectAttributes redirectAttributes,
Model model
) {
Expand Down Expand Up @@ -136,7 +136,7 @@ String doEditPost(
}

@GetMapping(path = "/delete/{flightEntityId}")
String doDeleteGet(@PathVariable(name = "flightEntityId") UUID flightEntityId, Model model) {
String doDeleteGet(@PathVariable UUID flightEntityId, Model model) {
FlightQuery flightQuery = new FlightQuery().withUser(this.getUserHolder().getCurrentUser());
flightQuery.setRestrictEntityIdentifiers(Collections.singleton(flightEntityId));
List<Flight> flightList = this.getFlightQueryService().loadFlights(flightQuery);
Expand All @@ -150,7 +150,7 @@ String doDeleteGet(@PathVariable(name = "flightEntityId") UUID flightEntityId, M
}

@PostMapping(path = "/delete/{flightEntityId}")
String doDeletePost(@PathVariable(name = "flightEntityId") UUID flightEntityId, Model model, RedirectAttributes redirectAttributes) {
String doDeletePost(@PathVariable UUID flightEntityId, Model model, RedirectAttributes redirectAttributes) {
FlightQuery flightQuery = new FlightQuery().withUser(this.getUserHolder().getCurrentUser());
flightQuery.setRestrictEntityIdentifiers(Collections.singleton(flightEntityId));
List<Flight> flightList = this.getFlightQueryService().loadFlights(flightQuery);
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ spring:
max-file-size: 10MB
thymeleaf:
cache: false
threads:
virtual:
enabled: true

server:
port: ${FLIGHTLOG_SERVER_PORT:8080}
Expand Down

0 comments on commit 2305d6a

Please sign in to comment.