1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.mycore.access.mcrimpl;
20
21 import java.text.DateFormat;
22 import java.text.SimpleDateFormat;
23 import java.util.Date;
24 import java.util.Locale;
25
26 import org.jdom2.Element;
27 import org.mycore.parsers.bool.MCRCondition;
28
29
30
31
32
33
34 class MCRDateAfterClause implements MCRCondition<MCRAccessData> {
35 private Date date;
36
37 private DateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd", Locale.ROOT);
38
39 MCRDateAfterClause(Date date) {
40 this.date = date;
41 }
42
43 public boolean evaluate(MCRAccessData data) {
44 return data.getDate().after(date);
45 }
46
47 @Override
48 public String toString() {
49 return "date > " + dateformat.format(date) + " ";
50 }
51
52 public Element toXML() {
53 Element cond = new Element("condition");
54 cond.setAttribute("field", "date");
55 cond.setAttribute("operator", ">");
56 cond.setAttribute("value", dateformat.format(date));
57 return cond;
58 }
59
60 }