Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-30221

Implement equivalent of NXP-28918 for JSFActionContext - nx:arrayContains* methods

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Major
    • Resolution: Won't Do
    • Affects Version/s: 10.10-HF29
    • Fix Version/s: None
    • Component/s: Seam / JSF UI
    • Backlog priority:
      300

      Description

      Goal
      Ability to filter activation of a Tab based on the presence of a value in a multivalued metadata.
      E.g. target condition:

      <condition>#{nx:arrayContains(currentDocument.doc.users, currentUser)}</condition>

      Request
      The nx:arraycContains* methods should be accessible from more contexts than the original implementation of NXP-28918

      Setup and reproducer

      • create a Studio project depending on JSF
      • create a document type Doc with a schema doc and a multivalued users property
      • create the Create/View/Edit views enabling to initialize doc:users
      • create a Tab with activation:
        • permission Browse
        • type Doc
        • custom EL filter expression:
          #{nx:arrayContains(currentDocument.doc.users, currentUser)}
      • deploy the project on a 10.10-HF29+ instance
      • create 2 users test and test2
      • create a Doc typed document with doc;users containing test and Read permission for test and test2

      Expected result

      • log in as test => Goal is for the custom tab to appear
      • log in as test2 => Goal is for the custom tab not to appear

      Actual result: sample with filter from NXP-28918

      2021-03-02T11:55:40,789 ERROR [DefaultActionFilter] evaluation of condition #{nx:arrayContains(currentDocument.dc.subjects, "art/paint")} failed: returning false
      javax.el.ELException: Function 'nx:arrayContains' not found
              at org.jboss.el.lang.ExpressionBuilder.visit(ExpressionBuilder.java:216) ~[jboss-el-1.0_02.CR6.jar:1.0_02.CR6]
              at org.jboss.el.parser.SimpleNode.accept(SimpleNode.java:129) ~[jboss-el-1.0_02.CR6.jar:1.0_02.CR6]
              at org.jboss.el.lang.ExpressionBuilder.prepare(ExpressionBuilder.java:167) ~[jboss-el-1.0_02.CR6.jar:1.0_02.CR6]
              at org.jboss.el.lang.ExpressionBuilder.build(ExpressionBuilder.java:181) ~[jboss-el-1.0_02.CR6.jar:1.0_02.CR6]
              at org.jboss.el.lang.ExpressionBuilder.createValueExpression(ExpressionBuilder.java:235) ~[jboss-el-1.0_02.CR6.jar:1.0_02.CR6]
              at org.jboss.el.ExpressionFactoryImpl.createValueExpression(ExpressionFactoryImpl.java:68) ~[jboss-el-1.0_02.CR6.jar:1.0_02.CR6]
              at org.jboss.seam.el.SeamExpressionFactory.createValueExpression(SeamExpressionFactory.java:98) ~[jboss-seam-2.3.1.Final.NX03.jar:2.3.1.Final.NX03-SNAPSHOT]
              at org.nuxeo.ecm.platform.actions.jsf.JSFActionContext.evalExpression(JSFActionContext.java:94) ~[nuxeo-platform-actions-jsf-10.10-HF21.jar:?]
              at org.nuxeo.ecm.platform.actions.jsf.JSFActionContext.checkCondition(JSFActionContext.java:100) ~[nuxeo-platform-actions-jsf-10.10-HF21.jar:?]
              at org.nuxeo.ecm.platform.actions.DefaultActionFilter.checkConditions(DefaultActionFilter.java:289) [nuxeo-platform-actions-core-10.10.jar:?]
      

      Analysis
      A test with reproducer from NXP-28918 shows that ELActionContext is used while here JSFActionContext is used.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                pabgrall Patrick Abgrall
                Participants:
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: