/** * Tests historical {@link org.vertexium.property.PropertyValue} objects which used to have a "store: boolean" field */ @Test public void testPropertyValue() { PropertyValue propertyValue = new PropertyValue().searchIndex(true); testValue( propertyValue, getPropertyValueBytes(), (givenValue, deserializedValue) -> { assertNotNull(deserializedValue); assertTrue(deserializedValue.isSearchIndex()); } ); }
private byte[] createAndSaveCachedImage(Vertex vertex, String propertyKey, String url, int maxWidth, int maxHeight, int jpegQuality, Authorizations authorizations) throws IOException { byte[] imageData = getAndSaveImageData(vertex, url, authorizations); imageData = ImageUtils.resize(imageData, maxWidth, maxHeight, jpegQuality); StreamingPropertyValue value = new StreamingPropertyValue(new ByteArrayInputStream(imageData), byte[].class); value.store(true).searchIndex(false); ExistingElementMutation<Vertex> m = vertex.prepareMutation(); VisalloProperties.CACHED_IMAGE.addPropertyValue(m, propertyKey, value, vertex.getVisibility()); m.save(authorizations); return imageData; }
private byte[] getAndSaveImageData(Vertex vertex, String url, Authorizations authorizations) throws IOException { String propertyKey = getPropertyKey(url, null, null, null); StreamingPropertyValue originalImage = VisalloProperties.CACHED_IMAGE.getPropertyValue(vertex, propertyKey); if (originalImage != null) { return IOUtils.toByteArray(originalImage.getInputStream()); } byte[] imageData = httpRepository.get(url); StreamingPropertyValue value = new StreamingPropertyValue(new ByteArrayInputStream(imageData), byte[].class); value.store(true).searchIndex(false); ExistingElementMutation<Vertex> m = vertex.prepareMutation(); VisalloProperties.CACHED_IMAGE.addPropertyValue(m, propertyKey, value, vertex.getVisibility()); m.save(authorizations); return imageData; }
/** * Tests historical {@link org.vertexium.property.PropertyValue} objects which used to have a "store: boolean" field */ @Test public void testPropertyValue() { PropertyValue propertyValue = new PropertyValue().searchIndex(true); testValue( propertyValue, getPropertyValueBytes(), (givenValue, deserializedValue) -> { assertNotNull(deserializedValue); assertTrue(deserializedValue.isSearchIndex()); } ); }
@Override public StreamingPropertyValue toStreamingPropertyValue(SqlGraph graph, long timestamp) { StreamingPropertyValue spv = graph.getStreamingPropertyTable() .get(elementId, key, name, visibility, timestamp); if (spv == null) { LOGGER.warn("Could not find SQL SPV with the property timestamp %d, using ref timestamp instead", timestamp, this.timestamp); spv = graph.getStreamingPropertyTable() .get(elementId, key, name, visibility, this.timestamp); } return spv .store(isStore()) .searchIndex(isSearchIndex()); } }
} else { StreamingPropertyValue value = new StreamingPropertyValue(new ByteArrayInputStream(preview.getImageData()), byte[].class); value.store(true).searchIndex(false); Metadata metadata = new Metadata(); metadata.add("http://visallo.org/product#previewImageMD5", preview.getMD5(), visibility);