Revision f1a25720
Added by Katja Luther over 6 years ago
- ID f1a25720755daa96e8838a617a660dfced7b9f31
- Parent 23e50194
cdmlib-services/src/main/java/eu/etaxonomy/cdm/api/service/AuditEventService.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* Copyright (C) 2007 EDIT |
3 |
* European Distributed Institute of Taxonomy
|
|
3 |
* European Distributed Institute of Taxonomy |
|
4 | 4 |
* http://www.e-taxonomy.eu |
5 |
*
|
|
5 |
* |
|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
9 | 9 |
package eu.etaxonomy.cdm.api.service; |
10 | 10 |
|
11 |
import java.time.ZonedDateTime; |
|
11 | 12 |
import java.util.ArrayList; |
12 | 13 |
import java.util.List; |
13 | 14 |
import java.util.UUID; |
14 | 15 |
|
15 |
import org.joda.time.DateTime; |
|
16 | 16 |
import org.springframework.beans.factory.annotation.Autowired; |
17 | 17 |
import org.springframework.stereotype.Service; |
18 | 18 |
import org.springframework.transaction.annotation.Transactional; |
... | ... | |
26 | 26 |
@Service |
27 | 27 |
@Transactional(readOnly = true) |
28 | 28 |
public class AuditEventService implements IAuditEventService { |
29 |
|
|
29 |
|
|
30 | 30 |
IAuditEventDao dao; |
31 |
|
|
31 |
|
|
32 | 32 |
@Autowired |
33 | 33 |
public void setDao(IAuditEventDao dao) { |
34 | 34 |
this.dao = dao; |
35 | 35 |
} |
36 | 36 |
|
37 |
public boolean exists(UUID uuid) { |
|
37 |
@Override |
|
38 |
public boolean exists(UUID uuid) { |
|
38 | 39 |
return dao.exists(uuid); |
39 | 40 |
} |
40 | 41 |
|
41 |
public AuditEvent find(Integer id) { |
|
42 |
@Override |
|
43 |
public AuditEvent find(Integer id) { |
|
42 | 44 |
return dao.findById(id); |
43 | 45 |
} |
44 | 46 |
|
45 |
public AuditEvent find(UUID uuid) { |
|
47 |
@Override |
|
48 |
public AuditEvent find(UUID uuid) { |
|
46 | 49 |
return dao.findByUuid(uuid); |
47 | 50 |
} |
48 | 51 |
|
49 |
public AuditEvent getNextAuditEvent(AuditEvent auditEvent) { |
|
52 |
@Override |
|
53 |
public AuditEvent getNextAuditEvent(AuditEvent auditEvent) { |
|
50 | 54 |
return dao.getNextAuditEvent(auditEvent); |
51 | 55 |
} |
52 | 56 |
|
53 |
public AuditEvent getPreviousAuditEvent(AuditEvent auditEvent) { |
|
57 |
@Override |
|
58 |
public AuditEvent getPreviousAuditEvent(AuditEvent auditEvent) { |
|
54 | 59 |
return dao.getPreviousAuditEvent(auditEvent); |
55 | 60 |
} |
56 | 61 |
|
57 |
public Pager<AuditEvent> list(Integer pageNumber, Integer pageSize, AuditEventSort sort) { |
|
62 |
@Override |
|
63 |
public Pager<AuditEvent> list(Integer pageNumber, Integer pageSize, AuditEventSort sort) { |
|
58 | 64 |
Integer numberOfResults = dao.count(); |
59 |
|
|
65 |
|
|
60 | 66 |
List<AuditEvent> results = new ArrayList<AuditEvent>(); |
61 | 67 |
if(numberOfResults > 0) { // no point checking again //TODO use AbstractPagerImpl.hasResultsInRange(numberOfResults, pageNumber, pageSize) |
62 |
results = dao.list(pageNumber, pageSize, sort);
|
|
68 |
results = dao.list(pageNumber, pageSize, sort); |
|
63 | 69 |
} |
64 |
|
|
70 |
|
|
65 | 71 |
return new DefaultPagerImpl<AuditEvent>(pageNumber, numberOfResults, pageSize, results); |
66 | 72 |
} |
67 | 73 |
|
68 |
public AuditEvent find(DateTime dateTime) { |
|
74 |
public AuditEvent find(ZonedDateTime dateTime) {
|
|
69 | 75 |
return dao.findByDate(dateTime); |
70 | 76 |
} |
71 | 77 |
} |
Also available in: Unified diff
first implementation for change from joda time to java8 time