@Test public void testGetAppLinksWithDocumentWithRevision() throws Exception { SimpleManagedBlob blob = createBlob("revisionId"); blob.setFilename("example.txt"); blob.setMimeType("text/plain"); List<AppLink> appLinks = blobProvider.getAppLinks(USERID, blob); assertNotNull(appLinks); assertTrue(appLinks.isEmpty()); blob = createBlob("revisionId"); blob.setFilename("example.docx"); blob.setMimeType("application/vnd.openxmlformats-officedocument.wordprocessingml.document"); appLinks = blobProvider.getAppLinks(USERID, blob); assertNotNull(appLinks); assertTrue(appLinks.isEmpty()); }
@Override public List<AppLink> getAppLinks(String username, ManagedBlob blob) throws IOException { if (!blob.getMimeType().contains("officedocument")) { return Collections.emptyList(); } LiveConnectFileInfo fileInfo = toFileInfo(blob); if (fileInfo.getRevisionId().isPresent()) { return Collections.emptyList(); } String baseUrl = Framework.getProperty("nuxeo.url", VirtualHostHelper.getContextPathProperty()); AppLink appLink = new AppLink(); String appUrl = prepareOneDriveFile(fileInfo).createSharedLink(Type.EDIT).getLink().getWebUrl(); appLink.setLink(appUrl); appLink.setAppName("Microsoft OneDrive"); appLink.setIcon(baseUrl + "/icons/OneDrive.png"); return Collections.singletonList(appLink); }
OneDriveBlobProvider extends AbstractLiveConnectBlobProvider<OneDriveOAuth2ServiceProvider> { @Override public List<AppLink> getAppLinks(String username, ManagedBlob blob) throws IOException { if (!blob.getMimeType().contains("officedocument")) { return Collections.emptyList(); } LiveConnectFileInfo fileInfo = toFileInfo(blob); if (fileInfo.getRevisionId().isPresent()) { return Collections.emptyList(); } String baseUrl = Framework.getProperty("nuxeo.url", VirtualHostHelper.getContextPathProperty()); AppLink appLink = new AppLink(); String appUrl = prepareOneDriveFile(fileInfo).createSharedLink(Type.EDIT).getLink().getWebUrl(); appLink.setLink(appUrl); appLink.setAppName("Microsoft OneDrive"); appLink.setIcon(baseUrl + "/icons/OneDrive.png"); return Collections.singletonList(appLink); } }
OneDriveBlobProvider extends AbstractLiveConnectBlobProvider<OneDriveOAuth2ServiceProvider> { @Override public List<AppLink> getAppLinks(String username, ManagedBlob blob) throws IOException { if (!blob.getMimeType().contains("officedocument")) { return Collections.emptyList(); } LiveConnectFileInfo fileInfo = toFileInfo(blob); if (fileInfo.getRevisionId().isPresent()) { return Collections.emptyList(); } String baseUrl = Framework.getProperty("nuxeo.url", VirtualHostHelper.getContextPathProperty()); AppLink appLink = new AppLink(); String appUrl = prepareOneDriveFile(fileInfo).createSharedLink(Type.EDIT).getLink().getWebUrl(); appLink.setLink(appUrl); appLink.setAppName("Microsoft OneDrive"); appLink.setIcon(baseUrl + "/icons/OneDrive.png"); return Collections.singletonList(appLink); }  }
OneDriveBlobProvider extends AbstractLiveConnectBlobProvider<OneDriveOAuth2ServiceProvider> { @Override public List<AppLink> getAppLinks(String username, ManagedBlob blob) throws IOException { if (!blob.getMimeType().contains("officedocument")) { return Collections.emptyList(); } LiveConnectFileInfo fileInfo = toFileInfo(blob); if (fileInfo.getRevisionId().isPresent()) { return Collections.emptyList(); } String baseUrl = Framework.getProperty("nuxeo.url", VirtualHostHelper.getContextPathProperty()); AppLink appLink = new AppLink(); String appUrl = prepareOneDriveFile(fileInfo).createSharedLink(Type.EDIT).getLink().getWebUrl(); appLink.setLink(appUrl); appLink.setAppName("Microsoft OneDrive"); appLink.setIcon(baseUrl + "/icons/OneDrive.png"); return Collections.singletonList(appLink); }  @Override URI getURI(ManagedBlob blob, UsageHint usage, HttpServletRequest servletRequest); @Override InputStream getStream(ManagedBlob blob); @Override InputStream getThumbnail(ManagedBlob blob); @Override List<AppLink> getAppLinks(String username, ManagedBlob blob); }
OneDriveBlobProvider extends AbstractLiveConnectBlobProvider<OneDriveOAuth2ServiceProvider> { @Override public List<AppLink> getAppLinks(String username, ManagedBlob blob) throws IOException { if (!blob.getMimeType().contains("officedocument")) { return Collections.emptyList(); } LiveConnectFileInfo fileInfo = toFileInfo(blob); if (fileInfo.getRevisionId().isPresent()) { return Collections.emptyList(); } String baseUrl = Framework.getProperty("nuxeo.url", VirtualHostHelper.getContextPathProperty()); AppLink appLink = new AppLink(); String appUrl = prepareOneDriveFile(fileInfo).createSharedLink(Type.EDIT).getLink().getWebUrl(); appLink.setLink(appUrl); appLink.setAppName("Microsoft OneDrive"); appLink.setIcon(baseUrl + "/icons/OneDrive.png"); return Collections.singletonList(appLink); }  @Override URI getURI(ManagedBlob blob, UsageHint usage, HttpServletRequest servletRequest); @Override InputStream getStream(ManagedBlob blob); @Override InputStream getThumbnail(ManagedBlob blob); @Override List<AppLink> getAppLinks(String username, ManagedBlob blob);  }