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