Project

General

Profile

Actions

Feature #5096

closed

Support arguments in views

Added by Reynaud Sylvain about 11 years ago. Updated about 11 years ago.

Status:
Resolved
Priority:
High
Assigned To:
Category:
Engine
Target version:
Start date:
09/18/2013
Due date:
% Done:

100%

Estimated time:

Description

Refactoring steps:
1) replace @path-template with list of <argument>

  • support <argument> for path() only.
  • develop XSL to translate @path-template to <argument> (for lavoisier-update-config.sh).

2) replace XPath functions path() and request().

Replace @path-template with list of <argument>:
  • @name="string"
  • @pattern="regexp | .*"
  • @path-format=" | VALUE | name/value"
  • @eval => the default value (example: property('def')).
  • text() => the default value (NOTE: not allowed if preceding-sibling::argument[text()='']).

Example:

<view><!-- /vo/{vo=dteam}/{site=CC-IN2P3} -->
    <argument name="vo" path-format="name/value">dteam</argument>
    <argument name="site">CC-IN2P3</argument>
</view>

Replace XPath functions with:
  • STRING variables instead of path('k').
  • STRING path() with no argument.
  • NODESET arguments() with no argument.
  • NODE post() with no argument instead of request('k').
  • NODE current() as synonym of post() may be removed because it conflicts with function current() in eval() ???
  • NODE view(STRING, [<entry> NODESET]) instead of view(STRING, [STRING]).
  • NODE view_post(STRING, NODE, [<entry> NODESET]) instead of view_request(STRING, NODE, [STRING]).
  • OBJECT eval(STRING, [NODESET]) instead of eval(STRING, [BOOLEAN]).
  • NODESET users(['IP | DN | LOGIN']).
Function arguments() is a NODESET of <e:entry> documents, which contains ALL of the following in this order:
  • key/values extracted from query fields
  • key/values extracted from path
  • key/values extracted from posted HTML form
  • default values described in list of <argument>
Function post() is any XML document, which contains ONLY ONE of the following:
  • posted HTML form
  • posted XML data
  • XML data sent by view (NOTE: using function view_post())
  • NULL

Example: revert priority order or arguments

<view name="v1" xmlns:str="http://exslt.org/strings">
    <argument name="a">666</argument>
    <argument name="b" eval="6 * 111"/>
    <argument name="c"/>
    <argument name="d"/>
    <argument name="e"/>
    <connector type="XMLConnector">
        <parameter name="content" eval="view('v2',
  eval('entry(@name, text() | eval(@eval))', view('config')/*/lav:view[@name='v1']/lav:argument[text()!='' or @eval])
| post()/*/*
| eval('entry(@name, str:split(path(),&quot;/&quot;)[position(current())])',
                                             view('config')/*/lav:view[@name='v1']/lav:argument[not(@path-format='')])
| arguments())"/>
    </connector>
</view>
<view name="v2">
    <argument name="a"/><argument name="b"/><argument name="c"/><argument name="d"/><argument name="e"/>
    <connector type="StringConnector">
        <parameter name="content" eval="concat($a,'/',$b,'/',$c,'/',$d,'/',$e)"/>
    </connector>
</view>

If URL is...
POST http://localhost:8080/lavoisier/v1/path/path/path/path?a=query&b=query&c=query&d=query&e=query
a=post
b=post
c=post

Then result is...
666/666/post/path/query

Actions

Also available in: Atom PDF