1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.myfaces.tobago.example.demo;
21
22 import org.slf4j.Logger;
23 import org.slf4j.LoggerFactory;
24
25 import javax.enterprise.context.RequestScoped;
26 import javax.inject.Named;
27 import java.io.Serializable;
28 import java.lang.invoke.MethodHandles;
29 import java.text.ParseException;
30 import java.text.SimpleDateFormat;
31 import java.util.Date;
32
33 @RequestScoped
34 @Named
35 public class DateController implements Serializable {
36
37 private static final Logger LOG = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
38
39 private Date once;
40 private Date onchange;
41 private Date submitDate;
42
43 public DateController() {
44 once = new Date();
45 final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
46 try {
47 submitDate = sdf.parse("2016-05-22");
48 } catch (final ParseException e) {
49 LOG.error("", e);
50 }
51 }
52
53 public Date getOnce() {
54 return once;
55 }
56
57 public void setOnce(final Date once) {
58 this.once = once;
59 }
60
61 public Date getOnchange() {
62 return onchange;
63 }
64
65 public void setOnchange(final Date onchange) {
66 this.onchange = onchange;
67 }
68
69 public Date getNow() {
70 return new Date();
71 }
72
73 public Date getSubmitDate() {
74 return submitDate;
75 }
76
77 public void setSubmitDate(final Date submitDate) {
78 this.submitDate = submitDate;
79 }
80 }