-
Type: Improvement
-
Status: Open
-
Priority: Minor
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: QualifiedToSchedule
-
Component/s: Nuxeo Connector
-
Tags:
-
Team:PLATFORM
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())); } }