social-service/src/main/java/org/gcube/social_networking/rest/HelloWorld.java

95 lines
2.9 KiB
Java

package org.gcube.social_networking.rest;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
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.Response;
import com.webcohesion.enunciate.metadata.rs.RequestHeader;
import com.webcohesion.enunciate.metadata.rs.RequestHeaders;
import com.webcohesion.enunciate.metadata.rs.ResourceGroup;
import com.webcohesion.enunciate.metadata.rs.ResourceLabel;
import com.webcohesion.enunciate.metadata.rs.ResponseCode;
import com.webcohesion.enunciate.metadata.rs.StatusCodes;
import org.gcube.social_networking.server.CassandraConnection;
import org.gcube.social_networking.socialnetworking.model.shared.Comment;
import org.gcube.social_networking.socialnetworking.model.shared.exceptions.CommentIDNotFoundException;
@Path("comments")
@ResourceGroup("Comments APIs")
@ResourceLabel("Comments APIs")
@RequestHeaders ({
@RequestHeader( name = "Authorization", description = "Bearer token, see <a href=\"https://dev.d4science.org/how-to-access-resources\">https://dev.d4science.org/how-to-access-resources</a>")
})
public class HelloWorld {
@POST
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
@Consumes({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void addComment(Comment comment) {
}
@GET
@Path("/{id}")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void readComment(@PathParam("id") String id) {
}
@PUT
@Path("/{id}")
@Consumes({"application/json;charset=UTF-8", "application/vnd.api+json"})
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void editComment(@PathParam("id") String id, Comment comment) {
}
@DELETE
@Path("/{id}")
@Produces({"application/json;charset=UTF-8", "application/vnd.api+json"})
public void deleteComment(@PathParam("id") String id) {
}
@POST
@Produces("application/json;charset=UTF-8")
@Consumes("application/json;charset=UTF-8")
public String create(String json) {
//Greeting g = new Greeting();
//return g.create(json);
return "{\"text\":\"hi\"}";
}
@PUT
@Path("/{greeting_name}")
@Consumes("application/json;charset=UTF-8")
@Produces("application/json;charset=UTF-8")
@StatusCodes ({
@ResponseCode ( code = 200, condition = "The greeting has been updated successfully.")
})
// @AuthorizationControl(allowedRoles={"boss"}, exception=NotAuthorizedException.class)
public String update(@PathParam("greeting_name") String name, String json) {
return "{}";
}
@DELETE
@Path("/{greeting_name}")
@StatusCodes ({
@ResponseCode ( code = 204, condition = "The item has been deleted successfully."),
@ResponseCode ( code = 404, condition = "The item was not found.")
})
public String delete(@PathParam("greeting_name") String name) {
return "{}";
}
}