1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.opensaml.ws.wssecurity.impl;
19
20 import org.joda.time.DateTime;
21 import org.joda.time.format.DateTimeFormat;
22 import org.joda.time.format.DateTimeFormatter;
23 import org.opensaml.ws.wssecurity.AttributedDateTime;
24 import org.opensaml.xml.util.AttributeMap;
25
26
27
28
29
30 public class AttributedDataTimeImpl extends AbstractWSSecurityObject implements AttributedDateTime {
31
32
33 private DateTimeFormatter formatter;
34
35
36 private DateTime dateTimeValue;
37
38
39 private String stringValue;
40
41
42 private String id;
43
44
45 private AttributeMap unknownAttributes;
46
47
48
49
50
51
52
53
54 public AttributedDataTimeImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
55 super(namespaceURI, elementLocalName, namespacePrefix);
56 formatter = DateTimeFormat.forPattern(AttributedDateTime.DEFAULT_DATETIME_FORMAT);
57 unknownAttributes = new AttributeMap(this);
58 }
59
60
61 public DateTime getDateTime() {
62 return dateTimeValue;
63 }
64
65
66 public void setDateTime(DateTime newDateTime) {
67 dateTimeValue = newDateTime;
68 String formattedDateTime = formatter.print(dateTimeValue);
69 stringValue = prepareForAssignment(stringValue, formattedDateTime);
70 }
71
72
73 public String getValue() {
74 return stringValue;
75 }
76
77
78 public void setValue(String newValue) {
79 stringValue = prepareForAssignment(stringValue, newValue);
80 dateTimeValue = formatter.parseDateTime(stringValue);
81 }
82
83
84 public String getWSUId() {
85 return id;
86 }
87
88
89 public void setWSUId(String newId) {
90 String oldID = id;
91 id = prepareForAssignment(id, newId);
92 registerOwnID(oldID, id);
93 }
94
95
96 public AttributeMap getUnknownAttributes() {
97 return unknownAttributes;
98 }
99
100 }