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

org.visallo.web.routes.edge.EdgeExists Maven / Gradle / Ivy

There is a newer version: 2.2.0
Show newest version
package org.visallo.web.routes.edge;

import com.google.inject.Inject;
import com.v5analytics.webster.ParameterizedHandler;
import com.v5analytics.webster.annotations.Handle;
import com.v5analytics.webster.annotations.Required;
import org.vertexium.Authorizations;
import org.vertexium.Graph;
import org.visallo.web.clientapi.model.ClientApiEdgesExistsResponse;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

public class EdgeExists implements ParameterizedHandler {
    private final Graph graph;

    @Inject
    public EdgeExists(final Graph graph) {
        this.graph = graph;
    }

    @Handle
    public ClientApiEdgesExistsResponse handle(
            @Required(name = "edgeIds[]") String[] edgeIdsParameter,
            Authorizations authorizations
    ) throws Exception {
        List edgeIds = Arrays.asList(edgeIdsParameter);
        Map graphEdges = graph.doEdgesExist(edgeIds, authorizations);
        ClientApiEdgesExistsResponse result = new ClientApiEdgesExistsResponse();
        result.getExists().putAll(graphEdges);
        return result;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy