source: cats/ISOcat/trunk/mod-ISOcat-access-data/access/owner_id.acc @ 2686

Last change on this file since 2686 was 2686, checked in by mwindhouwer, 11 years ago

Fixed the throtteling:

  • all SQL request go through the ISOcat.database throttle (settings in the ISOcat config), also the indirect DBX ones
  • big (more then 100 DCs) DCS to DCIF go through the big-dcif throttle (hardcoded settings)
File size: 2.0 KB
Line 
1<accessor debug="false">
2        <name>ISOcat.access.data.owner.id</name>
3        <descr>Get an owner id.</descr>
4        <param mandatory="true">
5                <name>owner</name>
6                <descr>the owner login (or id)</descr>
7                <type canonical="true">string</type>
8        </param>
9        <idoc>
10                <choose>
11                        <cond>
12                                <instr>
13                                        <type>sloot.xpath2eval</type>
14                                        <operand>var:owner</operand>
15                                        <operator>
16                                                <xpath>matches(.,'^[1-9][0-9]*$')</xpath>
17                                        </operator>
18                                        <target>this:cond</target>
19                                </instr>
20                        </cond>
21                        <then>
22                                <instr>
23                                        <type>copy</type>
24                                        <operand>var:owner</operand>
25                                        <target>this:response</target>
26                                </instr>
27                        </then>
28                        <else>
29                                <instr>
30                                        <type>sloot.xquery</type>
31                                        <operator>
32                                                <sql>
33                                                        SELECT
34                                                                id
35                                                        FROM
36                                                                (
37                                                                        SELECT
38                                                                                id,
39                                                                                login AS name
40                                                                        FROM
41                                                                                core_user
42                                                                UNION
43                                                                        SELECT
44                                                                                id,
45                                                                                name
46                                                                        FROM
47                                                                                core_thematic_domain_group
48                                                                ) AS owner
49                                                        WHERE
50                                                                name = '{replace(string($owner),"'","\\'")}'
51                                                        LIMIT 1
52                                                        ;
53                                                </sql>
54                                        </operator>
55                                        <owner>var:owner</owner>
56                                        <target>var:sql</target>
57                                </instr>
58                                <accessor-debug>
59                                        <instr>
60                                                <type>copy</type>
61                                                <operand>var:sql</operand>
62                                                <target>ffcpl:/trace/owner_id.sql.xml</target>
63                                        </instr>
64                                </accessor-debug>
65                                <instr>
66                                        <type>isocat.sqlQuery</type>
67                                        <operand>var:sql</operand>
68                                        <target>var:own</target>
69                                </instr>
70                                <instr>
71                                        <type>sloot.xpath2eval</type>
72                                        <operand>var:own</operand>
73                                        <operator>
74                                                <xpath>(/results/row/id)[1]</xpath>
75                                        </operator>
76                                        <param>
77                                                <return>
78                                                        <canonical/>
79                                                        <string/>
80                                                </return>
81                                        </param>
82                                        <target>this:response</target>
83                                </instr>
84                        </else>
85                </choose>
86        </idoc>
87        <exception>
88                <debug/>
89                <trace>ffcpl:/trace/owner_id.exception.xml</trace>
90                <throw/>
91        </exception>
92        <response>
93                <debug>ffcpl:/trace/owner_id.response.xml</debug>
94                <mime>application/xml</mime>
95        </response>
96</accessor>
Note: See TracBrowser for help on using the repository browser.