Changeset 9050790 for src/main/java
- Timestamp:
- 03/13/23 23:30:41 (20 months ago)
- Branches:
- master
- Children:
- 8bcd64c
- Parents:
- 46fd0c7
- Location:
- src/main/java/edu/gjoko/schedlr
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/java/edu/gjoko/schedlr/config/AppFilter.java
r46fd0c7 r9050790 24 24 HttpSession session = httpServletRequest.getSession(false); 25 25 26 if(httpServletRequest.getRequestURI().endsWith(".js") || httpServletRequest.getRequestURI().endsWith(".css")) { 26 if(httpServletRequest.getRequestURI().endsWith(".js") 27 || httpServletRequest.getRequestURI().endsWith(".css") 28 || httpServletRequest.getRequestURI().startsWith("/api")) { 27 29 filterChain.doFilter(servletRequest, servletResponse); 28 30 return; -
src/main/java/edu/gjoko/schedlr/controllers/rest/BusinessController.java
r46fd0c7 r9050790 21 21 22 22 @GetMapping 23 public List<Business> getNewBusinesses() {24 return businessService. getNewBusiness();23 public List<Business> findAll() { 24 return businessService.findAll(); 25 25 } 26 26 27 27 @PatchMapping 28 public void activateBusinesses(@RequestBody List<Business> businessList) {29 businessService. activateBusinesses(businessList);28 public void updateBusinesses(@RequestBody List<Business> businessList) { 29 businessService.updateBusinesses(businessList); 30 30 } 31 31 } -
src/main/java/edu/gjoko/schedlr/entity/BusinessStatus.java
r46fd0c7 r9050790 4 4 NEW, 5 5 ACTIVE, 6 BLOCKED6 DEACTIVATED 7 7 } -
src/main/java/edu/gjoko/schedlr/services/BusinessService.java
r46fd0c7 r9050790 2 2 3 3 import edu.gjoko.schedlr.entity.Business; 4 import edu.gjoko.schedlr.entity.BusinessStatus;5 4 import edu.gjoko.schedlr.entity.ServiceType; 6 5 import edu.gjoko.schedlr.entity.StakeholderType; … … 11 10 12 11 import java.util.List; 13 import java.util.stream.Collectors;14 12 15 13 import static edu.gjoko.schedlr.entity.BusinessStatus.ACTIVE; … … 32 30 public void saveNewServiceTypes(Business business) { 33 31 business.getServices() 34 .stream()35 .forEach(service -> {36 if(service.getServiceType().getId() == null) {37 ServiceType serviceType = service.getServiceType();38 serviceType.setBusinessType(business.getBusinessType());39 service.setServiceType(serviceTypeRepository.save(serviceType));40 }41 });32 .stream() 33 .forEach(service -> { 34 if (service.getServiceType().getId() == null) { 35 ServiceType serviceType = service.getServiceType(); 36 serviceType.setBusinessType(business.getBusinessType()); 37 service.setServiceType(serviceTypeRepository.save(serviceType)); 38 } 39 }); 42 40 } 43 41 44 public List<Business> getNewBusiness() {45 return businessRepository.find BusinessesByBusinessStatus(NEW);42 public List<Business> findAll() { 43 return businessRepository.findAll(); 46 44 } 47 45 48 public void activateBusinesses(List<Business> businessList) {46 public void updateBusinesses(List<Business> businessList) { 49 47 businessList 50 48 .stream() 51 49 .forEach(business -> { 52 business.setBusinessStatus(ACTIVE);53 50 businessRepository.save(business); 54 51 });
Note:
See TracChangeset
for help on using the changeset viewer.