source: cats/ISOcat/trunk/mod-ISOcat-access-data/access/message_new.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.7 KB
Line 
1<accessor debug="false">
2        <name>ISOcat.access.data.message.send</name>
3        <descr>Send a message from one user to the other</descr>
4        <param mandatory="true">
5                <name>msg</name>
6                <descr>the message</descr>
7        </param>
8        <idoc>
9                <accessor-debug>
10                        <instr>
11                                <type>log</type>
12                                <operand>var:msg</operand>
13                        </instr>
14                </accessor-debug>
15                <instr>
16                        <type>isocat.sqlEncodeElement</type>
17                        <operand>var:msg</operand>
18                        <operator>
19                                <xpath>/message/action</xpath>
20                        </operator>
21                        <target>var:enc</target>
22                </instr>
23                <accessor-debug>
24                        <instr>
25                                <type>log</type>
26                                <operand>var:enc</operand>
27                        </instr>
28                </accessor-debug>
29                <!-- store the message -->
30                <!-- * get an id -->
31                <instr>
32                        <type>isocat.sqlQuery</type>
33                        <operand>
34                                <sql>
35                                        SELECT nextval('core_message_id_seq'::regclass) AS id;
36                                </sql>
37                        </operand>
38                        <target>var:id</target>
39                </instr>
40                <!-- * get a token -->
41                <instr>
42                        <type>sloot.xquery</type>
43                        <operator>
44                                <xquery>
45                                        declare namespace rp="java:com.Ostermiller.util.RandPass";
46                                       
47                                        &lt;string>{
48                                                rp:getPass(rp:new(('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z')))
49                                        }&lt;/string>
50                                </xquery>
51                        </operator>
52                        <target>var:token</target>
53                </instr>
54                <instr>
55                        <type>sloot.xquery</type>
56                        <operator>
57                                <xquery xmlns:isocat="http://www.isocat.org/">
58                                        <sql>
59                                                INSERT INTO
60                                                        core_message
61                                                (
62                                                        "id",
63                                                        "from",
64                                                        "to",
65                                                        "subject",
66                                                        "message",
67                                                        "type",
68                                                        "action",
69                                                        "token"
70                                                )
71                                                VALUES
72                                                (
73                                                        {string($id)},
74                                                        {string($msg/message/@from)},
75                                                        {string($msg/message/@to)},
76                                                        '{replace(string($msg/message/subject),"'","''")}',
77                                                        '{replace(string($msg/message/body),"'","''")}',
78                                                        '{replace(string($msg/message/action/local-name(*)),"'","''")}',
79                                                        '{replace(string($enc/message/action),"'","''")}',
80                                                        '{string($token)}'
81                                                )
82                                                ;
83                                        </sql>
84                                </xquery>
85                        </operator>
86                        <id>var:id</id>
87                        <msg>var:msg</msg>
88                        <enc>var:enc</enc>
89                        <token>var:token</token>
90                        <target>var:sql</target>
91                </instr>
92                <accessor-debug>
93                        <instr>
94                                <type>log</type>
95                                <operand>var:sql</operand>
96                        </instr>
97                </accessor-debug>
98                <instr>
99                        <type>isocat.sqlUpdate</type>
100                        <operand>var:sql</operand>
101                        <target>var:result</target>
102                </instr>
103                <instr>
104                        <type>copy</type>
105                        <operand>var:id</operand>
106                        <target>this:response</target>
107                </instr>
108        </idoc>
109        <exception>
110                <debug/>
111                <trace>ffcpl:/trace/message_new.exception.xml</trace>
112                <throw/>
113        </exception>
114        <response>
115                <debug>ffcpl:/trace/message_new.response.xml</debug>
116                <mime>application/xml</mime>
117                <expire>now</expire>
118        </response>
119</accessor>
Note: See TracBrowser for help on using the repository browser.