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

org.vertexium.elasticsearch5.ElasticsearchEdge Maven / Gradle / Ivy

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

import org.vertexium.*;
import org.vertexium.mutation.ExistingEdgeMutation;

@SuppressWarnings("unchecked")
public class ElasticsearchEdge extends ElasticsearchElement implements Edge {
    private String label;
    private String inVertexId;
    private String outVertexId;

    public ElasticsearchEdge(
        Graph graph,
        String id,
        String label,
        String inVertexId,
        String outVertexId,
        FetchHints fetchHints,
        Authorizations authorizations
    ) {
        super(graph, id, fetchHints, authorizations);
        this.label = label;
        this.inVertexId = inVertexId;
        this.outVertexId = outVertexId;
    }

    @Override
    public String getLabel() {
        return label;
    }

    @Override
    public String getVertexId(Direction direction) {
        if (direction.equals(Direction.IN)) {
            return inVertexId;
        } else if (direction.equals(Direction.OUT)) {
            return outVertexId;
        }
        throw new VertexiumNotSupportedException(direction.name() + " is not supported");
    }

    @Override
    public Vertex getVertex(Direction direction, Authorizations authorizations) {
        throw new VertexiumNotSupportedException("getVertex is not supported");
    }

    @Override
    public Vertex getVertex(Direction direction, FetchHints fetchHints, Authorizations authorizations) {
        throw new VertexiumNotSupportedException("getVertex is not supported");
    }

    @Override
    public String getOtherVertexId(String myVertexId) {
        if (myVertexId.equals(inVertexId)) {
            return outVertexId;
        }
        return inVertexId;
    }

    @Override
    public Vertex getOtherVertex(String myVertexId, Authorizations authorizations) {
        throw new VertexiumNotSupportedException("getOtherVertex is not supported");
    }

    @Override
    public Vertex getOtherVertex(String myVertexId, FetchHints fetchHints, Authorizations authorizations) {
        throw new VertexiumNotSupportedException("getOtherVertex is not supported");
    }

    @Override
    public EdgeVertices getVertices(Authorizations authorizations) {
        throw new VertexiumNotSupportedException("getVertices is not supported");
    }

    @Override
    public EdgeVertices getVertices(FetchHints fetchHints, Authorizations authorizations) {
        throw new VertexiumNotSupportedException("getVertices is not supported");
    }

    @Override
    public ExistingEdgeMutation prepareMutation() {
        throw new VertexiumNotSupportedException("prepareMutation is not supported");
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy