Revize 576ee7e8
Přidáno uživatelem Dominik Poch před téměř 6 roky(ů)
server/src/main/java/cz/zcu/yamanager/business/ApiManager.java | ||
---|---|---|
11 | 11 |
import org.springframework.stereotype.Component; |
12 | 12 |
|
13 | 13 |
import java.time.LocalDate; |
14 |
import java.util.Collections; |
|
14 | 15 |
import java.util.List; |
15 | 16 |
|
16 | 17 |
@Component |
... | ... | |
44 | 45 |
|
45 | 46 |
@Override |
46 | 47 |
public List<VacationRequest> getVacationRequests(Status status) throws RESTFullException { |
47 |
return this.requestRepository.getAllVacationRequests(status); |
|
48 |
List<VacationRequest> requests = this.requestRepository.getAllVacationRequests(status); |
|
49 |
return requests == null ? Collections.emptyList() : requests; |
|
48 | 50 |
} |
49 | 51 |
|
50 | 52 |
@Override |
51 | 53 |
public List<AuthorizationRequest> getAuthorizationRequests(Status status) throws RESTFullException { |
52 |
return this.requestRepository.getAllAuthorizations(status); |
|
54 |
List<AuthorizationRequest> requests = this.requestRepository.getAllAuthorizations(status); |
|
55 |
return requests == null ? Collections.emptyList() : requests; |
|
53 | 56 |
} |
54 | 57 |
|
55 | 58 |
@Override |
56 | 59 |
public FullUserProfile getUserProfile(Long userId) throws RESTFullException { |
57 |
return this.userRepository.getFullUser(userId); |
|
60 |
FullUserProfile userProfile = this.userRepository.getFullUser(userId); |
|
61 |
return userProfile == null ? new FullUserProfile() : userProfile; |
|
58 | 62 |
} |
59 | 63 |
|
60 | 64 |
@Override |
61 | 65 |
public DefaultSettings getDefaultSettings() throws RESTFullException { |
62 |
return this.userRepository.getLastDefaultSettings(); |
|
66 |
DefaultSettings settings = this.userRepository.getLastDefaultSettings(); |
|
67 |
return settings == null ? new DefaultSettings() : settings; |
|
63 | 68 |
} |
64 | 69 |
|
65 | 70 |
@Override |
66 | 71 |
public List<VacationDay> getUserCalendar(Long userId, LocalDate fromDate, LocalDate toDate, Status status) throws RESTFullException { |
67 |
return this.vacationRepository.getVacationDays(userId, fromDate, toDate, status); |
|
72 |
List<VacationDay> vacations = this.vacationRepository.getVacationDays(userId, fromDate, toDate, status); |
|
73 |
return vacations == null ? Collections.emptyList() : vacations; |
|
68 | 74 |
} |
69 | 75 |
|
70 | 76 |
@Override |
Také k dispozici: Unified diff
Re #7551 Fix null object