1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.opensaml.xml.encryption.impl;
18
19 import java.util.ArrayList;
20 import java.util.Collections;
21 import java.util.List;
22
23 import javax.xml.namespace.QName;
24
25 import org.opensaml.xml.XMLObject;
26 import org.opensaml.xml.encryption.AgreementMethod;
27 import org.opensaml.xml.encryption.KANonce;
28 import org.opensaml.xml.encryption.OriginatorKeyInfo;
29 import org.opensaml.xml.encryption.RecipientKeyInfo;
30 import org.opensaml.xml.util.IndexedXMLObjectChildrenList;
31 import org.opensaml.xml.validation.AbstractValidatingXMLObject;
32
33
34
35
36 public class AgreementMethodImpl extends AbstractValidatingXMLObject implements AgreementMethod {
37
38
39 private String algorithm;
40
41
42 private KANonce kaNonce;
43
44
45 private OriginatorKeyInfo originatorKeyInfo;
46
47
48 private RecipientKeyInfo recipientKeyInfo;
49
50
51 private IndexedXMLObjectChildrenList xmlChildren;
52
53
54
55
56
57
58
59
60 protected AgreementMethodImpl(String namespaceURI, String elementLocalName, String namespacePrefix) {
61 super(namespaceURI, elementLocalName, namespacePrefix);
62 xmlChildren = new IndexedXMLObjectChildrenList(this);
63 }
64
65
66 public String getAlgorithm() {
67 return this.algorithm;
68 }
69
70
71 public void setAlgorithm(String newAlgorithm) {
72 this.algorithm = prepareForAssignment(this.algorithm, newAlgorithm);
73 }
74
75
76 public KANonce getKANonce() {
77 return this.kaNonce;
78 }
79
80
81 public void setKANonce(KANonce newKANonce) {
82 this.kaNonce = prepareForAssignment(this.kaNonce, newKANonce);
83 }
84
85
86 public OriginatorKeyInfo getOriginatorKeyInfo() {
87 return this.originatorKeyInfo;
88 }
89
90
91 public void setOriginatorKeyInfo(OriginatorKeyInfo newOriginatorKeyInfo) {
92 this.originatorKeyInfo = prepareForAssignment(this.originatorKeyInfo, newOriginatorKeyInfo);
93 }
94
95
96 public RecipientKeyInfo getRecipientKeyInfo() {
97 return this.recipientKeyInfo;
98 }
99
100
101 public void setRecipientKeyInfo(RecipientKeyInfo newRecipientKeyInfo) {
102 this.recipientKeyInfo = prepareForAssignment(this.recipientKeyInfo, newRecipientKeyInfo);
103 }
104
105
106 public List<XMLObject> getUnknownXMLObjects() {
107 return (List<XMLObject>) this.xmlChildren;
108 }
109
110 public List<XMLObject> getUnknownXMLObjects(QName typeOrName) {
111 return (List<XMLObject>) this.xmlChildren.subList(typeOrName);
112 }
113
114
115 public List<XMLObject> getOrderedChildren() {
116 ArrayList<XMLObject> children = new ArrayList<XMLObject>();
117
118 if (kaNonce != null) {
119 children.add(kaNonce);
120 }
121
122 children.addAll(xmlChildren);
123
124 if (originatorKeyInfo != null) {
125 children.add(originatorKeyInfo);
126 }
127 if (recipientKeyInfo != null) {
128 children.add(recipientKeyInfo);
129 }
130
131 if (children.size() == 0) {
132 return null;
133 }
134
135 return Collections.unmodifiableList(children);
136 }
137
138 }