Uploaded image for project: 'Nuxeo Enhanced Viewer'
  1. Nuxeo Enhanced Viewer
  2. NEV-432

Create an Operation to open NEV on several blobs of the same document

    XMLWordPrintable

    Details

      Description

      We would like to create and integrate an operation in the nuxeo addon to be able to open the NEV Previewer on several blobs of the same documents.

      This operation will take the document as input and the several blob xpath as parameters (key: blobXPaths.

      The code below was proposed to PS team to benefit of this feature:

      @Operation(id = ARenderGetPreviewerUrlMultiBlob.ID, category = Constants.CAT_DOCUMENT, label = "Get ARender previewer url for multi blob", description = "Get the ARender previewer url depending on input.")
      public class ARenderGetPreviewerUrlMultiBlob {
      
          public static final String ID = "Document.ARenderGetPreviewerUrlMultiBlob";
      
          @Context
          public OperationContext ctx;
      
          @Context
          public CoreSession coreSession;
      
          @Context
          protected ARenderService aRenderService;
      
          @Param(name = "blobXPaths", required = false, values = "file:content")
          public StringList blobXPaths = new StringList(Collections.singletonList("file:content"));
      
          @OperationMethod
          public Blob run(DocumentRef docRef) throws IOException {
              DocumentModel docModel = coreSession.getDocument(docRef);
              return run(docModel);
          }
      
          @OperationMethod
          private Blob run(DocumentModel docModel) throws IOException {
              checkPermission(coreSession, docModel.getRef());
              return buildUrl(blobXPaths.stream().map(blobXPath -> {
                  Blob blob = aRenderService.getBlob(ctx, docModel, blobXPath);
                  // send requested xpath to match annotation api (otherwise user annotates chain result)
                  // send chain result digest as this is a discriminant for ARender Document services
                  return ARenderDocumentId.from(docModel.getRepositoryName(), docModel.getId(), blobXPath, blob.getDigest());
              }).collect(Collectors.toList()));
          }
      }
      

        Attachments

          Activity

            People

            • Assignee:
              kleturc Kevin Leturc
              Reporter:
              kleturc Kevin Leturc
              Participants:
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: