1 | <?xml version="1.0"?> |
---|
2 | <accessor debug="false"> |
---|
3 | <name>ISOcat.access.data.dc.status</name> |
---|
4 | <descr>Change the status of a DC.</descr> |
---|
5 | <param mandatory="true"> |
---|
6 | <name>dc</name> |
---|
7 | <descr>the DC id</descr> |
---|
8 | <type canonical="true">string</type> |
---|
9 | </param> |
---|
10 | <param mandatory="true"> |
---|
11 | <name>user</name> |
---|
12 | <descr>the user changing the DC status</descr> |
---|
13 | <type canonical="true">string</type> |
---|
14 | </param> |
---|
15 | <param> |
---|
16 | <name>status</name> |
---|
17 | <descr>the new status (derived administration and registration status)</descr> |
---|
18 | <type canonical="true">string</type> |
---|
19 | <source> |
---|
20 | <param/> |
---|
21 | <default> |
---|
22 | <string/> |
---|
23 | </default> |
---|
24 | </source> |
---|
25 | </param> |
---|
26 | <param> |
---|
27 | <name>administration</name> |
---|
28 | <descr>the new administration status (explicit)</descr> |
---|
29 | <type canonical="true">string</type> |
---|
30 | <source> |
---|
31 | <param/> |
---|
32 | <default> |
---|
33 | <string/> |
---|
34 | </default> |
---|
35 | </source> |
---|
36 | </param> |
---|
37 | <param> |
---|
38 | <name>registration</name> |
---|
39 | <descr>the new registration status (explicit)</descr> |
---|
40 | <type canonical="true">string</type> |
---|
41 | <source> |
---|
42 | <param/> |
---|
43 | <default> |
---|
44 | <string/> |
---|
45 | </default> |
---|
46 | </source> |
---|
47 | </param> |
---|
48 | <param> |
---|
49 | <name>message</name> |
---|
50 | <descr>message about the status change</descr> |
---|
51 | <type canonical="true">string</type> |
---|
52 | <source> |
---|
53 | <param/> |
---|
54 | <default> |
---|
55 | <string/> |
---|
56 | </default> |
---|
57 | </source> |
---|
58 | </param> |
---|
59 | <param> |
---|
60 | <name>check</name> |
---|
61 | <descr>check the new DC</descr> |
---|
62 | <type canonical="true">string</type> |
---|
63 | <source> |
---|
64 | <param/> |
---|
65 | <default> |
---|
66 | <string>true</string> |
---|
67 | </default> |
---|
68 | </source> |
---|
69 | </param> |
---|
70 | <idoc> |
---|
71 | <instr> |
---|
72 | <type>ISOcat.access.data.user.id</type> |
---|
73 | <user>var:user</user> |
---|
74 | <target>var:user</target> |
---|
75 | </instr> |
---|
76 | <instr> |
---|
77 | <type>xslt2</type> |
---|
78 | <operand> |
---|
79 | <null/> |
---|
80 | </operand> |
---|
81 | <operator> |
---|
82 | <xsl:stylesheet |
---|
83 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
---|
84 | version="2.0" |
---|
85 | > |
---|
86 | <xsl:param name="dc"/> |
---|
87 | <xsl:param name="status"/> |
---|
88 | <xsl:param name="administration"/> |
---|
89 | <xsl:param name="registration"/> |
---|
90 | <xsl:template match="/"> |
---|
91 | <status dc="{$dc}"> |
---|
92 | <xsl:choose> |
---|
93 | <xsl:when test="$status='private'"> |
---|
94 | <administration>private</administration> |
---|
95 | <registration>private</registration> |
---|
96 | </xsl:when> |
---|
97 | <xsl:when test="$status='submission' or $status='candidate'"> |
---|
98 | <administration>submission</administration> |
---|
99 | <registration>candidate</registration> |
---|
100 | </xsl:when> |
---|
101 | <xsl:when test="$status='pre-evaluation'"> |
---|
102 | <administration>pre-evaluation</administration> |
---|
103 | <registration>candidate</registration> |
---|
104 | </xsl:when> |
---|
105 | <xsl:when test="$status='evaluation'"> |
---|
106 | <administration>evaluation</administration> |
---|
107 | <registration>candidate</registration> |
---|
108 | </xsl:when> |
---|
109 | <xsl:when test="$status='rejected-TDG'"> |
---|
110 | <administration>rejected-TDG</administration> |
---|
111 | <registration>candidate</registration> |
---|
112 | </xsl:when> |
---|
113 | <xsl:when test="$status='accepted-TDG'"> |
---|
114 | <administration>accepted-TDG</administration> |
---|
115 | <registration>candidate</registration> |
---|
116 | </xsl:when> |
---|
117 | <xsl:when test="$status='pre-validation'"> |
---|
118 | <administration>pre-validation</administration> |
---|
119 | <registration>candidate</registration> |
---|
120 | </xsl:when> |
---|
121 | <xsl:when test="$status='validation'"> |
---|
122 | <administration>validation</administration> |
---|
123 | <registration>candidate</registration> |
---|
124 | </xsl:when> |
---|
125 | <xsl:when test="$status='rejected-DCRB'"> |
---|
126 | <administration>rejected-DCRB</administration> |
---|
127 | <registration>candidate</registration> |
---|
128 | </xsl:when> |
---|
129 | <xsl:when test="$status='accepted' or $status='standard'"> |
---|
130 | <administration>accepted</administration> |
---|
131 | <registration>standard</registration> |
---|
132 | </xsl:when> |
---|
133 | <xsl:when test="$status='deprecated'"> |
---|
134 | <registration>deprecated</registration> |
---|
135 | </xsl:when> |
---|
136 | <xsl:when test="$status='superseded'"> |
---|
137 | <registration>superseded</registration> |
---|
138 | </xsl:when> |
---|
139 | <xsl:when test="$status='external'"> |
---|
140 | <administration>external</administration> |
---|
141 | </xsl:when> |
---|
142 | <xsl:otherwise> |
---|
143 | <xsl:if test="$administration!=''"> |
---|
144 | <administration> |
---|
145 | <xsl:value-of select="$administration"/> |
---|
146 | </administration> |
---|
147 | </xsl:if> |
---|
148 | <xsl:if test="$registration!=''"> |
---|
149 | <registration> |
---|
150 | <xsl:value-of select="$registration"/> |
---|
151 | </registration> |
---|
152 | </xsl:if> |
---|
153 | </xsl:otherwise> |
---|
154 | </xsl:choose> |
---|
155 | </status> |
---|
156 | </xsl:template> |
---|
157 | </xsl:stylesheet> |
---|
158 | </operator> |
---|
159 | <dc>var:dc</dc> |
---|
160 | <status>var:status</status> |
---|
161 | <administration>var:administration</administration> |
---|
162 | <registration>var:registration</registration> |
---|
163 | <target>var:status</target> |
---|
164 | </instr> |
---|
165 | <accessor-debug> |
---|
166 | <instr> |
---|
167 | <type>copy</type> |
---|
168 | <operand>var:status</operand> |
---|
169 | <target>ffcpl:/trace/dc_status.xml</target> |
---|
170 | </instr> |
---|
171 | </accessor-debug> |
---|
172 | <choose> |
---|
173 | <cond> |
---|
174 | <instr> |
---|
175 | <type>sloot.xpath2eval</type> |
---|
176 | <operand>var:status</operand> |
---|
177 | <operator> |
---|
178 | <xpath>exists(/status/(administration|registration))</xpath> |
---|
179 | </operator> |
---|
180 | <target>this:cond</target> |
---|
181 | </instr> |
---|
182 | </cond> |
---|
183 | <then> |
---|
184 | <instr> |
---|
185 | <type>xslt2</type> |
---|
186 | <operand>var:status</operand> |
---|
187 | <operator> |
---|
188 | <xsl:stylesheet |
---|
189 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform" |
---|
190 | version="2.0" |
---|
191 | > |
---|
192 | <xsl:param name="user"/> |
---|
193 | <xsl:param name="message"/> |
---|
194 | <xsl:template match="/status"> |
---|
195 | <xsl:message>INF: <xsl:value-of select="current-dateTime()"/>:DC[<xsl:value-of select="@dc"/>] administration[<xsl:value-of select="administration"/>] registration[<xsl:value-of select="registration"/>] user[<xsl:value-of select="$user"/>] comment[<xsl:value-of select="$message"/>]</xsl:message> |
---|
196 | <batch> |
---|
197 | <sql> |
---|
198 | UPDATE |
---|
199 | core_data_category |
---|
200 | SET |
---|
201 | <xsl:if test="exists(administration)"> |
---|
202 | administration_status = '<xsl:value-of select="administration"/>' |
---|
203 | </xsl:if> |
---|
204 | <xsl:if test="exists(administration) and exists(registration)"> |
---|
205 | , |
---|
206 | </xsl:if> |
---|
207 | <xsl:if test="exists(registration)"> |
---|
208 | registration_status = '<xsl:value-of select="registration"/>' |
---|
209 | </xsl:if> |
---|
210 | WHERE |
---|
211 | core_data_category.id = <xsl:value-of select="@dc"/> |
---|
212 | ; |
---|
213 | </sql> |
---|
214 | <sql> |
---|
215 | INSERT INTO |
---|
216 | core_dc_status_log |
---|
217 | ( |
---|
218 | "dc", |
---|
219 | "user", |
---|
220 | "administration_status", |
---|
221 | "registration_status", |
---|
222 | "comment" |
---|
223 | ) |
---|
224 | SELECT |
---|
225 | core_data_category.id AS "dc", |
---|
226 | <xsl:value-of select="$user"/> AS "user", |
---|
227 | <xsl:choose> |
---|
228 | <xsl:when test="exists(administration)"> |
---|
229 | '<xsl:value-of select="administration"/>' AS "administration_status", |
---|
230 | </xsl:when> |
---|
231 | <xsl:otherwise> |
---|
232 | core_data_category.administration_status AS "administration_status", |
---|
233 | </xsl:otherwise> |
---|
234 | </xsl:choose> |
---|
235 | <xsl:choose> |
---|
236 | <xsl:when test="exists(registration)"> |
---|
237 | '<xsl:value-of select="registration"/>' AS "registration_status", |
---|
238 | </xsl:when> |
---|
239 | <xsl:otherwise> |
---|
240 | core_data_category.registration_status AS "registration_status", |
---|
241 | </xsl:otherwise> |
---|
242 | </xsl:choose> |
---|
243 | <xsl:choose> |
---|
244 | <xsl:when test="normalize-space($message)!=''"> |
---|
245 | '<xsl:value-of select="replace($message,"'","''")"/>' |
---|
246 | </xsl:when> |
---|
247 | <xsl:otherwise> |
---|
248 | NULL |
---|
249 | </xsl:otherwise> |
---|
250 | </xsl:choose> |
---|
251 | FROM |
---|
252 | core_data_category |
---|
253 | WHERE |
---|
254 | core_data_category.id = <xsl:value-of select="@dc"/> |
---|
255 | ; |
---|
256 | </sql> |
---|
257 | </batch> |
---|
258 | </xsl:template> |
---|
259 | </xsl:stylesheet> |
---|
260 | </operator> |
---|
261 | <user>var:user</user> |
---|
262 | <message>var:message</message> |
---|
263 | <target>var:sql</target> |
---|
264 | </instr> |
---|
265 | <accessor-debug> |
---|
266 | <instr> |
---|
267 | <type>copy</type> |
---|
268 | <operand>var:sql</operand> |
---|
269 | <target>ffcpl:/trace/dc_status.sql.xml</target> |
---|
270 | </instr> |
---|
271 | </accessor-debug> |
---|
272 | <instr> |
---|
273 | <type>sqlBatch</type> |
---|
274 | <operand>var:sql</operand> |
---|
275 | <target>var:result</target> |
---|
276 | </instr> |
---|
277 | <accessor-debug> |
---|
278 | <instr> |
---|
279 | <type>copy</type> |
---|
280 | <operand>var:result</operand> |
---|
281 | <target>ffcpl:/trace/dc_status.result.xml</target> |
---|
282 | </instr> |
---|
283 | </accessor-debug> |
---|
284 | <!-- touch the updated DC --> |
---|
285 | <choose> |
---|
286 | <cond> |
---|
287 | <instr> |
---|
288 | <type>sloot.xpath2eval</type> |
---|
289 | <operand>var:check</operand> |
---|
290 | <operator> |
---|
291 | <xpath>.='true'</xpath> |
---|
292 | </operator> |
---|
293 | <target>this:cond</target> |
---|
294 | </instr> |
---|
295 | </cond> |
---|
296 | <then> |
---|
297 | <instr> |
---|
298 | <type>ISOcat.access.data.dc.touch</type> |
---|
299 | <dc>var:dc</dc> |
---|
300 | <target>var:void</target> |
---|
301 | </instr> |
---|
302 | </then> |
---|
303 | </choose> |
---|
304 | </then> |
---|
305 | </choose> |
---|
306 | <instr> |
---|
307 | <type>sloot.dbx</type> |
---|
308 | <dc>var:dc</dc> |
---|
309 | <operator>ffcpl:/dbx/DC-status.xml</operator> |
---|
310 | <debug>var:accessor-debug</debug> |
---|
311 | <trace>var:accessor-trace</trace> |
---|
312 | <target>this:response</target> |
---|
313 | </instr> |
---|
314 | </idoc> |
---|
315 | <exception> |
---|
316 | <debug/> |
---|
317 | <trace>ffcpl:/trace/dc_status.exception.xml</trace> |
---|
318 | <throw/> |
---|
319 | </exception> |
---|
320 | <response> |
---|
321 | <mime>application/xml</mime> |
---|
322 | </response> |
---|
323 | </accessor> |
---|