| 1 | package edu.ucsb.cs156.courses.services; | |
| 2 | ||
| 3 | import edu.ucsb.cs156.courses.entities.User; | |
| 4 | import edu.ucsb.cs156.jobs.services.JobUserProvider; | |
| 5 | import org.springframework.beans.factory.annotation.Autowired; | |
| 6 | import org.springframework.stereotype.Service; | |
| 7 | ||
| 8 | /** | |
| 9 | * Bridge between the lib-jobs library and this app's notion of "current user"; lib-jobs uses it to | |
| 10 | * stamp createdById/createdByEmail on Job records. Both values are null when there is no logged-in | |
| 11 | * user (e.g. jobs launched from a scheduled task). | |
| 12 | */ | |
| 13 | @Service | |
| 14 | public class JobUserProviderImpl implements JobUserProvider { | |
| 15 | ||
| 16 | @Autowired private CurrentUserService currentUserService; | |
| 17 | ||
| 18 | @Override | |
| 19 | public Long getCurrentUserId() { | |
| 20 | User user = currentUserService.getUser(); | |
| 21 |
2
1. getCurrentUserId : replaced Long return value with 0L for edu/ucsb/cs156/courses/services/JobUserProviderImpl::getCurrentUserId → KILLED 2. getCurrentUserId : negated conditional → KILLED |
return user != null ? user.getId() : null; |
| 22 | } | |
| 23 | ||
| 24 | @Override | |
| 25 | public String getCurrentUserEmail() { | |
| 26 | User user = currentUserService.getUser(); | |
| 27 |
2
1. getCurrentUserEmail : replaced return value with "" for edu/ucsb/cs156/courses/services/JobUserProviderImpl::getCurrentUserEmail → KILLED 2. getCurrentUserEmail : negated conditional → KILLED |
return user != null ? user.getEmail() : null; |
| 28 | } | |
| 29 | } | |
Mutations | ||
| 21 |
1.1 2.2 |
|
| 27 |
1.1 2.2 |