Commits

nilsj authored c65fa0e1c74
Add CleanupServlet to trigger cleanup iteration.

Enable logging. Fix various errors, so that UnsupportedOperationException is the failure cause.
No tags

cleanup-app/src/main/java/dk/nsp/xdscleanup/model/DocumentTypeCleanupSpecification.java

Modified
1 1 package dk.nsp.xdscleanup.model;
2 2
3 3 import dk.nsp.xdscleanup.model.xds.TypeCode;
4 4
5 5 import java.time.Instant;
6 -import java.time.temporal.ChronoUnit;
6 +import java.time.Period;
7 +import java.time.ZonedDateTime;
7 8
8 9 public class DocumentTypeCleanupSpecification {
9 10 private TypeCode typeCode;
10 11
11 12 private int numberOfMonthsToKeep;
12 13
13 14 public DocumentTypeCleanupSpecification(TypeCode typeCode, int numberOfMonthsToKeep) {
14 15 this.typeCode = typeCode;
15 16 this.numberOfMonthsToKeep = numberOfMonthsToKeep;
16 17 }
17 18
18 19 public TypeCode getTypeCode() {
19 20 return typeCode;
20 21 }
21 22
22 23 public Instant getLimit() {
23 - return Instant.now().minus(numberOfMonthsToKeep, ChronoUnit.MONTHS);
24 + return ZonedDateTime
25 + .now()
26 + .minus(Period.ofMonths(numberOfMonthsToKeep))
27 + .toInstant();
24 28 }
25 29 }

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut