1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.directory.api.dsmlv2.request;
21
22
23 import org.apache.directory.api.ldap.codec.api.LdapApiService;
24 import org.apache.directory.api.ldap.model.entry.Value;
25 import org.apache.directory.api.ldap.model.message.CompareRequest;
26 import org.apache.directory.api.ldap.model.message.CompareRequestImpl;
27 import org.apache.directory.api.ldap.model.message.CompareResponse;
28 import org.apache.directory.api.ldap.model.message.Control;
29 import org.apache.directory.api.ldap.model.message.MessageTypeEnum;
30 import org.apache.directory.api.ldap.model.name.Dn;
31 import org.dom4j.Element;
32
33
34
35
36
37
38
39 public class CompareRequestDsml
40 extends AbstractResultResponseRequestDsml<CompareRequest, CompareResponse>
41 implements CompareRequest
42 {
43
44
45
46 public CompareRequestDsml( LdapApiService codec )
47 {
48 super( codec, new CompareRequestImpl() );
49 }
50
51
52
53
54
55
56
57
58 public CompareRequestDsml( LdapApiService codec, CompareRequest ldapMessage )
59 {
60 super( codec, ldapMessage );
61 }
62
63
64
65
66
67 public MessageTypeEnum getType()
68 {
69 return getDecorated().getType();
70 }
71
72
73
74
75
76 public Element toDsml( Element root )
77 {
78 Element element = super.toDsml( root );
79
80 CompareRequest request = getDecorated();
81
82
83 if ( request.getName() != null )
84 {
85 element.addAttribute( "dn", request.getName().getName() );
86 }
87
88
89 Element assertionElement = element.addElement( "assertion" );
90 if ( request.getAttributeId() != null )
91 {
92 assertionElement.addAttribute( "name", request.getAttributeId() );
93 }
94 if ( request.getAssertionValue() != null )
95 {
96 assertionElement.addElement( "value" ).setText( request.getAssertionValue().getString() );
97 }
98
99 return element;
100 }
101
102
103
104
105
106
107
108 public Dn getName()
109 {
110 return getDecorated().getName();
111 }
112
113
114
115
116
117
118
119 public CompareRequest setName( Dn entry )
120 {
121 getDecorated().setName( entry );
122
123 return this;
124 }
125
126
127
128
129
130
131
132 public void setAssertionValue( Object assertionValue )
133 {
134 if ( assertionValue instanceof String )
135 {
136 getDecorated().setAssertionValue( ( String ) assertionValue );
137 }
138 else
139 {
140 getDecorated().setAssertionValue( ( byte[] ) assertionValue );
141 }
142 }
143
144
145
146
147
148
149
150 public String getAttributeDesc()
151 {
152 return getDecorated().getAttributeId();
153 }
154
155
156
157
158
159
160
161 public void setAttributeDesc( String attributeDesc )
162 {
163 getDecorated().setAttributeId( attributeDesc );
164 }
165
166
167
168
169
170 public MessageTypeEnum getResponseType()
171 {
172 return getDecorated().getResponseType();
173 }
174
175
176
177
178
179 public CompareRequest setAssertionValue( String value )
180 {
181 getDecorated().setAssertionValue( value );
182
183 return this;
184 }
185
186
187
188
189
190 public CompareRequest setAssertionValue( byte[] value )
191 {
192 getDecorated().setAssertionValue( value );
193
194 return this;
195 }
196
197
198
199
200
201 public String getAttributeId()
202 {
203 return getDecorated().getAttributeId();
204 }
205
206
207
208
209
210 public CompareRequest setAttributeId( String attrId )
211 {
212 getDecorated().setAttributeId( attrId );
213
214 return this;
215 }
216
217
218
219
220
221 public Value<?> getAssertionValue()
222 {
223 return getDecorated().getAssertionValue();
224 }
225
226
227
228
229
230 public CompareRequest setMessageId( int messageId )
231 {
232 super.setMessageId( messageId );
233
234 return this;
235 }
236
237
238
239
240
241 public CompareRequest addControl( Control control )
242 {
243 return ( CompareRequest ) super.addControl( control );
244 }
245
246
247
248
249
250 public CompareRequest addAllControls( Control[] controls )
251 {
252 return ( CompareRequest ) super.addAllControls( controls );
253 }
254
255
256
257
258
259 public CompareRequest removeControl( Control control )
260 {
261 return ( CompareRequest ) super.removeControl( control );
262 }
263 }