@Override public boolean exists(BinaryGraphField field) { String uuid = field.getBinary().getUuid(); return new File(getFilePath(uuid)).exists(); }
/** * Increment any found postfix number in the filename. * * e.g: * <ul> * <li>test.txt -> test_1.txt</li> * <li>test -> test_1</li> * <li>test.blub.txt -> test.blub_1.txt</li> * <ul> * */ default void postfixFileName() { String oldName = getFileName(); if (oldName != null && !oldName.isEmpty()) { setFileName(UniquenessUtil.suggestNewName(oldName)); } }
/** * Clear the metadata properties. */ default void clearMetadata() { setLocationAltitude(null); setLocationLongitude(null); setLocationLatitude(null); // Remove all other metadata properties getPropertyKeys().stream() .filter(e -> e.startsWith(META_DATA_PROPERTY_PREFIX)) .forEach(e -> { setMetadata(e.substring(META_DATA_PROPERTY_PREFIX.length()), null); }); }
JsonObject binaryFieldInfo = new JsonObject(); fieldsMap.put(name, binaryFieldInfo); binaryFieldInfo.put("filename", binaryField.getFileName()); binaryFieldInfo.put("mimeType", binaryField.getMimeType()); binaryFieldInfo.put("dominantColor", binaryField.getImageDominantColor()); Binary binary = binaryField.getBinary(); if (binary != null) { binaryFieldInfo.put("filesize", binary.getSize()); if (searchProvider.hasIngestPipelinePlugin() && binaryField.isIngestableDocument()) { binaryFieldInfo.put("data", binary.getBase64ContentSync()); BinaryMetadata metadata = binaryField.getMetadata(); if (metadata != null) { JsonObject binaryFieldMetadataInfo = new JsonObject();
Binary binary = field.getBinary(); return binary == null ? 0 : binary.getUuid(); })); Binary binary = field.getBinary(); return binary == null ? 0 : binary.getImageWidth(); })); Binary binary = field.getBinary(); return binary == null ? 0 : binary.getImageHeight(); })); newFieldDefinition().name("sha512sum").description("SHA512 checksum of the binary data.").type(GraphQLString).dataFetcher(fetcher -> { BinaryGraphField field = fetcher.getSource(); return field.getBinary().getSHA512Sum(); })); return field.getBinary().getSize(); })); newFieldDefinition().name("dominantColor").description("Computed image dominant color").type(GraphQLString).dataFetcher(fetcher -> { BinaryGraphField field = fetcher.getSource(); return field.getImageDominantColor(); })); newFieldDefinition().name("focalPoint").description("Focal point of the image.").type(createFocalPointType()).dataFetcher(fetcher -> { BinaryGraphField field = fetcher.getSource(); return field.getImageFocalPoint(); }));
@Override public boolean exists(BinaryGraphField field) { String id = field.getBinary().getSHA512Sum(); // NoSuchKeyException try { HeadObjectResponse headResponse = client.headObject(HeadObjectRequest.builder() .bucket(options.getBucketName()) .key(id) .build()).get(); } catch (InterruptedException | ExecutionException e) { // TODO Auto-generated catch block e.printStackTrace(); } return false; }