com.qwazr.graph.GraphServiceInterface Maven / Gradle / Ivy
/**
* Copyright 2015-2017 Emmanuel Keller / QWAZR
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.qwazr.graph;
import com.qwazr.graph.model.GraphDefinition;
import com.qwazr.graph.model.GraphNode;
import com.qwazr.graph.model.GraphNodeResult;
import com.qwazr.graph.model.GraphRequest;
import com.qwazr.graph.model.GraphResult;
import com.qwazr.server.ServiceInterface;
import javax.annotation.security.RolesAllowed;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType;
import java.io.InputStream;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Set;
@RolesAllowed(GraphServiceInterface.SERVICE_NAME)
@Path("/" + GraphServiceInterface.SERVICE_NAME)
public interface GraphServiceInterface extends ServiceInterface {
String SERVICE_NAME = "graph";
@GET
@Path("/")
@Produces(ServiceInterface.APPLICATION_JSON_UTF8)
Set list();
@POST
@Path("/{graph_name}")
@Consumes(ServiceInterface.APPLICATION_JSON_UTF8)
@Produces(ServiceInterface.APPLICATION_JSON_UTF8)
GraphDefinition createUpdateGraph(@PathParam("graph_name") String graph_name, GraphDefinition graph_def);
@GET
@Path("/{graph_name}")
@Produces(ServiceInterface.APPLICATION_JSON_UTF8)
GraphResult getGraph(@PathParam("graph_name") String graph_name);
@DELETE
@Path("/{graph_name}")
@Produces(ServiceInterface.APPLICATION_JSON_UTF8)
GraphDefinition deleteGraph(@PathParam("graph_name") String graph_name);
@POST
@Path("/{graph_name}/node")
@Consumes(ServiceInterface.APPLICATION_JSON_UTF8)
@Produces(ServiceInterface.APPLICATION_JSON_UTF8)
Set createUpdateNodes(@PathParam("graph_name") String graph_name, LinkedHashMap nodes,
@QueryParam("upsert") Boolean upsert);
@POST
@Path("/{graph_name}/node")
@Consumes(MediaType.TEXT_PLAIN)
@Produces(ServiceInterface.APPLICATION_JSON_UTF8)
Long createUpdateNodes(@PathParam("graph_name") String graph_name, @QueryParam("upsert") Boolean upsert,
InputStream inpustStream);
@POST
@Path("/{graph_name}/node/{node_id}")
@Consumes(ServiceInterface.APPLICATION_JSON_UTF8)
@Produces(ServiceInterface.APPLICATION_JSON_UTF8)
GraphNode createUpdateNode(@PathParam("graph_name") String graph_name, @PathParam("node_id") String node_id,
GraphNode node, @QueryParam("upsert") Boolean upsert);
@GET
@Path("/{graph_name}/node/{node_id}")
@Produces(ServiceInterface.APPLICATION_JSON_UTF8)
GraphNode getNode(@PathParam("graph_name") String graph_name, @PathParam("node_id") String node_id);
@DELETE
@Path("/{graph_name}/node/{node_id}")
@Produces(ServiceInterface.APPLICATION_JSON_UTF8)
GraphNode deleteNode(@PathParam("graph_name") String graph_name, @PathParam("node_id") String node_id);
@POST
@Path("/{graph_name}/node/{node_id}/edge/{edge_type}/{to_node_id}")
@Produces(ServiceInterface.APPLICATION_JSON_UTF8)
GraphNode createEdge(@PathParam("graph_name") String graph_name, @PathParam("node_id") String node_id,
@PathParam("edge_type") String edge_type, @PathParam("to_node_id") String to_node_id);
@DELETE
@Path("/{graph_name}/node/{node_id}/edge/{edge_type}/{to_node_id}")
@Produces(ServiceInterface.APPLICATION_JSON_UTF8)
GraphNode deleteEdge(@PathParam("graph_name") String graph_name, @PathParam("node_id") String node_id,
@PathParam("edge_type") String edge_type, @PathParam("to_node_id") String to_node_id);
@POST
@Path("/{graph_name}/request")
@Consumes(ServiceInterface.APPLICATION_JSON_UTF8)
@Produces(ServiceInterface.APPLICATION_JSON_UTF8)
List requestNodes(@PathParam("graph_name") String graph_name, GraphRequest request);
}