| 1 | package edu.ucsb.cs156.rec.services; | |
| 2 | ||
| 3 | import edu.ucsb.cs156.rec.entities.RequestType; | |
| 4 | import edu.ucsb.cs156.rec.repositories.RequestTypeRepository; | |
| 5 | import org.springframework.beans.factory.annotation.Autowired; | |
| 6 | import org.springframework.boot.CommandLineRunner; | |
| 7 | import org.springframework.stereotype.Component; | |
| 8 | ||
| 9 | import java.util.Arrays; | |
| 10 | import java.util.Optional; | |
| 11 | ||
| 12 | @Component | |
| 13 | public class RequestTypeDataLoader implements CommandLineRunner { | |
| 14 | ||
| 15 | @Autowired | |
| 16 | private RequestTypeRepository requestTypeRepository; | |
| 17 | ||
| 18 | @Override | |
| 19 | public void run(String... args) throws Exception { | |
| 20 |
1
1. run : removed call to edu/ucsb/cs156/rec/services/RequestTypeDataLoader::loadRequestTypes → KILLED |
loadRequestTypes(); |
| 21 | } | |
| 22 | ||
| 23 | private void loadRequestTypes() { | |
| 24 | String[] requestTypes = { | |
| 25 | "CS Department BS/MS program", | |
| 26 | "Scholarship or Fellowship", | |
| 27 | "MS program (other than CS Dept BS/MS)", | |
| 28 | "PhD program" | |
| 29 | }; | |
| 30 | ||
| 31 |
1
1. loadRequestTypes : removed call to java/util/stream/Stream::forEach → KILLED |
Arrays.stream(requestTypes).forEach(type -> { |
| 32 | Optional<RequestType> existing = requestTypeRepository.findByRequestType(type); | |
| 33 |
1
1. lambda$loadRequestTypes$0 : negated conditional → KILLED |
if (!existing.isPresent()) { |
| 34 | RequestType newType = new RequestType(); | |
| 35 |
1
1. lambda$loadRequestTypes$0 : removed call to edu/ucsb/cs156/rec/entities/RequestType::setRequestType → KILLED |
newType.setRequestType(type); |
| 36 | requestTypeRepository.save(newType); | |
| 37 | | |
| 38 | } | |
| 39 | }); | |
| 40 | } | |
| 41 | } | |
Mutations | ||
| 20 |
1.1 |
|
| 31 |
1.1 |
|
| 33 |
1.1 |
|
| 35 |
1.1 |