source: ISOcat/trunk/mod-ISOcat-interface-rest/interface/cr_sg.acc @ 2029

Last change on this file since 2029 was 2029, checked in by mwindhouwer, 12 years ago

Initial import of all the *cats, i.e., ISOcat, RELcat and SCHEMAcat.

File size: 3.0 KB
Line 
1<accessor debug="false" trace="false">
2        <name>/rest/cr/sg</name>
3        <descr>Change Request submission group handler</descr>
4        <param mandatory="true">
5                <name>cr</name>
6                <descr>the CR id</descr>
7                <type canonical="true">string</type>
8                <source>
9                        <param/>
10                        <nvp/>
11                        <default>
12                                <string>0</string>
13                        </default>
14                </source>
15        </param>
16        <param mandatory="true">
17                <name>sg</name>
18                <descr>the submission group id</descr>
19                <type canonical="true">string</type>
20                <source>
21                        <param/>
22                        <nvp/>
23                        <default>
24                                <string>0</string>
25                        </default>
26                </source>
27        </param>
28        <!-- HTTP params -->
29        <param mandatory="true">
30                <name>method</name>
31                <descr>what do we want to do?</descr>
32                <type canonical="true">string</type>
33        </param>
34        <param>
35                <name>credentials</name>
36                <descr>the users credentials</descr>
37                <type canonical="true">string</type>
38                <source>
39                        <param/>
40                        <default>
41                                <string>guest:guest</string>
42                        </default>
43                </source>
44        </param>
45        <params/>
46        <idoc>
47                <!-- determine the user logged in -->
48                <instr>
49                        <type>sloot.xpath2eval</type>
50                        <operand>var:credentials</operand>
51                        <operator>
52                                <xpath>substring-before(.,':')</xpath>
53                        </operator>
54                        <param>
55                                <return>
56                                        <canonical/>
57                                        <null/>
58                                </return>
59                        </param>
60                        <target>var:user</target>
61                </instr>
62                <accessor-debug>
63                        <instr>
64                                <type>sloot.log</type>
65                                <operand>
66                                        <msg>user[{string($user)}]</msg>
67                                </operand>
68                                <user>var:user</user>
69                        </instr>
70                </accessor-debug>
71                <!-- handle the method -->
72                <choose>
73                        <cond>
74                                <instr>
75                                        <type>sloot.xpath2eval</type>
76                                        <operand>var:method</operand>
77                                        <operator>
78                                                <xpath>.='GET'</xpath>
79                                        </operator>
80                                        <target>this:cond</target>
81                                </instr>
82                        </cond>
83                        <then>
84                                <if>
85                                        <cond>
86                                                <instr>
87                                                        <type>sloot.xpath2eval</type>
88                                                        <operand>var:sg</operand>
89                                                        <operator>
90                                                                <xpath>.='0'</xpath>
91                                                        </operator>
92                                                        <target>this:cond</target>
93                                                </instr>
94                                        </cond>
95                                        <then>
96                                                <instr>
97                                                        <type>throw</type>
98                                                        <operand>
99                                                                <ex>
100                                                                        <id>ISOcat[BAD REQUEST]</id>
101                                                                        <message>The decision group to be retrieved should already have an id.</message>
102                                                                </ex>
103                                                        </operand>
104                                                </instr>
105                                        </then>
106                                </if>
107                                <instr>
108                                        <type>ISOcat.manage.cr.sg</type>
109                                        <user>var:user</user>
110                                        <cr>var:cr</cr>
111                                        <sg>var:sg</sg>
112                                        <credentials>var:credentials</credentials>
113                                        <target>this:response</target>
114                                </instr>
115                        </then>
116                        <else>
117                                <instr>
118                                        <type>throw</type>
119                                        <operand>
120                                                <ex>
121                                                        <id>ISOcat[METHOD NOT ALLOWED]</id>
122                                                        <message>You can not access this resource using this method.</message>
123                                                </ex>
124                                        </operand>
125                                </instr>
126                        </else>
127                </choose>
128                <instr>
129                        <type>cast</type>
130                        <operand>this:response</operand>
131                        <operator>
132                                <cast>
133                                        <mimetype>application/xml</mimetype>
134                                </cast>
135                        </operator>
136                        <target>this:response</target>
137                </instr>
138        </idoc>
139        <exception>
140                <debug/>
141                <trace>ffcpl:/trace/cr_new.exception.xml</trace>
142                <throw/>
143        </exception>
144        <response>
145                <debug>ffcpl:/trace/cr_new.response.xml</debug>
146        </response>
147</accessor>
148
Note: See TracBrowser for help on using the repository browser.