diff --git a/src/main/java/org/ntlab/amaryllis/server/resources/CommentsRest.java b/src/main/java/org/ntlab/amaryllis/server/resources/CommentsRest.java new file mode 100644 index 0000000..a21bc5d --- /dev/null +++ b/src/main/java/org/ntlab/amaryllis/server/resources/CommentsRest.java @@ -0,0 +1,4 @@ +package org.ntlab.amaryllis.server.resources; + +public class CommentsRest { +} diff --git a/src/main/java/org/ntlab/amaryllis/server/resources/VoicememosRest.java b/src/main/java/org/ntlab/amaryllis/server/resources/VoicememosRest.java index dd496e2..5a443e9 100644 --- a/src/main/java/org/ntlab/amaryllis/server/resources/VoicememosRest.java +++ b/src/main/java/org/ntlab/amaryllis/server/resources/VoicememosRest.java @@ -214,50 +214,53 @@ throw new WebApplicationException(400); } - @Path("/{vid}/comments") - @POST - @Produces(MediaType.APPLICATION_JSON) - public void addComment(@PathParam("vid") String vid, @FormParam("token") String client_token, @FormParam("uid") String uid, @FormParam("comment") String comment){ - if (vid == null || client_token == null || uid == null) { - throw new WebApplicationException(400); - } - Account account = accounts.getAccount(uid); - if(account == null){ - throw new WebApplicationException(400); - } - String server_token = account.getToken(); - if (client_token.equals(server_token)) { - Voicememo v = voicememos.getVoicememo(vid); - if(v == null){ - throw new WebApplicationException(400); - } - v.createComment(uid, comment); - return; - } - throw new WebApplicationException(400); - } - @Path("/{vid}/comments/{commentNo}") - @DELETE - @Produces(MediaType.APPLICATION_JSON) - public void deleteComment(@PathParam("vid") String vid, @FormParam("token") String client_token, @FormParam("uid") String uid, @PathParam("commentNo") String commentNo){ - if (vid == null || client_token == null || uid == null || commentNo == null) { - throw new WebApplicationException(400); - } - Account account = accounts.getAccount(uid); - if(account == null){ - throw new WebApplicationException(400); - } - String server_token = account.getToken(); - if (client_token.equals(server_token)) { - Voicememo v = voicememos.getVoicememo(vid); - if(v == null){ - throw new WebApplicationException(400); - } - v.removeComment(commentNo); - return; - } - throw new WebApplicationException(400); - } +// 以下CommentsRestで実装します。(担当:宮﨑) +// +// @Path("/{vid}/comments") +// @POST +// @Produces(MediaType.APPLICATION_JSON) +// public void addComment(@PathParam("vid") String vid, @FormParam("token") String client_token, @FormParam("uid") String uid, @FormParam("comment") String comment){ +// if (vid == null || client_token == null || uid == null) { +// throw new WebApplicationException(400); +// } +// Account account = accounts.getAccount(uid); +// if(account == null){ +// throw new WebApplicationException(400); +// } +// String server_token = account.getToken(); +// if (client_token.equals(server_token)) { +// Voicememo v = voicememos.getVoicememo(vid); +// if(v == null){ +// throw new WebApplicationException(400); +// } +// v.createComment(uid, comment); +// return; +// } +// throw new WebApplicationException(400); +// } +// +// @Path("/{vid}/comments/{commentNo}") +// @DELETE +// @Produces(MediaType.APPLICATION_JSON) +// public void deleteComment(@PathParam("vid") String vid, @FormParam("token") String client_token, @FormParam("uid") String uid, @PathParam("commentNo") String commentNo){ +// if (vid == null || client_token == null || uid == null || commentNo == null) { +// throw new WebApplicationException(400); +// } +// Account account = accounts.getAccount(uid); +// if(account == null){ +// throw new WebApplicationException(400); +// } +// String server_token = account.getToken(); +// if (client_token.equals(server_token)) { +// Voicememo v = voicememos.getVoicememo(vid); +// if(v == null){ +// throw new WebApplicationException(400); +// } +// v.removeComment(commentNo); +// return; +// } +// throw new WebApplicationException(400); +// } }