private static byte[] getThumbnailBytes(Vertex vertex, ArtifactThumbnailRepository artifactThumbnailRepository, User user, AnalystsNotebookExportConfiguration analystsNotebookExportConfiguration) {
int[] dimensions = new int[]{analystsNotebookExportConfiguration.getThumbnailWidth(), analystsNotebookExportConfiguration.getThumbnailHeight()};
String type = "raw";
ArtifactThumbnail thumbnail = artifactThumbnailRepository.getThumbnail(vertex.getId(), type, dimensions[0], dimensions[1], user);
if (thumbnail == null) {
StreamingPropertyValue rawPropertyValue = LumifyProperties.RAW.getPropertyValue(vertex);
if (rawPropertyValue == null) {
return null;
}
InputStream in = rawPropertyValue.getInputStream();
try {
thumbnail = artifactThumbnailRepository.createThumbnail(vertex, type, in, dimensions, user);
} catch (IOException e) {
throw new LumifyException("error creating thumbnail", e);
}
}
return thumbnail.getThumbnailData();
}