Uploaded image for project: 'Nuxeo Web UI'
  1. Nuxeo Web UI
  2. WEBUI-941

Fix JSON payload sent by saving/renaming a saved search

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Web UI

      Description

      Pre-requisites : create some documents where subjects and nature are set to some values. it's not mandatory but it helps to see that the search is working well

      Steps to reproduce:

      1. Deploy the attached jar to nxserver/plugins
      2. Start Nuxeo
      3. Log in
      4. Select the "Multival" search in the left menu
      5. Choose some values for the "Subjects" and "Nature" fields
      6. Click on the Search button
      7. Observe that some documents are retrieved
      8. Click on the button to save the search: give a name and save
      9. make some changes to the Subjects field and search
      10. Click on the button "Save"
      11. Observe that no toast is displayed. And in the logs there is an error like
        ERROR [WebEngineExceptionMapper] java.lang.ClassCastException: class org.nuxeo.ecm.core.schema.types.SimpleTypeImpl cannot be cast to class org.nuxeo.ecm.core.schema.types.ComplexType (org.nuxeo.ecm.core.schema.types.SimpleTypeImpl and org.nuxeo.ecm.core.schema.types.ComplexType are in unnamed module of loader org.nuxeo.runtime.tomcat.NuxeoWebappClassLoader @d1d8e1a)
        java.lang.ClassCastException: class org.nuxeo.ecm.core.schema.types.SimpleTypeImpl cannot be cast to class org.nuxeo.ecm.core.schema.types.ComplexType (org.nuxeo.ecm.core.schema.types.SimpleTypeImpl and org.nuxeo.ecm.core.schema.types.ComplexType are in unnamed module of loader org.nuxeo.runtime.tomcat.NuxeoWebappClassLoader @d1d8e1a)
        	at org.nuxeo.ecm.automation.core.util.ComplexTypeJSONDecoder.decodeList(ComplexTypeJSONDecoder.java:80) ~[nuxeo-automation-core-2021.18.6.jar:?]
        	at org.nuxeo.ecm.automation.core.util.ComplexTypeJSONDecoder.decodeList(ComplexTypeJSONDecoder.java:69) ~[nuxeo-automation-core-2021.18.6.jar:?]
        	at org.nuxeo.ecm.automation.core.util.DocumentHelper.setListProperty(DocumentHelper.java:377) ~[nuxeo-automation-core-2021.18.6.jar:?]
        	at org.nuxeo.ecm.automation.core.util.DocumentHelper.setProperty(DocumentHelper.java:328) ~[nuxeo-automation-core-2021.18.6.jar:?]
        	at org.nuxeo.ecm.automation.core.util.DocumentHelper.setProperty(DocumentHelper.java:308) ~[nuxeo-automation-core-2021.18.6.jar:?]
        	at org.nuxeo.ecm.restapi.server.jaxrs.search.SearchObject.setSaveSearchParams(SearchObject.java:273) ~[nuxeo-search-rest-api-2021.12.6.jar:?]
        	at org.nuxeo.ecm.restapi.server.jaxrs.search.SearchObject.doUpdateSavedSearch(SearchObject.java:238) ~[nuxeo-search-rest-api-2021.12.6.jar:?]
        

      The problem is related to the JSON payload sent to save the changes. The directory entity are sent with the JSON payload instead of sending only the values, which is done with the first save.

      We have a payload like

          "searchmultival_pp:dublincore_nature": [
            {
              "entity-type": "directoryEntry",
              "directoryName": "nature",
              "id": "article",
              "properties": {
                "ordering": 10000000,
                "obsolete": 0,
                "id": "article",
                "label": "Article"
              }
            },
            {
              "entity-type": "directoryEntry",
              "directoryName": "nature",
              "id": "acknowledgement",
              "properties": {
                "ordering": 10000000,
                "obsolete": 0,
                "id": "acknowledgement",
                "label": "Accusé de réception"
              }
            }
          ],
      

      whereas the first save has

      {
        "entity-type": "savedSearch",
        "pageProviderName": "searchmultival",
        "params": {
          "dublincore_subjects": [
            "art/architecture",
            "art/cinema"
          ],
          "dublincore_nature": [
            "acknowledgement",
            "article"
          ]
        },
        "title": "azaz"
      }
      

      Expected behavior: the search is correctly saved (or renamed)

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              tmartins Thierry Martins
              Participants:
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: