1 | <accessor debug="false"> |
---|
2 | <name>/rest/group</name> |
---|
3 | <descr>Manage an group.</descr> |
---|
4 | <param mandatory="true"> |
---|
5 | <name>method</name> |
---|
6 | <descr>what do we want to do?</descr> |
---|
7 | <type canonical="true">string</type> |
---|
8 | </param> |
---|
9 | <param mandatory="true"> |
---|
10 | <name>group</name> |
---|
11 | <descr>the group key</descr> |
---|
12 | <type canonical="true">string</type> |
---|
13 | <source> |
---|
14 | <param/> |
---|
15 | <nvp/> |
---|
16 | <default> |
---|
17 | <string>0</string> |
---|
18 | </default> |
---|
19 | </source> |
---|
20 | </param> |
---|
21 | <param> |
---|
22 | <name>title</name> |
---|
23 | <descr>the title of the overview</descr> |
---|
24 | <type canonical="true">string</type> |
---|
25 | <source> |
---|
26 | <param/> |
---|
27 | <nvp/> |
---|
28 | <default> |
---|
29 | <string>default</string> |
---|
30 | </default> |
---|
31 | </source> |
---|
32 | </param> |
---|
33 | <param> |
---|
34 | <name>body</name> |
---|
35 | <descr>embed the HTML in a HTML envelope</descr> |
---|
36 | <type canonical="true">string</type> |
---|
37 | <source> |
---|
38 | <param/> |
---|
39 | <nvp/> |
---|
40 | <default> |
---|
41 | <string>true</string> |
---|
42 | </default> |
---|
43 | </source> |
---|
44 | </param> |
---|
45 | <param> |
---|
46 | <name>credentials</name> |
---|
47 | <descr>the user credentials</descr> |
---|
48 | <type canonical="true">string</type> |
---|
49 | <source> |
---|
50 | <param/> |
---|
51 | <default> |
---|
52 | <string>guest:guest</string> |
---|
53 | </default> |
---|
54 | </source> |
---|
55 | </param> |
---|
56 | <param> |
---|
57 | <name>representation</name> |
---|
58 | <descr>the requested representation</descr> |
---|
59 | <type canonical="true">string</type> |
---|
60 | <source> |
---|
61 | <param/> |
---|
62 | <default> |
---|
63 | <string/> |
---|
64 | </default> |
---|
65 | </source> |
---|
66 | </param> |
---|
67 | <param> |
---|
68 | <name>Accept</name> |
---|
69 | <descr>the accepted representation</descr> |
---|
70 | <type canonical="true">string</type> |
---|
71 | <source> |
---|
72 | <param/> |
---|
73 | <default> |
---|
74 | <string/> |
---|
75 | </default> |
---|
76 | </source> |
---|
77 | </param> |
---|
78 | <params/> |
---|
79 | <idoc> |
---|
80 | <!-- determine the requested representation --> |
---|
81 | <if> |
---|
82 | <cond> |
---|
83 | <instr> |
---|
84 | <type>sloot.xpath2eval</type> |
---|
85 | <operand>var:representation</operand> |
---|
86 | <operator> |
---|
87 | <xpath>.=''</xpath> |
---|
88 | </operator> |
---|
89 | <target>this:cond</target> |
---|
90 | </instr> |
---|
91 | </cond> |
---|
92 | <then> |
---|
93 | <instr> |
---|
94 | <type>sloot.mimeparse</type> |
---|
95 | <accept>var:Accept</accept> |
---|
96 | <types>xml:application/xml html:text/html xhtml:application/xhtml+xml</types> |
---|
97 | <target>var:representation</target> |
---|
98 | </instr> |
---|
99 | </then> |
---|
100 | </if> |
---|
101 | <!-- get the user --> |
---|
102 | <instr> |
---|
103 | <type>sloot.xpath2eval</type> |
---|
104 | <operand>var:credentials</operand> |
---|
105 | <operator> |
---|
106 | <xpath>substring-before(.,':')</xpath> |
---|
107 | </operator> |
---|
108 | <param> |
---|
109 | <return> |
---|
110 | <canonical/> |
---|
111 | <string/> |
---|
112 | </return> |
---|
113 | </param> |
---|
114 | <target>var:user</target> |
---|
115 | </instr> |
---|
116 | <choose> |
---|
117 | <cond> |
---|
118 | <instr> |
---|
119 | <type>sloot.xpath2eval</type> |
---|
120 | <operand>var:method</operand> |
---|
121 | <operator> |
---|
122 | <xpath>.='PUT'</xpath> |
---|
123 | </operator> |
---|
124 | <target>this:cond</target> |
---|
125 | </instr> |
---|
126 | </cond> |
---|
127 | <then> |
---|
128 | <if> |
---|
129 | <cond> |
---|
130 | <instr> |
---|
131 | <type>sloot.xpath2eval</type> |
---|
132 | <operand>var:group</operand> |
---|
133 | <operator> |
---|
134 | <xpath>.!='0'</xpath> |
---|
135 | </operator> |
---|
136 | <target>this:cond</target> |
---|
137 | </instr> |
---|
138 | </cond> |
---|
139 | <then> |
---|
140 | <instr> |
---|
141 | <type>throw</type> |
---|
142 | <operand> |
---|
143 | <ex> |
---|
144 | <id>ISOcat[BAD REQUEST]</id> |
---|
145 | <message>The new group can't have an id yet.</message> |
---|
146 | </ex> |
---|
147 | </operand> |
---|
148 | </instr> |
---|
149 | </then> |
---|
150 | </if> |
---|
151 | <if> |
---|
152 | <cond> |
---|
153 | <instr> |
---|
154 | <type>sloot.non-exists</type> |
---|
155 | <operand>var:params</operand> |
---|
156 | <target>this:cond</target> |
---|
157 | </instr> |
---|
158 | </cond> |
---|
159 | <then> |
---|
160 | <instr> |
---|
161 | <type>throw</type> |
---|
162 | <operand> |
---|
163 | <ex> |
---|
164 | <id>ISOcat[BAD REQUEST]</id> |
---|
165 | <message>The new group is absent.</message> |
---|
166 | </ex> |
---|
167 | </operand> |
---|
168 | </instr> |
---|
169 | </then> |
---|
170 | </if> |
---|
171 | <instr> |
---|
172 | <type>ISOcat.manage.group.new</type> |
---|
173 | <user>var:user</user> |
---|
174 | <group>var:params</group> |
---|
175 | <credentials>var:credentials</credentials> |
---|
176 | <target>var:response</target> |
---|
177 | </instr> |
---|
178 | <accessor-debug> |
---|
179 | <instr> |
---|
180 | <type>sloot.debug</type> |
---|
181 | <debug>var:accessor-debug</debug> |
---|
182 | <operand>var:response</operand> |
---|
183 | </instr> |
---|
184 | </accessor-debug> |
---|
185 | <instr> |
---|
186 | <type>copy</type> |
---|
187 | <operand> |
---|
188 | <HTTPResponseCode> |
---|
189 | <code>201</code> |
---|
190 | </HTTPResponseCode> |
---|
191 | </operand> |
---|
192 | <target>var:code</target> |
---|
193 | </instr> |
---|
194 | <instr> |
---|
195 | <type>HTTPResponseCode</type> |
---|
196 | <operand>var:response</operand> |
---|
197 | <param>var:code</param> |
---|
198 | <target>var:response</target> |
---|
199 | </instr> |
---|
200 | </then> |
---|
201 | <cond> |
---|
202 | <instr> |
---|
203 | <type>sloot.xpath2eval</type> |
---|
204 | <operand>var:method</operand> |
---|
205 | <operator> |
---|
206 | <xpath>.='POST'</xpath> |
---|
207 | </operator> |
---|
208 | <target>this:cond</target> |
---|
209 | </instr> |
---|
210 | </cond> |
---|
211 | <then> |
---|
212 | <if> |
---|
213 | <cond> |
---|
214 | <instr> |
---|
215 | <type>sloot.xpath2eval</type> |
---|
216 | <operand>var:group</operand> |
---|
217 | <operator> |
---|
218 | <xpath>.='0'</xpath> |
---|
219 | </operator> |
---|
220 | <target>this:cond</target> |
---|
221 | </instr> |
---|
222 | </cond> |
---|
223 | <then> |
---|
224 | <instr> |
---|
225 | <type>throw</type> |
---|
226 | <operand> |
---|
227 | <ex> |
---|
228 | <id>ISOcat[BAD REQUEST]</id> |
---|
229 | <message>The group to be updated should already have an id.</message> |
---|
230 | </ex> |
---|
231 | </operand> |
---|
232 | </instr> |
---|
233 | </then> |
---|
234 | </if> |
---|
235 | <if> |
---|
236 | <cond> |
---|
237 | <instr> |
---|
238 | <type>sloot.non-exists</type> |
---|
239 | <operand>var:params</operand> |
---|
240 | <target>this:cond</target> |
---|
241 | </instr> |
---|
242 | </cond> |
---|
243 | <then> |
---|
244 | <instr> |
---|
245 | <type>throw</type> |
---|
246 | <operand> |
---|
247 | <ex> |
---|
248 | <id>ISOcat[BAD REQUEST]</id> |
---|
249 | <message>The group update is absent.</message> |
---|
250 | </ex> |
---|
251 | </operand> |
---|
252 | </instr> |
---|
253 | </then> |
---|
254 | </if> |
---|
255 | <instr> |
---|
256 | <type>ISOcat.manage.group.update</type> |
---|
257 | <id>var:group</id> |
---|
258 | <group>var:params</group> |
---|
259 | <user>var:user</user> |
---|
260 | <credentials>var:credentials</credentials> |
---|
261 | <target>var:response</target> |
---|
262 | </instr> |
---|
263 | <accessor-debug> |
---|
264 | <instr> |
---|
265 | <type>sloot.debug</type> |
---|
266 | <debug>var:accessor-debug</debug> |
---|
267 | <operand>var:response</operand> |
---|
268 | </instr> |
---|
269 | </accessor-debug> |
---|
270 | </then> |
---|
271 | <cond> |
---|
272 | <instr> |
---|
273 | <type>sloot.xpath2eval</type> |
---|
274 | <operand>var:method</operand> |
---|
275 | <operator> |
---|
276 | <xpath>.='GET'</xpath> |
---|
277 | </operator> |
---|
278 | <target>this:cond</target> |
---|
279 | </instr> |
---|
280 | </cond> |
---|
281 | <then> |
---|
282 | <if> |
---|
283 | <cond> |
---|
284 | <instr> |
---|
285 | <type>sloot.xpath2eval</type> |
---|
286 | <operand>var:group</operand> |
---|
287 | <operator> |
---|
288 | <xpath>.='0'</xpath> |
---|
289 | </operator> |
---|
290 | <target>this:cond</target> |
---|
291 | </instr> |
---|
292 | </cond> |
---|
293 | <then> |
---|
294 | <instr> |
---|
295 | <type>throw</type> |
---|
296 | <operand> |
---|
297 | <ex> |
---|
298 | <id>ISOcat[BAD REQUEST]</id> |
---|
299 | <message>The group to be retrieved should already have an id.</message> |
---|
300 | </ex> |
---|
301 | </operand> |
---|
302 | </instr> |
---|
303 | </then> |
---|
304 | </if> |
---|
305 | <instr> |
---|
306 | <type>ISOcat.manage.group</type> |
---|
307 | <group>var:group</group> |
---|
308 | <user>var:user</user> |
---|
309 | <credentials>var:credentials</credentials> |
---|
310 | <target>var:response</target> |
---|
311 | </instr> |
---|
312 | </then> |
---|
313 | <cond> |
---|
314 | <instr> |
---|
315 | <type>sloot.xpath2eval</type> |
---|
316 | <operand>var:method</operand> |
---|
317 | <operator> |
---|
318 | <xpath>.='DELETE'</xpath> |
---|
319 | </operator> |
---|
320 | <target>this:cond</target> |
---|
321 | </instr> |
---|
322 | </cond> |
---|
323 | <then> |
---|
324 | <instr> |
---|
325 | <type>ISOcat.manage.group.delete</type> |
---|
326 | <group>var:group</group> |
---|
327 | <user>var:user</user> |
---|
328 | <credentials>var:credentials</credentials> |
---|
329 | <target>var:response</target> |
---|
330 | </instr> |
---|
331 | <instr> |
---|
332 | <type>copy</type> |
---|
333 | <operand> |
---|
334 | <string>xml</string> |
---|
335 | </operand> |
---|
336 | <target>var:representation</target> |
---|
337 | </instr> |
---|
338 | </then> |
---|
339 | <else> |
---|
340 | <instr> |
---|
341 | <type>throw</type> |
---|
342 | <operand> |
---|
343 | <ex> |
---|
344 | <id>ISOcat[METHOD NOT ALLOWED]</id> |
---|
345 | <message>This method is not allowed for this resource.</message> |
---|
346 | </ex> |
---|
347 | </operand> |
---|
348 | </instr> |
---|
349 | </else> |
---|
350 | </choose> |
---|
351 | <choose> |
---|
352 | <cond> |
---|
353 | <instr> |
---|
354 | <type>sloot.xpath2eval</type> |
---|
355 | <operand>var:representation</operand> |
---|
356 | <operator> |
---|
357 | <xpath>.='xml'</xpath> |
---|
358 | </operator> |
---|
359 | <target>this:cond</target> |
---|
360 | </instr> |
---|
361 | </cond> |
---|
362 | <then> |
---|
363 | <instr> |
---|
364 | <type>cast</type> |
---|
365 | <operand>var:response</operand> |
---|
366 | <operator> |
---|
367 | <cast> |
---|
368 | <mimetype>application/xml</mimetype> |
---|
369 | </cast> |
---|
370 | </operator> |
---|
371 | <target>this:response</target> |
---|
372 | </instr> |
---|
373 | </then> |
---|
374 | <cond> |
---|
375 | <instr> |
---|
376 | <type>sloot.xpath2eval</type> |
---|
377 | <operand>var:representation</operand> |
---|
378 | <operator> |
---|
379 | <xpath>.='html'</xpath> |
---|
380 | </operator> |
---|
381 | <target>this:cond</target> |
---|
382 | </instr> |
---|
383 | </cond> |
---|
384 | <then> |
---|
385 | <instr> |
---|
386 | <type>xslt2</type> |
---|
387 | <operand>var:response</operand> |
---|
388 | <operator>ffcpl:/representations/html/group.xsl</operator> |
---|
389 | <title>var:title</title> |
---|
390 | <body>var:body</body> |
---|
391 | <props>active:ISOcat.manage.system.properties</props> |
---|
392 | <target>this:response</target> |
---|
393 | </instr> |
---|
394 | <instr> |
---|
395 | <type>cast</type> |
---|
396 | <operand>this:response</operand> |
---|
397 | <operator> |
---|
398 | <cast> |
---|
399 | <mimetype>text/html</mimetype> |
---|
400 | </cast> |
---|
401 | </operator> |
---|
402 | <target>this:response</target> |
---|
403 | </instr> |
---|
404 | </then> |
---|
405 | <cond> |
---|
406 | <instr> |
---|
407 | <type>sloot.xpath2eval</type> |
---|
408 | <operand>var:representation</operand> |
---|
409 | <operator> |
---|
410 | <xpath>.='xhtml'</xpath> |
---|
411 | </operator> |
---|
412 | <target>this:cond</target> |
---|
413 | </instr> |
---|
414 | </cond> |
---|
415 | <then> |
---|
416 | <instr> |
---|
417 | <type>xslt2</type> |
---|
418 | <operand>var:response</operand> |
---|
419 | <operator>ffcpl:/representations/html/group.xsl</operator> |
---|
420 | <title>var:title</title> |
---|
421 | <body>var:body</body> |
---|
422 | <props>active:ISOcat.manage.system.properties</props> |
---|
423 | <target>this:response</target> |
---|
424 | </instr> |
---|
425 | <instr> |
---|
426 | <type>cast</type> |
---|
427 | <operand>this:response</operand> |
---|
428 | <operator> |
---|
429 | <cast> |
---|
430 | <mimetype>application/xhtml+xml</mimetype> |
---|
431 | </cast> |
---|
432 | </operator> |
---|
433 | <target>this:response</target> |
---|
434 | </instr> |
---|
435 | </then> |
---|
436 | <else> |
---|
437 | <instr> |
---|
438 | <type>throw</type> |
---|
439 | <operand> |
---|
440 | <ex> |
---|
441 | <id>ISOcat[NOT FOUND]</id> |
---|
442 | <message>This representation isn't supported by this resource.</message> |
---|
443 | </ex> |
---|
444 | </operand> |
---|
445 | </instr> |
---|
446 | </else> |
---|
447 | </choose> |
---|
448 | </idoc> |
---|
449 | <exception> |
---|
450 | <debug/> |
---|
451 | <trace>ffcpl:/trace/group.exception.xml</trace> |
---|
452 | <throw/> |
---|
453 | </exception> |
---|
454 | <response> |
---|
455 | <debug>ffcpl:/trace/group.response.xml</debug> |
---|
456 | <expire>now</expire> |
---|
457 | </response> |
---|
458 | </accessor> |
---|
459 | |
---|