<?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 Re: Can a User Action, Custom EL expression handle a compound Boolean of more than two clauses? in Nuxeo Forum</title>
    <link>https://connect.hyland.com/t5/nuxeo-forum/can-a-user-action-custom-el-expression-handle-a-compound-boolean/m-p/317731#M4732</link>
    <description>&lt;P&gt;In a user action, you do not have access to the layout context as it's unrelated. So layoutValue variable will always resolve to null here.&lt;/P&gt;
&lt;P&gt;You can however use EL expressions using "document" or "currentDocument" (this one since 5.5), other variables available in the context are "principal" or "currentUser" (this one also since 5.5).&lt;/P&gt;
&lt;P&gt;You can also call a custom method from a Seam component, but the Seam component has to be the first item of the expression to be resolved correctly, so something like &lt;CODE&gt;#{clipboardActions.canPasteFromClipboard}&lt;/CODE&gt; will work, but not something like &lt;CODE&gt;#{clipboardActions.canPasteFromClipboard and clipboardActions.canDoOtherStuff}&lt;/CODE&gt;.&lt;/P&gt;
&lt;P&gt;We do know that this can be confusing for users, hopefully we'll improve that in the future...&lt;/P&gt;</description>
    <pubDate>Thu, 10 May 2012 14:19:27 GMT</pubDate>
    <dc:creator>Anahide_Tchertc</dc:creator>
    <dc:date>2012-05-10T14:19:27Z</dc:date>
    <item>
      <title>Can a User Action, Custom EL expression handle a compound Boolean of more than two clauses?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/can-a-user-action-custom-el-expression-handle-a-compound-boolean/m-p/317730#M4731</link>
      <description>&lt;P&gt;I have the following custom EL expression in a user Action:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;${layoutValue.currentLifeCycleState != 'SupRequest1' &amp;amp;&amp;amp; layoutValue.currentLifeCycleState != 'SupRequest2' &amp;amp;&amp;amp; layoutValue.currentLifeCycleState != 'Pause'}
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I have two documents one in the SupRequest1 state and one in the Start state.&lt;/P&gt;
&lt;P&gt;The button associated with this user action is enabled in both documents. Expected result is: Button is missing from document in SupRequest1 state and present in document in Start state.&lt;/P&gt;
&lt;P&gt;Am I missing a logic error?&lt;/P&gt;
&lt;P&gt;Will the above expression be completely parsed by Nuxeo?&lt;/P&gt;
&lt;P&gt;BTW a compound boolean expression in another user action with only two clauses seems to work correctly!&lt;/P&gt;
&lt;P&gt;Also if I use parentheses, to enclose each clause,  in the expression the Nuxeo parser get very upset and cannot find the first &amp;amp;&amp;amp; (AND) operator.&lt;/P&gt;
&lt;P&gt;See Entry entitled: &lt;A href="http://answers.nuxeo.com/questions/2579/user-action-current-document-has-life-cycle-not"&gt;User Action: Current document has life cycle ......NOT!?&lt;/A&gt; as a reference.&lt;/P&gt;</description>
      <pubDate>Tue, 08 May 2012 18:23:24 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/can-a-user-action-custom-el-expression-handle-a-compound-boolean/m-p/317730#M4731</guid>
      <dc:creator>karl_harris_</dc:creator>
      <dc:date>2012-05-08T18:23:24Z</dc:date>
    </item>
    <item>
      <title>Re: Can a User Action, Custom EL expression handle a compound Boolean of more than two clauses?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/can-a-user-action-custom-el-expression-handle-a-compound-boolean/m-p/317731#M4732</link>
      <description>&lt;P&gt;In a user action, you do not have access to the layout context as it's unrelated. So layoutValue variable will always resolve to null here.&lt;/P&gt;
&lt;P&gt;You can however use EL expressions using "document" or "currentDocument" (this one since 5.5), other variables available in the context are "principal" or "currentUser" (this one also since 5.5).&lt;/P&gt;
&lt;P&gt;You can also call a custom method from a Seam component, but the Seam component has to be the first item of the expression to be resolved correctly, so something like &lt;CODE&gt;#{clipboardActions.canPasteFromClipboard}&lt;/CODE&gt; will work, but not something like &lt;CODE&gt;#{clipboardActions.canPasteFromClipboard and clipboardActions.canDoOtherStuff}&lt;/CODE&gt;.&lt;/P&gt;
&lt;P&gt;We do know that this can be confusing for users, hopefully we'll improve that in the future...&lt;/P&gt;</description>
      <pubDate>Thu, 10 May 2012 14:19:27 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/can-a-user-action-custom-el-expression-handle-a-compound-boolean/m-p/317731#M4732</guid>
      <dc:creator>Anahide_Tchertc</dc:creator>
      <dc:date>2012-05-10T14:19:27Z</dc:date>
    </item>
    <item>
      <title>Re: Can a User Action, Custom EL expression handle a compound Boolean of more than two clauses?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/can-a-user-action-custom-el-expression-handle-a-compound-boolean/m-p/317732#M4733</link>
      <description>&lt;P&gt;For my solution I have written a custom boolean Seam method which contains all the logic needed. The method returns a boolean so I can use a single EL expression eg.  #{mymethod}, this seems to work.&lt;/P&gt;</description>
      <pubDate>Thu, 10 May 2012 15:52:28 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/can-a-user-action-custom-el-expression-handle-a-compound-boolean/m-p/317732#M4733</guid>
      <dc:creator>karl_harris_</dc:creator>
      <dc:date>2012-05-10T15:52:28Z</dc:date>
    </item>
    <item>
      <title>Re: Can a User Action, Custom EL expression handle a compound Boolean of more than two clauses?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/can-a-user-action-custom-el-expression-handle-a-compound-boolean/m-p/317733#M4734</link>
      <description>&lt;P&gt;I followed your steps and created a seam controller bean with a method which returns a boolean. Now how do invoke this method from a custom EL.? Where do i register this seam bean?&lt;/P&gt;</description>
      <pubDate>Mon, 26 Nov 2012 21:15:19 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/can-a-user-action-custom-el-expression-handle-a-compound-boolean/m-p/317733#M4734</guid>
      <dc:creator>Ansel_Andrew</dc:creator>
      <dc:date>2012-11-26T21:15:19Z</dc:date>
    </item>
    <item>
      <title>Re: Can a User Action, Custom EL expression handle a compound Boolean of more than two clauses?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/can-a-user-action-custom-el-expression-handle-a-compound-boolean/m-p/317734#M4735</link>
      <description>&lt;P&gt;Here is an example:&lt;/P&gt;
&lt;P&gt;In the Nuxeo IDE I created a Seam Controller Bean named enables using class EnablesBean. The bean has many methods each returning a boolean after it tests what ever I need to test. Most of the code below is automatically generated by the IDE. A sample method is show below, make as many methods as you need for various enables. I changed the Scope to Event which helped with some issues I had, change Scope as required to make it work appropriately for your code..&lt;/P&gt;
&lt;P&gt;Start Code ***************************&lt;/P&gt;
&lt;P&gt;package org.nuxeo.zaxis.bes;&lt;/P&gt;
&lt;P&gt;import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.GregorianCalendar;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Factory;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.nuxeo.ecm.core.api.ClientException;
import org.nuxeo.ecm.core.api.CoreSession;
import org.nuxeo.ecm.core.api.DocumentModel;
import org.nuxeo.ecm.core.api.DocumentModelList;
import org.nuxeo.ecm.core.api.NuxeoPrincipal;
import org.nuxeo.ecm.core.api.model.PropertyException;
import org.nuxeo.ecm.platform.ui.web.invalidations.AutomaticDocumentBasedInvalidation;
import org.nuxeo.ecm.platform.ui.web.invalidations.DocumentContextBoundActionBean;
import org.nuxeo.ecm.webapp.documentsLists.DocumentsListsManager;&lt;/P&gt;
&lt;P&gt;/**&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Code skeleton for a Bean that is controlling&lt;/LI&gt;
&lt;LI&gt;a new Tab like action (a xhtml fragment)&lt;/LI&gt;
&lt;LI&gt;&lt;/LI&gt;
&lt;LI&gt;This can be used :&lt;/LI&gt;
&lt;LI&gt;
&lt;UL&gt;
&lt;LI&gt;to display additional informations about a document&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;UL&gt;
&lt;LI&gt;to provide a screen that allow to update the document&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;LI&gt;&lt;/LI&gt;
&lt;LI&gt;The bean is by default Conversation scoped&lt;/LI&gt;
&lt;LI&gt;so that :&lt;/LI&gt;
&lt;LI&gt;
&lt;UL&gt;
&lt;LI&gt;if you have expensive computation it will be run only when needed&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;LI&gt;
&lt;UL&gt;
&lt;LI&gt;you can manage view/update/view cycle&lt;/LI&gt;
&lt;/UL&gt;
&lt;/LI&gt;
&lt;LI&gt;&lt;/LI&gt;
&lt;LI&gt;All state should be managed as member variables of the beans.&lt;/LI&gt;
&lt;LI&gt;The default invalidation policy is to reset the state when&lt;/LI&gt;
&lt;LI&gt;the currentDocument changes.&lt;/LI&gt;
&lt;LI&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;*/&lt;/P&gt;
&lt;P&gt;//The Bean is registered here!
//This was automatically generated by the Nuxeo IDE&lt;/P&gt;
&lt;P&gt;@Name("enables")
@Scope(ScopeType.EVENT)
@AutomaticDocumentBasedInvalidation
public class EnablesBean extends DocumentContextBoundActionBean implements Serializable {&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;private static final long serialVersionUID = 1L;

private static final Log log = LogFactory.getLog(besEnablesBean.class);

public boolean sampleTest(){
	boolean result = false;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;// DO your check here and set result variable as required. You can
// make the check as simple or as complicated as you'd like.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE&gt;	return result;
}
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;P&gt;End Code*********************************&lt;/P&gt;
&lt;P&gt;Add a EL expression in the filter in the Action, Content View, etc, like below (I use Studio but I'm sure it will work in .XML):&lt;/P&gt;
&lt;P&gt;${enables.sampleTest()}&lt;/P&gt;
&lt;P&gt;That's about it.&lt;/P&gt;
&lt;P&gt;Karl&lt;/P&gt;</description>
      <pubDate>Mon, 26 Nov 2012 21:44:31 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/can-a-user-action-custom-el-expression-handle-a-compound-boolean/m-p/317734#M4735</guid>
      <dc:creator>karl_harris_</dc:creator>
      <dc:date>2012-11-26T21:44:31Z</dc:date>
    </item>
    <item>
      <title>Re: Can a User Action, Custom EL expression handle a compound Boolean of more than two clauses?</title>
      <link>https://connect.hyland.com/t5/nuxeo-forum/can-a-user-action-custom-el-expression-handle-a-compound-boolean/m-p/317735#M4736</link>
      <description>&lt;P&gt;Thanks a lot its working&lt;/P&gt;</description>
      <pubDate>Mon, 26 Nov 2012 22:06:13 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/nuxeo-forum/can-a-user-action-custom-el-expression-handle-a-compound-boolean/m-p/317735#M4736</guid>
      <dc:creator>Ansel_Andrew</dc:creator>
      <dc:date>2012-11-26T22:06:13Z</dc:date>
    </item>
  </channel>
</rss>

