Commits
Thomas Lange authored f4b33bf09bd
1 1 | package dk.nsp.idsas.service; |
2 2 | |
3 3 | import dk.nsp.idsas.dao.BlurringDao; |
4 4 | import dk.nsp.idsas.dao.entity.BlurringEntity; |
5 5 | import dk.nsp.idsas.security.model.IdsasActor; |
6 6 | import dk.nsp.idsas.util.AuditLogger; |
7 7 | import dk.nsp.idsas.util.ErrorMessages; |
8 - | import org.springframework.beans.factory.annotation.Autowired; |
9 8 | |
10 9 | import java.util.List; |
11 10 | import java.util.stream.Collectors; |
12 11 | |
13 12 | public class LookupService { |
14 - | |
15 13 | private BlurringDao blurringDao; |
16 - | |
17 - | |
18 14 | private AuditLogger auditLogger; |
19 - | |
20 - | |
21 15 | private String allowedClientSystemName; |
22 16 | |
17 + | public LookupService(BlurringDao blurringDao, AuditLogger auditLogger, String allowedClientSystemName) { |
18 + | this.blurringDao = blurringDao; |
19 + | this.auditLogger = auditLogger; |
20 + | this.allowedClientSystemName = allowedClientSystemName; |
21 + | } |
22 + | |
23 23 | public List<String> getActiveBlurrings(IdsasActor actor, String patientId, String patientIdType) throws IdsasServiceException { |
24 24 | // Validering af, at actor er en systembruger |
25 25 | if (!actor.getActorType().equals(IdsasActor.IdsasActorType.SYSTEM)) { |
26 26 | throw new IdsasServiceException(ErrorMessages.userTypNotSupported(actor.getActorType().name()), true); |
27 27 | } |
28 28 | |
29 29 | // Validering af, at systembrugeren har et clientName med den korrekte værdi |
30 30 | if (!actor.getClientSystemName().equals(allowedClientSystemName)) { |
31 31 | throw new IdsasServiceException(ErrorMessages.clientSystemNameError(actor.getClientSystemName(), allowedClientSystemName), true); |
32 32 | } |