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 java.util.ArrayList;
21 import java.util.Collections;
22 import java.util.List;
23
24 import javax.xml.namespace.QName;
25
26 import org.opensaml.ws.wssecurity.Created;
27 import org.opensaml.ws.wssecurity.Expires;
28 import org.opensaml.ws.wssecurity.IdBearing;
29 import org.opensaml.ws.wssecurity.Timestamp;
30 import org.opensaml.xml.XMLObject;
31 import org.opensaml.xml.util.AttributeMap;
32 import org.opensaml.xml.util.IndexedXMLObjectChildrenList;
33
34
35
36
37
38 public class TimestampImpl extends AbstractWSSecurityObject implements Timestamp {
39
40
41 private String id;
42
43
44 private Created created;
45
46
47 private Expires expires;
48
49
50 private AttributeMap unknownAttributes;
51
52
53 private IndexedXMLObjectChildrenList<XMLObject> unknownChildren;
54
55
56
57
58
59
60
61
62 public TimestampImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
63 super(namespaceURI, elementLocalName, namespacePrefix);
64 unknownAttributes = new AttributeMap(this);
65 unknownChildren = new IndexedXMLObjectChildrenList<XMLObject>(this);
66 }
67
68
69 public Created getCreated() {
70 return created;
71 }
72
73
74 public Expires getExpires() {
75 return expires;
76 }
77
78
79 public void setCreated(Created newCreated) {
80 created = prepareForAssignment(created, newCreated);
81 }
82
83
84 public void setExpires(Expires newExpires) {
85 expires = prepareForAssignment(expires, newExpires);
86 }
87
88
89 public String getWSUId() {
90 return id;
91 }
92
93
94 public void setWSUId(String newId) {
95 String oldId = id;
96 id = prepareForAssignment(id, newId);
97 registerOwnID(oldId, id);
98 manageQualifiedAttributeNamespace(IdBearing.WSU_ID_ATTR_NAME, id != null);
99 }
100
101
102 public AttributeMap getUnknownAttributes() {
103 return unknownAttributes;
104 }
105
106
107 public List<XMLObject> getUnknownXMLObjects() {
108 return unknownChildren;
109 }
110
111
112 public List<XMLObject> getUnknownXMLObjects(QName typeOrName) {
113 return (List<XMLObject>) unknownChildren.subList(typeOrName);
114 }
115
116
117 public List<XMLObject> getOrderedChildren() {
118 ArrayList<XMLObject> children = new ArrayList<XMLObject>();
119 if (created != null) {
120 children.add(created);
121 }
122 if (expires != null) {
123 children.add(expires);
124 }
125 if (!getUnknownXMLObjects().isEmpty()) {
126 children.addAll(getUnknownXMLObjects());
127 }
128
129 return Collections.unmodifiableList(children);
130 }
131
132 }