<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Automation chain with parametrized Query in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/automation-chain-with-parametrized-query/m-p/322684#M9685</link>
    <description>&lt;P&gt;Hi, I'm inside an automation chain and I need to get the current user's private workspace.
The trouble is that user names are in the form: username@domain.com, and the private workspace is named like 'username-domain-com'. How can I write a query replacing both "@" and "." from the current user's name with "-"?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;SELECT * FROM Document WHERE ecm:path='/default-domain/UserWorkspaces/@{CurrentUser.name}'
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;is evaluated as&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;SELECT * FROM Document WHERE ecm:path='/default-domain/UserWorkspaces/myUser@domain.com'
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;but I need it to come out as&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;SELECT * FROM Document WHERE ecm:path='/default-domain/UserWorkspaces/myUser-domain-com'
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 13 Oct 2011 11:05:55 GMT</pubDate>
    <dc:creator>elteo_</dc:creator>
    <dc:date>2011-10-13T11:05:55Z</dc:date>
    <item>
      <title>Automation chain with parametrized Query</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/automation-chain-with-parametrized-query/m-p/322684#M9685</link>
      <description>&lt;P&gt;Hi, I'm inside an automation chain and I need to get the current user's private workspace.
The trouble is that user names are in the form: username@domain.com, and the private workspace is named like 'username-domain-com'. How can I write a query replacing both "@" and "." from the current user's name with "-"?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;SELECT * FROM Document WHERE ecm:path='/default-domain/UserWorkspaces/@{CurrentUser.name}'
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;is evaluated as&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;SELECT * FROM Document WHERE ecm:path='/default-domain/UserWorkspaces/myUser@domain.com'
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;but I need it to come out as&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;SELECT * FROM Document WHERE ecm:path='/default-domain/UserWorkspaces/myUser-domain-com'
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 13 Oct 2011 11:05:55 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/automation-chain-with-parametrized-query/m-p/322684#M9685</guid>
      <dc:creator>elteo_</dc:creator>
      <dc:date>2011-10-13T11:05:55Z</dc:date>
    </item>
    <item>
      <title>Re: Automation chain with parametrized Query</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/automation-chain-with-parametrized-query/m-p/322685#M9686</link>
      <description>&lt;P&gt;FYI in the next version ofNuxeo (5.4.3 or whatever it's named) a &lt;CODE&gt;UserWorkspace.Get&lt;/CODE&gt; operation has been added that will help you once you upgrade (cf &lt;A href="https://jira.nuxeo.com/browse/NXP-7638"&gt;NXP-7638&lt;/A&gt;).&lt;/P&gt;</description>
      <pubDate>Thu, 13 Oct 2011 16:17:12 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/automation-chain-with-parametrized-query/m-p/322685#M9686</guid>
      <dc:creator>Florent_Guillau</dc:creator>
      <dc:date>2011-10-13T16:17:12Z</dc:date>
    </item>
    <item>
      <title>Re: Automation chain with parametrized Query</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/automation-chain-with-parametrized-query/m-p/322686#M9687</link>
      <description>&lt;P&gt;if you really need this feature on your old version of Nuxeo, and if you have little development skills you can:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;P&gt;create &lt;A href="http://doc.nuxeo.com/display/IDEDOC/Getting+started+with+Nuxeo+IDE"&gt;a nuxeo plugin with Nuxeo IDE&lt;/A&gt;, it's really easy.&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;Create a new operation given a void as input and Document as output&lt;/P&gt;
&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;declare a variable that will receive the username&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt; @Param(name = "username", widget = Constants.W_TEXT)
 protected String username;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;And in your operation method, just get the userworkspace service&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;           UserWorkspaceService uws = Framework.getLocalService(UserWorkspaceService.class);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;I let you check how to get the workspace from it &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;
&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Hope will help you&lt;/P&gt;</description>
      <pubDate>Fri, 10 Feb 2012 11:41:46 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/automation-chain-with-parametrized-query/m-p/322686#M9687</guid>
      <dc:creator>Benjamin_Jalon1</dc:creator>
      <dc:date>2012-02-10T11:41:46Z</dc:date>
    </item>
    <item>
      <title>Re: Automation chain with parametrized Query</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/automation-chain-with-parametrized-query/m-p/322687#M9688</link>
      <description>&lt;P&gt;Other solution: you can use a "Run Script" operation before and produce your string using some MVEL expressions, mostly the String API (the same you have on java :http://docs.oracle.com/javase/6/docs/api/java/lang/String.html). You can use replace, match, .... and work on your string.&lt;/P&gt;
&lt;P&gt;An exemple of script put in a Run Script (that doesn't do what you aim at though, just an exemple):&lt;/P&gt;
&lt;P&gt;org.nuxeo.ecm.core.api.Blob myBlob=Document.getProperty("file:content");
Context["extension"]="none";
Context["filename"] = myBlob.getFilename();
String[]  splitedFilename=Context["filename"].split("\.");
Context["extension"]="none";if (splitedFilename.length&amp;gt;=2){Context["extension"]=splitedFilename[splitedFilename.length-1]};&lt;/P&gt;</description>
      <pubDate>Tue, 14 Feb 2012 15:46:48 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/automation-chain-with-parametrized-query/m-p/322687#M9688</guid>
      <dc:creator>Alain_ESCAFFRE</dc:creator>
      <dc:date>2012-02-14T15:46:48Z</dc:date>
    </item>
  </channel>
</rss>

