@Test public void testGetEditableBlob() throws IOException { DocumentModel doc = session.createDocumentModel("/", "wopiDoc", "File"); assertNull(Helpers.getEditableBlob(doc, FILE_CONTENT_PROPERTY)); Blob blob = Blobs.createBlob("dummy content"); doc.setPropertyValue(FILE_CONTENT_PROPERTY, (Serializable) blob); doc = session.createDocument(doc); assertNotNull(Helpers.getEditableBlob(doc, FILE_CONTENT_PROPERTY)); BlobProvider blobProvider = blobManager.getBlobProvider("dummy"); blobProvider.writeBlob(blob); BlobInfo blobInfo = new BlobInfo(); blobInfo.key = "dummy:1"; ManagedBlob externalBlob = (ManagedBlob) blobProvider.readBlob(blobInfo); assertNotNull(externalBlob); doc.setPropertyValue(FILE_CONTENT_PROPERTY, (Serializable) externalBlob); assertNull(Helpers.getEditableBlob(doc, FILE_CONTENT_PROPERTY)); }
public static Blob getEditableBlob(DocumentModel doc, String xpath) { Blob blob = null; try { blob = (Blob) doc.getPropertyValue(xpath); } catch (PropertyException e) { } if (blob == null) { log.debug("Blobs: repository={} docId={} xpath={} Cannot find blob", doc::getRepositoryName, doc::getId, () -> xpath); return null; } if (!supportsSync(blob)) { log.debug( "Blobs: repository={} docId={} xpath={} Ignoring blob as it is backed by a BlobProvider preventing sync", doc::getRepositoryName, doc::getId, () -> xpath); return null; } return blob; }
Helpers { public static Blob getEditableBlob(DocumentModel doc, String xpath) { Blob blob = null; try { blob = (Blob) doc.getPropertyValue(xpath); } catch (PropertyException e) { } if (blob == null) { log.debug("Blobs: repository={} docId={} xpath={} Cannot find blob", doc::getRepositoryName, doc::getId, () -> xpath); return null; } if (!supportsSync(blob)) { log.debug( "Blobs: repository={} docId={} xpath={} Ignoring blob as it is backed by a BlobProvider preventing sync", doc::getRepositoryName, doc::getId, () -> xpath); return null; } return blob; } }
Helpers { public static Blob getEditableBlob(DocumentModel doc, String xpath) { Blob blob = null; try { blob = (Blob) doc.getPropertyValue(xpath); } catch (PropertyException e) { } if (blob == null) { log.debug("Blobs: repository={} docId={} xpath={} Cannot find blob", doc::getRepositoryName, doc::getId, () -> xpath); return null; } if (!supportsSync(blob)) { log.debug( "Blobs: repository={} docId={} xpath={} Ignoring blob as it is backed by a BlobProvider preventing sync", doc::getRepositoryName, doc::getId, () -> xpath); return null; } return blob; } private  Helpers(); }
Helpers { public static Blob getEditableBlob(DocumentModel doc, String xpath) { Blob blob = null; try { blob = (Blob) doc.getPropertyValue(xpath); } catch (PropertyException e) { } if (blob == null) { log.debug("Blobs: repository={} docId={} xpath={} Cannot find blob", doc::getRepositoryName, doc::getId, () -> xpath); return null; } if (!supportsSync(blob)) { log.debug( "Blobs: repository={} docId={} xpath={} Ignoring blob as it is backed by a BlobProvider preventing sync", doc::getRepositoryName, doc::getId, () -> xpath); return null; } return blob; } private  Helpers(); static String readUTF7String(String s); static String createJWTToken(); static String getJWTToken(HttpServletRequest request); static long getJWTTokenExp(String token); static String principalFullName(NuxeoPrincipal principal); static Blob getEditableBlob(DocumentModel doc, String xpath); static String getWOPIURL(String baseURL, String action, DocumentModel doc, String xpath); static String getHeader(HttpHeaders httpHeaders, String headerName); }
Helpers { public static Blob getEditableBlob(DocumentModel doc, String xpath) { Blob blob = null; try { blob = (Blob) doc.getPropertyValue(xpath); } catch (PropertyException e) { } if (blob == null) { log.debug("Blobs: repository={} docId={} xpath={} Cannot find blob", doc::getRepositoryName, doc::getId, () -> xpath); return null; } if (!supportsSync(blob)) { log.debug( "Blobs: repository={} docId={} xpath={} Ignoring blob as it is backed by a BlobProvider preventing sync", doc::getRepositoryName, doc::getId, () -> xpath); return null; } return blob; } private  Helpers(); static String readUTF7String(String s); static String createJWTToken(); static String getJWTToken(HttpServletRequest request); static long getJWTTokenExp(String token); static String principalFullName(NuxeoPrincipal principal); static Blob getEditableBlob(DocumentModel doc, String xpath); static String getWOPIURL(String baseURL, String action, DocumentModel doc, String xpath); static String getHeader(HttpHeaders httpHeaders, String headerName); static final Charset UTF_7; }