- Timestamp:
- 03/13/23 23:30:41 (20 months ago)
- Branches:
- master
- Children:
- 8bcd64c
- Parents:
- 46fd0c7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.