Search in sources :

Example 21 with StreamingPropertyValue

use of org.vertexium.property.StreamingPropertyValue in project vertexium by visallo.

the class Elasticsearch5SearchIndex method addPropertyToIndexInner.

private void addPropertyToIndexInner(Graph graph, IndexInfo indexInfo, String propertyName, Object propertyValue, Visibility propertyVisibility) throws IOException {
    String propertyNameWithVisibility = addVisibilityToPropertyName(graph, propertyName, propertyVisibility);
    if (indexInfo.isPropertyDefined(propertyNameWithVisibility, propertyVisibility)) {
        return;
    }
    Class dataType;
    if (propertyValue instanceof StreamingPropertyValue) {
        StreamingPropertyValue streamingPropertyValue = (StreamingPropertyValue) propertyValue;
        if (!streamingPropertyValue.isSearchIndex()) {
            return;
        }
        dataType = streamingPropertyValue.getValueType();
        addPropertyToIndex(graph, indexInfo, propertyNameWithVisibility, propertyVisibility, dataType, true, false, false);
    } else if (propertyValue instanceof String) {
        dataType = String.class;
        addPropertyToIndex(graph, indexInfo, propertyNameWithVisibility, propertyVisibility, dataType, true, true, false);
    } else if (propertyValue instanceof GeoShape) {
        addPropertyToIndex(graph, indexInfo, propertyNameWithVisibility + GEO_PROPERTY_NAME_SUFFIX, propertyVisibility, propertyValue.getClass(), true, false, false);
        addPropertyToIndex(graph, indexInfo, propertyNameWithVisibility, propertyVisibility, String.class, true, true, false);
        if (propertyValue instanceof GeoPoint) {
            addPropertyToIndex(graph, indexInfo, propertyNameWithVisibility + GEO_POINT_PROPERTY_NAME_SUFFIX, propertyVisibility, propertyValue.getClass(), true, true, false);
        }
    } else {
        checkNotNull(propertyValue, "property value cannot be null for property: " + propertyNameWithVisibility);
        dataType = propertyValue.getClass();
        addPropertyToIndex(graph, indexInfo, propertyNameWithVisibility, propertyVisibility, dataType, true, false, false);
    }
}
Also used : StreamingPropertyValue(org.vertexium.property.StreamingPropertyValue)

Example 22 with StreamingPropertyValue

use of org.vertexium.property.StreamingPropertyValue in project vertexium by visallo.

the class InMemoryGraph method alterElementPropertyVisibilities.

protected void alterElementPropertyVisibilities(InMemoryTableElement inMemoryTableElement, List<AlterPropertyVisibility> alterPropertyVisibilities, Authorizations authorizations) {
    for (AlterPropertyVisibility apv : alterPropertyVisibilities) {
        Property property = inMemoryTableElement.getProperty(apv.getKey(), apv.getName(), apv.getExistingVisibility(), FetchHints.ALL_INCLUDING_HIDDEN, authorizations);
        if (property == null) {
            throw new VertexiumException("Could not find property " + apv.getKey() + ":" + apv.getName());
        }
        if (apv.getExistingVisibility() == null) {
            apv.setExistingVisibility(property.getVisibility());
        }
        Object value = property.getValue();
        Metadata metadata = property.getMetadata();
        inMemoryTableElement.appendSoftDeletePropertyMutation(apv.getKey(), apv.getName(), apv.getExistingVisibility(), apv.getTimestamp());
        long newTimestamp = apv.getTimestamp() + 1;
        if (value instanceof StreamingPropertyValue) {
            value = saveStreamingPropertyValue(inMemoryTableElement.getId(), apv.getKey(), apv.getName(), apv.getVisibility(), newTimestamp, (StreamingPropertyValue) value);
        }
        inMemoryTableElement.appendAddPropertyValueMutation(apv.getKey(), apv.getName(), value, metadata, apv.getVisibility(), newTimestamp);
    }
}
Also used : AlterPropertyVisibility(org.vertexium.mutation.AlterPropertyVisibility) StreamingPropertyValue(org.vertexium.property.StreamingPropertyValue) SetPropertyMetadata(org.vertexium.mutation.SetPropertyMetadata)

Aggregations

StreamingPropertyValue (org.vertexium.property.StreamingPropertyValue)22 LargeStringInputStream (org.vertexium.test.util.LargeStringInputStream)8 ByteArrayInputStream (java.io.ByteArrayInputStream)7 InputStream (java.io.InputStream)6 PropertyValue (org.vertexium.property.PropertyValue)6 Test (org.junit.Test)4 IndexHint (org.vertexium.search.IndexHint)4 Mutation (org.apache.accumulo.core.data.Mutation)3 Value (org.apache.accumulo.core.data.Value)3 DataTableRowKey (org.vertexium.accumulo.keys.DataTableRowKey)3 Text (org.apache.hadoop.io.Text)2 JSONObject (org.json.JSONObject)2 DeleteHistoricalLegacyStreamingPropertyValueData (org.vertexium.accumulo.tools.DeleteHistoricalLegacyStreamingPropertyValueData)2 VertexiumException (org.vertexium.VertexiumException)1 StreamingPropertyValueTableDataRef (org.vertexium.accumulo.StreamingPropertyValueTableDataRef)1 InMemoryGraph (org.vertexium.inmemory.InMemoryGraph)1 AlterPropertyVisibility (org.vertexium.mutation.AlterPropertyVisibility)1 ExtendedDataMutation (org.vertexium.mutation.ExtendedDataMutation)1 SetPropertyMetadata (org.vertexium.mutation.SetPropertyMetadata)1 MutablePropertyImpl (org.vertexium.property.MutablePropertyImpl)1