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

org.vertexium.cli.model.LazyVertexMap Maven / Gradle / Ivy

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

import org.vertexium.FetchHints;
import org.vertexium.Vertex;

import java.util.ArrayList;
import java.util.List;

public class LazyVertexMap extends ModelBase {
    public Object get(String vertexId) {
        if (vertexId.endsWith("*")) {
            String vertexIdPrefix = vertexId.substring(0, vertexId.length() - 1);
            Iterable vertices = getGraph().getVerticesWithPrefix(vertexIdPrefix, getGraph().getDefaultFetchHints(), getTime(), getAuthorizations());
            List results = new ArrayList<>();
            for (Vertex v : vertices) {
                results.add(v.getId());
            }
            return new LazyVertexList(results);
        } else {
            Vertex v = getGraph().getVertex(vertexId, getGraph().getDefaultFetchHints(), getTime(), getAuthorizations());
            if (v == null) {
                return null;
            }
            return new LazyVertex(vertexId);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy