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);
}
}
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);
}
}
Aggregations