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