@Test public void testApplies() throws IOException { log.info("testApplies"); assertTrue(provider.applies(pptxFile)); assertTrue(provider.applies(pptFile)); assertFalse(provider.applies(docxFile)); }
@Override public boolean applies(Resource resource) { return (CMSConstants.NT_FILE.equals(resource.getResourceType()) || JcrConstants.NT_FILE.equals(resource.getResourceType())) && Optional.ofNullable(resource.adaptTo(File.class)).map(f -> { MediaType mt = MediaType.parse(f.getContentType()); return mt.is(MediaType.MICROSOFT_POWERPOINT) || mt.is(MediaType.OOXML_PRESENTATION); }).orElse(false); }
SlideShowThumbnailProvider implements ThumbnailProvider { @Override public boolean applies(Resource resource) { return (CMSConstants.NT_FILE.equals(resource.getResourceType()) || JcrConstants.NT_FILE.equals(resource.getResourceType())) && Optional.ofNullable(resource.adaptTo(File.class)).map(f -> { MediaType mt = MediaType.parse(f.getContentType()); return mt.is(MediaType.MICROSOFT_POWERPOINT) || mt.is(MediaType.OOXML_PRESENTATION); }).orElse(false); } }
SlideShowThumbnailProvider implements ThumbnailProvider { @Override public boolean applies(Resource resource) { return (CMSConstants.NT_FILE.equals(resource.getResourceType()) || JcrConstants.NT_FILE.equals(resource.getResourceType())) && Optional.ofNullable(resource.adaptTo(File.class)).map(f -> { MediaType mt = MediaType.parse(f.getContentType()); return mt.is(MediaType.MICROSOFT_POWERPOINT) || mt.is(MediaType.OOXML_PRESENTATION); }).orElse(false); }  }
SlideShowThumbnailProvider implements ThumbnailProvider { @Override public boolean applies(Resource resource) { return (CMSConstants.NT_FILE.equals(resource.getResourceType()) || JcrConstants.NT_FILE.equals(resource.getResourceType())) && Optional.ofNullable(resource.adaptTo(File.class)).map(f -> { MediaType mt = MediaType.parse(f.getContentType()); return mt.is(MediaType.MICROSOFT_POWERPOINT) || mt.is(MediaType.OOXML_PRESENTATION); }).orElse(false); }  @Override boolean applies(Resource resource); @Override InputStream getThumbnail(Resource resource); }
SlideShowThumbnailProvider implements ThumbnailProvider { @Override public boolean applies(Resource resource) { return (CMSConstants.NT_FILE.equals(resource.getResourceType()) || JcrConstants.NT_FILE.equals(resource.getResourceType())) && Optional.ofNullable(resource.adaptTo(File.class)).map(f -> { MediaType mt = MediaType.parse(f.getContentType()); return mt.is(MediaType.MICROSOFT_POWERPOINT) || mt.is(MediaType.OOXML_PRESENTATION); }).orElse(false); }  @Override boolean applies(Resource resource); @Override InputStream getThumbnail(Resource resource);  }