-
Notifications
You must be signed in to change notification settings - Fork 0
feat: integrate spotless with maven and CI, apply code formatting #46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
ab1e4a6
feat: integrate spotless with maven and CI, apply code formatting
FionaSprinkles b296787
exclude test classes from ArchUnit checks
FionaSprinkles 994c570
apply spotless formatting
FionaSprinkles af20a4b
remove demo-data
FionaSprinkles 8e57dea
Move `TicketControllerIT` to `integration` package
simonforsberg 233b1c3
correct OpenAPI schema
FionaSprinkles 7b2cc9b
Merge branch 'main' into feature/spotless
FionaSprinkles f0ffd3a
apply spotless formatting to TicketControllerIT
FionaSprinkles 08e32ed
fix: set uploadedBy for demo attachments
FionaSprinkles ef481e0
Merge branch 'main' into feature/spotless
simonforsberg 9e93570
Refactor `TicketControllerIT` for readability and consistency; fix mi…
simonforsberg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
51 changes: 26 additions & 25 deletions
51
src/main/java/org/example/alfs/config/GlobalModelAttributes.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,37 +1,38 @@ | ||
| package org.example.alfs.config; | ||
|
|
||
| import org.example.alfs.security.SecurityUtils; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
| import org.springframework.web.bind.annotation.ControllerAdvice; | ||
| import org.example.alfs.security.SecurityUtils; | ||
| import org.springframework.ui.Model; | ||
| import org.springframework.web.bind.annotation.ControllerAdvice; | ||
| import org.springframework.web.bind.annotation.ModelAttribute; | ||
|
|
||
| @ControllerAdvice | ||
| public class GlobalModelAttributes { | ||
| private static final Logger log = LoggerFactory.getLogger(GlobalModelAttributes.class); | ||
| private final SecurityUtils securityUtils; | ||
|
|
||
| public GlobalModelAttributes(SecurityUtils securityUtils) { | ||
| this.securityUtils = securityUtils; | ||
| } | ||
| private static final Logger log = LoggerFactory.getLogger(GlobalModelAttributes.class); | ||
| private final SecurityUtils securityUtils; | ||
|
|
||
| @ModelAttribute | ||
| public void addGlobalAttributes(Model model) { | ||
| public GlobalModelAttributes(SecurityUtils securityUtils) { | ||
| this.securityUtils = securityUtils; | ||
| } | ||
|
|
||
| boolean isLoggedIn = false; | ||
| String username = null; | ||
| String role = null; | ||
| try { | ||
| var user = securityUtils.getCurrentUser(); | ||
| isLoggedIn = true; | ||
| username = user.getUsername(); | ||
| role = user.getRole().name(); | ||
| } catch (RuntimeException ex) { | ||
| log.debug("Could not resolve current user for global model attributes", ex); | ||
| } | ||
| @ModelAttribute | ||
| public void addGlobalAttributes(Model model) { | ||
|
|
||
| model.addAttribute("isLoggedIn", isLoggedIn); | ||
| model.addAttribute("username", username); | ||
| model.addAttribute("role", role); | ||
| boolean isLoggedIn = false; | ||
| String username = null; | ||
| String role = null; | ||
| try { | ||
| var user = securityUtils.getCurrentUser(); | ||
| isLoggedIn = true; | ||
| username = user.getUsername(); | ||
| role = user.getRole().name(); | ||
| } catch (RuntimeException ex) { | ||
| log.debug("Could not resolve current user for global model attributes", ex); | ||
| } | ||
| } | ||
|
|
||
| model.addAttribute("isLoggedIn", isLoggedIn); | ||
| model.addAttribute("username", username); | ||
| model.addAttribute("role", role); | ||
| } | ||
| } |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.