All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.vertexium.sql.SqlStreamingPropertyValueRef Maven / Gradle / Ivy

There is a newer version: 3.2.3
Show newest version
package org.vertexium.sql;

import org.vertexium.Visibility;
import org.vertexium.property.StreamingPropertyValue;
import org.vertexium.property.StreamingPropertyValueRef;
import org.vertexium.util.VertexiumLogger;
import org.vertexium.util.VertexiumLoggerFactory;

class SqlStreamingPropertyValueRef extends StreamingPropertyValueRef {
    private static final VertexiumLogger LOGGER = VertexiumLoggerFactory.getLogger(SqlStreamingPropertyValueRef.class);
    private final String elementId;
    private final String key;
    private final String name;
    private final Visibility visibility;
    private final long timestamp;

    public SqlStreamingPropertyValueRef(
            StreamingPropertyValue propertyValue,
            String elementId,
            String key,
            String name,
            Visibility visibility,
            long timestamp
    ) {
        super(propertyValue);
        this.elementId = elementId;
        this.key = key;
        this.name = name;
        this.visibility = visibility;
        this.timestamp = timestamp;
    }

    @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());
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy