Changeset 3164
- Timestamp:
- 07/18/13 16:13:20 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
cats/SCHEMAcat/trunk/urn.org.isocat.schemacat.access.data/access/user.dpml
r3090 r3164 5 5 <level>INFO</level> 6 6 <message> 7 <literal type="string">user verb: %1</literal>7 <literal type="string">user accessor verb: %1 for principal : %2</literal> 8 8 </message> 9 9 <param>arg:verb</param> 10 <param>arg:principal</param> 11 <!-- weird!! first call prints principal 2nd call print object id --> 10 12 </log> 11 13 </sloot-debug> 12 <switch >13 < !--<cond>14 <switch assignment="response"> 15 <cond> 14 16 <request> 15 17 <identifier>active:sloot.xpath2</identifier> … … 22 24 <then> 23 25 <sequence> 24 <request assignment="response"> 26 <!-- compute the id for the new user --> 27 <request assignment="new-user-id"> 28 <identifier>active:sloot.generateUUID</identifier> 29 </request> 30 <!-- create the new user --> 31 <request> 25 32 <identifier>active:org.basex.query</identifier> 26 33 <argument name="operator"> 27 <request> 28 <identifier>active:sloot.xquery</identifier> 29 <argument name="operator"> 30 <literal type="xml"> 31 <user xmlns:sc="http://www.isocat.org/ns/schemacat"> 32 {{//sc:user[sc:principal={$principal}]/@*,//sc:user[sc:principal={$principal}]/*)}} 33 </user> 34 </literal> 35 </argument> 36 <argument name="principal">arg:principal</argument> 37 </request> 34 <literal type="xml"> 35 <query xmlns:sc="http://www.isocat.org/ns/schemacat"> let $new-user := 36 element user { attribute xml:id {$new-user-id}, element principal 37 {$principal}, element displayName {$principal}, element role 38 {'user'} } return insert node $new-user into /sc:users </query> 39 </literal> 38 40 </argument> 41 <argument name="principal">arg:principal</argument> 42 <argument name="new-user-id">this:new-user-id</argument> 39 43 </request> 44 <literal assignment="response" type="boolean">true</literal> 40 45 <log> 41 46 <level>INFO</level> 42 47 <message> 43 <literal type="string"> user [%1] < [%2]</literal>48 <literal type="string">Created user for principal: [%1]</literal> 44 49 </message> 45 50 <param>arg:principal</param> 46 <param>this:response</param>47 51 </log> 48 52 </sequence> 49 </then> -->53 </then> 50 54 <cond> 51 55 <request> … … 60 64 <!-- check if the user exists in the database --> 61 65 <!-- TODO: do we always search by principal? also support the user/@xml:id pattern 'u[0-9]+', which is unlikely(?) to clash with the principal? --> 62 <request assignment="response">66 <request> 63 67 <identifier>active:org.basex.booleanQuery</identifier> 64 68 <argument name="operator"> 65 69 <literal type="xml"> 66 <b xmlns:sc="http://www.isocat.org/ns/schemacat">{exists(//sc:user[sc:principal=$principal])}</b> 70 <query xmlns:sc="http://www.isocat.org/ns/schemacat"> 71 <b>{exists(//sc:user[sc:principal=$principal])}</b> 72 </query> 67 73 </literal> 68 74 </argument> … … 81 87 <then> 82 88 <!-- get the user information --> 83 <request assignment="response"> 84 <identifier>active:org.basex.query</identifier> 85 <argument name="operator"> 86 <literal type="xml"> 87 <sc:user xmlns:sc="http://www.isocat.org/ns/schemacat">{(//sc:user[sc:principal=$principal]/@*,//sc:user[sc:principal=$principal]/*)}</sc:user> 88 </literal> 89 </argument> 90 <argument name="principal">arg:principal</argument> 91 </request> 89 <sequence> 90 <request assignment="res"> 91 <identifier>active:org.basex.query</identifier> 92 <argument name="operator"> 93 <literal type="xml"> 94 <query xmlns:sc="http://www.isocat.org/ns/schemacat"> 95 <sc:user>{(//sc:user[sc:principal=$principal]/@*,//sc:user[sc:principal=$principal]/*)}</sc:user> 96 </query> 97 </literal> 98 </argument> 99 <argument name="principal">arg:principal</argument> 100 </request> 101 <!-- pass the document returned by basex trough sloot.xpath2 so 102 when we log the response (end of this dpml) the actual user 103 document is logged instead of the value of its pointer!--> 104 <request assignment="response"> 105 <identifier>active:sloot.xpath2</identifier> 106 <argument name="operand">this:res</argument> 107 <argument name="operator"> 108 <literal type="xml"> 109 <dummy>.</dummy> 110 </literal> 111 </argument> 112 </request> 113 114 <!-- AAM: it would be better to use sloot.xquery instead of sloot.xpath2 115 for instance to log the user document in its own line. However using it 116 causes a type mismatch in findUser.dpml since sloot.xquery does not seem 117 to return an element of type "document" as expected by findUser.dpml 118 119 <request assignment="response"> 120 <identifier>active:sloot.xquery</identifier> 121 <argument name="operator"> 122 <literal type="xml"><dummy>{$NL}{$doc}{$NL}</dummy></literal> 123 </argument> 124 <argument name="NL"> 125 <literal type="string"> 126 </literal> 127 </argument> 128 <argument name="doc">this:res</argument> 129 </request>--> 130 131 </sequence> 92 132 </then> 93 133 <otherwise> … … 103 143 </switch> 104 144 <sloot-debug> 145 <log> 146 <level>INFO</level> 147 <message> 148 <literal type="string">user accessor response: [%1]</literal> 149 </message> 150 <param>this:response</param> 151 </log> 105 152 <request> 106 153 <verb>SINK</verb>
Note: See TracChangeset
for help on using the changeset viewer.