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

org.vertexium.query.ExtendedDataQueryableIterable Maven / Gradle / Ivy

There is a newer version: 4.10.0
Show newest version
package org.vertexium.query;

import org.vertexium.*;

import java.util.Iterator;

public class ExtendedDataQueryableIterable implements QueryableIterable {
    private final Graph graph;
    private final Element element;
    private final String tableName;
    private final Iterable rows;

    public ExtendedDataQueryableIterable(Graph graph, Element element, String tableName, Iterable rows) {
        this.graph = graph;
        this.element = element;
        this.tableName = tableName;
        this.rows = rows;
    }

    public Graph getGraph() {
        return graph;
    }

    public Element getElement() {
        return element;
    }

    public String getTableName() {
        return tableName;
    }

    @Override
    public Query query(Authorizations authorizations) {
        return query(null, authorizations);
    }

    @Override
    public Query query(String queryString, Authorizations authorizations) {
        if (getGraph() instanceof GraphWithSearchIndex) {
            GraphWithSearchIndex graphWithSearchIndex = (GraphWithSearchIndex) getGraph();
            return graphWithSearchIndex.getSearchIndex().queryExtendedData(
                getGraph(),
                getElement(),
                getTableName(),
                queryString,
                authorizations
            );
        }
        return new DefaultExtendedDataQuery(getGraph(), getElement(), getTableName(), queryString, authorizations);
    }

    @SuppressWarnings("unchecked")
    @Override
    public Iterator iterator() {
        return (Iterator) rows.iterator();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy