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

Provide generic reference resolution operation for select2 when using idProperty

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Won't Fix
    • Affects Version/s: 5.9.2
    • Fix Version/s: 5.9.4

      Description

      When one wants to store a document field other than the document uid in a custom select2 via the 'idProperty' widget property, he'll also need to specify a custom operation to resolve this reference during the init phase of the select2 via the 'initOperationId'.

      This is a pain and this represents too much developments to achieve a simple requirement.

      We should be able to provide a generic operation that will be passed to the 'initOperationId' widget property whenever the 'idProperty' is specified.

      The operation will be like:

      @Operation(id = S2GenericInitOperation.ID, category = Constants.CAT_UI, label = "xxx", description = "yyy")
      public class S2GenericInitOperation {
          public static final String ID = "S2GenericInitOperationID";
      
          @Context
          protected CoreSession session;
      
          @Param(name = "value", required = true)
          protected String value;
      
          @Param(name = "xpath", required = true)
          protected String xpath;
      
          @OperationMethod
          public DocumentModel run(DocumentModel doc) throws ClientException {
              Object[] paramaters = new Object[1];
              paramaters[0] = value;
              DocumentModelList l = session.query(NXQLQueryBuilder.getQuery(
                      "SELECT * FROM Document WHERE " + xpath + " = ?", paramaters,
                      true, false));
              if (l.size() == 1) {
                  return l.get(0);
              } else if (l.isEmpty()) {
                  return null;
              } else {
                  throw new ClientException("More than one result!");
              }
          }
      
      }
      

        Attachments

          Activity

            People

            • Assignee:
              grenard Guillaume Renard
              Reporter:
              grenard Guillaume Renard
              Participants:
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                PagerDuty

                Error rendering 'com.pagerduty.jira-server-plugin:PagerDuty'. Please contact your Jira administrators.