Changeset f0d5cb7 for src/main/java/it/finki
- Timestamp:
- 09/03/21 11:25:12 (3 years ago)
- Branches:
- master
- Children:
- f8007b3
- Parents:
- 5577566
- Location:
- src/main/java/it/finki/charitable
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/it/finki/charitable/controller/DonationPostController.java
r5577566 rf0d5cb7 1 1 package it.finki.charitable.controller; 2 2 3 import it.finki.charitable.entities.AppUser; 4 import it.finki.charitable.entities.DonationInformation; 5 import it.finki.charitable.entities.DonationPost; 6 import it.finki.charitable.entities.FundsCollected; 3 import it.finki.charitable.entities.*; 7 4 import it.finki.charitable.services.DonationInformationService; 8 5 import it.finki.charitable.services.DonationPostService; … … 183 180 DonationInformation donationInformation = new DonationInformation(amount, post.getId(), post.getTitle()); 184 181 donationInformationService.save(donationInformation); 185 AppUser user =userService.loadUserByUsername(SecurityContextHolder.getContext().getAuthentication().getName());182 MainUser user = (MainUser) userService.loadUserByUsername(SecurityContextHolder.getContext().getAuthentication().getName()); 186 183 user.getDonationInformation().add(donationInformation); 187 184 userService.saveUser(user); -
src/main/java/it/finki/charitable/controller/HomeController.java
r5577566 rf0d5cb7 2 2 3 3 import it.finki.charitable.entities.AppUser; 4 import it.finki.charitable.entities.MainUser; 5 import it.finki.charitable.entities.Moderator; 4 6 import it.finki.charitable.entities.UserRole; 5 7 import it.finki.charitable.security.ConfirmationToken; … … 89 91 } 90 92 91 AppUser user = new AppUser();93 AppUser user = new MainUser(); 92 94 user.setFirstName(firstName); 93 95 user.setLastName(lastName); -
src/main/java/it/finki/charitable/controller/UserProfileController.java
r5577566 rf0d5cb7 4 4 import it.finki.charitable.entities.DonationInformation; 5 5 import it.finki.charitable.entities.DonationPost; 6 import it.finki.charitable.entities.MainUser; 6 7 import it.finki.charitable.security.PasswordEncoder; 7 8 import it.finki.charitable.services.DonationPostService; … … 37 38 public String myDonations(Model model) { 38 39 model.addAttribute("myDonations", true); 39 AppUser user =userService.loadUserByUsername(SecurityContextHolder.getContext().getAuthentication().getName());40 MainUser user = (MainUser) userService.loadUserByUsername(SecurityContextHolder.getContext().getAuthentication().getName()); 40 41 List<DonationInformation> donations = user.getDonationInformation(); 41 42 model.addAttribute("donations", donations); … … 89 90 } 90 91 91 AppUser user = (AppUser) model.getAttribute("user");92 MainUser user = (MainUser) model.getAttribute("user"); 92 93 user.setCreditCardInfo(cardName + "," + cardNumber + "," + expiryDate + "," + cvv); 93 94 userService.saveUser(user); … … 98 99 @RequestMapping("/removeCardInfo") 99 100 public String removeCardInfo(Model model) { 100 AppUser user = (AppUser) model.getAttribute("user");101 MainUser user = (MainUser) model.getAttribute("user"); 101 102 user.setCreditCardInfo(null); 102 103 userService.saveUser(user); -
src/main/java/it/finki/charitable/entities/AppUser.java
r5577566 rf0d5cb7 36 36 private String email; 37 37 private String password; 38 private String creditCardInfo;39 38 @Enumerated(EnumType.STRING) 40 39 private UserRole userRole; 41 40 private Boolean enabled; 42 43 @OneToMany44 private List<DonationInformation> donationInformation = new ArrayList<>();45 41 46 42 public AppUser() { … … 83 79 } 84 80 85 public String getCreditCardInfo() {86 return creditCardInfo;87 }88 89 public void setCreditCardInfo(String creditCardInfo) {90 this.creditCardInfo = creditCardInfo;91 }92 93 81 public UserRole getUserRole() { 94 82 return userRole; … … 105 93 public void setEnabled(Boolean enabled) { 106 94 this.enabled = enabled; 107 }108 109 public List<DonationInformation> getDonationInformation() {110 return donationInformation;111 }112 113 public void setDonationInformation(List<DonationInformation> donationInformation) {114 this.donationInformation = donationInformation;115 95 } 116 96
Note:
See TracChangeset
for help on using the changeset viewer.