2019-04-05 16:39:46 +02:00
|
|
|
package org.gcube.portal.social.networking.ws.methods.v2;
|
|
|
|
|
|
|
|
|
2023-02-02 20:11:52 +01:00
|
|
|
import java.util.Date;
|
2019-04-05 16:39:46 +02:00
|
|
|
import java.util.List;
|
2023-02-02 20:11:52 +01:00
|
|
|
import java.util.UUID;
|
2019-04-05 16:39:46 +02:00
|
|
|
|
2023-02-02 20:11:52 +01:00
|
|
|
import javax.validation.Valid;
|
2019-04-05 16:39:46 +02:00
|
|
|
import javax.validation.ValidationException;
|
|
|
|
import javax.validation.constraints.Min;
|
2022-10-25 18:12:29 +02:00
|
|
|
import javax.validation.constraints.NotNull;
|
2023-02-02 20:11:52 +01:00
|
|
|
import javax.ws.rs.Consumes;
|
2019-04-05 16:39:46 +02:00
|
|
|
import javax.ws.rs.GET;
|
2023-02-02 20:11:52 +01:00
|
|
|
import javax.ws.rs.POST;
|
2019-04-05 16:39:46 +02:00
|
|
|
import javax.ws.rs.Path;
|
|
|
|
import javax.ws.rs.Produces;
|
|
|
|
import javax.ws.rs.QueryParam;
|
|
|
|
import javax.ws.rs.core.MediaType;
|
|
|
|
import javax.ws.rs.core.Response;
|
|
|
|
import javax.ws.rs.core.Response.Status;
|
|
|
|
|
|
|
|
import org.gcube.common.authorization.library.provider.AuthorizationProvider;
|
|
|
|
import org.gcube.common.authorization.library.utils.Caller;
|
|
|
|
import org.gcube.common.scope.api.ScopeProvider;
|
|
|
|
import org.gcube.portal.databook.shared.Comment;
|
2023-02-02 20:11:52 +01:00
|
|
|
import org.gcube.portal.databook.shared.Feed;
|
|
|
|
import org.gcube.portal.databook.shared.ex.FeedIDNotFoundException;
|
|
|
|
import org.gcube.portal.social.networking.liferay.ws.UserManagerWSBuilder;
|
|
|
|
import org.gcube.portal.social.networking.ws.inputs.CommentInputBean;
|
|
|
|
import org.gcube.portal.social.networking.ws.inputs.PostInputBean;
|
2019-04-05 16:39:46 +02:00
|
|
|
import org.gcube.portal.social.networking.ws.outputs.ResponseBean;
|
|
|
|
import org.gcube.portal.social.networking.ws.utils.CassandraConnection;
|
2020-12-01 18:10:15 +01:00
|
|
|
import org.gcube.portal.social.networking.ws.utils.ErrorMessages;
|
2019-04-05 16:39:46 +02:00
|
|
|
import org.gcube.portal.social.networking.ws.utils.Filters;
|
2023-02-02 20:11:52 +01:00
|
|
|
import org.gcube.portal.social.networking.ws.utils.SocialUtils;
|
|
|
|
import org.gcube.socialnetworking.socialtoken.SocialMessageParser;
|
|
|
|
import org.gcube.vomanagement.usermanagement.UserManager;
|
|
|
|
import org.gcube.vomanagement.usermanagement.model.GCubeUser;
|
2019-04-05 16:39:46 +02:00
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
|
2023-02-08 15:37:24 +01:00
|
|
|
import com.liferay.portlet.journal.FeedIdException;
|
2022-04-07 18:11:56 +02:00
|
|
|
import com.webcohesion.enunciate.metadata.rs.RequestHeader;
|
|
|
|
import com.webcohesion.enunciate.metadata.rs.RequestHeaders;
|
2022-04-07 16:25:26 +02:00
|
|
|
import com.webcohesion.enunciate.metadata.rs.ResponseCode;
|
|
|
|
import com.webcohesion.enunciate.metadata.rs.StatusCodes;
|
|
|
|
|
2019-04-05 16:39:46 +02:00
|
|
|
/**
|
|
|
|
* REST interface for the social networking library (comments).
|
2023-11-24 11:53:20 +01:00
|
|
|
* @author Ahmed Ibrahim ISTI-CNR
|
2019-04-05 16:39:46 +02:00
|
|
|
*/
|
|
|
|
@Path("2/comments")
|
2022-04-07 18:11:56 +02:00
|
|
|
@RequestHeaders ({
|
2023-11-22 19:52:25 +01:00
|
|
|
@RequestHeader( name = "Authorization", description = "Bearer token, see https://dev.d4science.org/how-to-access-resources"),
|
|
|
|
@RequestHeader( name = "Content-Type", description = "application/json")
|
2023-02-08 14:29:57 +01:00
|
|
|
})
|
2019-04-05 16:39:46 +02:00
|
|
|
public class Comments {
|
|
|
|
|
|
|
|
// Logger
|
|
|
|
private static final org.slf4j.Logger logger = LoggerFactory.getLogger(Comments.class);
|
2023-02-08 14:29:57 +01:00
|
|
|
|
2022-10-25 18:12:29 +02:00
|
|
|
/*
|
|
|
|
* Retrieve the list of comments belonging to the post id (key) of the token in the related context
|
2023-11-22 19:52:25 +01:00
|
|
|
* @param key the key as in the POST JSON representation
|
2022-10-25 18:38:20 +02:00
|
|
|
* @pathExample /get-comments-by-post-id?key=9ea137e9-6606-45ff-a1a2-94d4e8760583
|
2023-11-22 19:52:25 +01:00
|
|
|
* @return the list of comments belonging to the post identified by the key in the context identified by the token
|
2022-10-25 18:12:29 +02:00
|
|
|
*/
|
2019-04-05 16:39:46 +02:00
|
|
|
@GET
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
2022-10-25 18:12:29 +02:00
|
|
|
@Path("get-comments-by-post-id")
|
2022-04-07 16:25:26 +02:00
|
|
|
@StatusCodes ({
|
2023-11-22 19:52:25 +01:00
|
|
|
@ResponseCode ( code = 200, condition = "The list of comments is put into the 'result' field"),
|
|
|
|
@ResponseCode ( code = 500, condition = ErrorMessages.ERROR_IN_API_RESULT)
|
2022-04-07 16:25:26 +02:00
|
|
|
})
|
2022-10-25 18:12:29 +02:00
|
|
|
public Response getAllCommentsByPostId(
|
|
|
|
@NotNull
|
2023-11-22 19:52:25 +01:00
|
|
|
@QueryParam("key")
|
2022-10-25 18:12:29 +02:00
|
|
|
String key) {
|
|
|
|
|
|
|
|
ResponseBean responseBean = new ResponseBean();
|
|
|
|
Status status = Status.OK;
|
|
|
|
Caller caller = AuthorizationProvider.instance.get();
|
|
|
|
String context = ScopeProvider.instance.get();
|
|
|
|
String username = caller.getClient().getId();
|
|
|
|
List<Comment> comments = null;
|
|
|
|
|
|
|
|
try{
|
|
|
|
logger.info("Retrieving comments for user id " + username);
|
|
|
|
comments = CassandraConnection.getInstance().getDatabookStore().getAllCommentByPost(key);
|
|
|
|
Filters.filterCommentsPerContext(comments, context);
|
|
|
|
responseBean.setResult(comments);
|
|
|
|
responseBean.setSuccess(true);
|
|
|
|
}catch(Exception e){
|
|
|
|
logger.error("Unable to retrieve such comments.", e);
|
|
|
|
responseBean.setMessage(e.getMessage());
|
|
|
|
responseBean.setSuccess(false);
|
|
|
|
status = Status.INTERNAL_SERVER_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
return Response.status(status).entity(responseBean).build();
|
|
|
|
}
|
2022-04-07 16:25:26 +02:00
|
|
|
/*
|
2022-10-25 18:38:20 +02:00
|
|
|
* Retrieve the list of comments belonging to the owner of the token in the related context
|
|
|
|
* @return the list of comments belonging to the owner of the token in the related context.
|
2022-04-07 16:25:26 +02:00
|
|
|
*/
|
2022-10-25 18:12:29 +02:00
|
|
|
@GET
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
@Path("get-comments-user")
|
|
|
|
@StatusCodes ({
|
2023-11-22 19:52:25 +01:00
|
|
|
@ResponseCode ( code = 200, condition = "The list of comments is put into the 'result' field"),
|
|
|
|
@ResponseCode ( code = 500, condition = ErrorMessages.ERROR_IN_API_RESULT)
|
2022-10-25 18:12:29 +02:00
|
|
|
})
|
2019-04-05 16:39:46 +02:00
|
|
|
public Response getCommentsUser() {
|
|
|
|
|
|
|
|
ResponseBean responseBean = new ResponseBean();
|
|
|
|
Status status = Status.OK;
|
|
|
|
Caller caller = AuthorizationProvider.instance.get();
|
|
|
|
String context = ScopeProvider.instance.get();
|
|
|
|
String username = caller.getClient().getId();
|
|
|
|
List<Comment> comments = null;
|
|
|
|
|
|
|
|
try{
|
|
|
|
logger.info("Retrieving comments for user id " + username);
|
|
|
|
comments = CassandraConnection.getInstance().getDatabookStore().getRecentCommentsByUserAndDate(username, 0);
|
|
|
|
Filters.filterCommentsPerContext(comments, context);
|
|
|
|
responseBean.setResult(comments);
|
|
|
|
responseBean.setSuccess(true);
|
|
|
|
}catch(Exception e){
|
|
|
|
logger.error("Unable to retrieve such comments.", e);
|
|
|
|
responseBean.setMessage(e.getMessage());
|
|
|
|
responseBean.setSuccess(false);
|
|
|
|
status = Status.INTERNAL_SERVER_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
return Response.status(status).entity(responseBean).build();
|
|
|
|
}
|
|
|
|
|
2022-04-07 16:25:26 +02:00
|
|
|
/*
|
2023-02-09 12:47:01 +01:00
|
|
|
* Retrieve comments of the token owner in the context bound to the token itself and filter them by date
|
2022-04-07 16:25:26 +02:00
|
|
|
*/
|
2022-10-25 18:12:29 +02:00
|
|
|
@GET
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
@Path("get-comments-user-by-time")
|
2019-04-05 16:39:46 +02:00
|
|
|
public Response getCommentsUserByTime(
|
2023-11-22 19:52:25 +01:00
|
|
|
@QueryParam("time")
|
|
|
|
@Min(value = 0, message="time cannot be negative")
|
2019-04-05 16:39:46 +02:00
|
|
|
long timeInMillis
|
2023-11-22 19:52:25 +01:00
|
|
|
) throws ValidationException{
|
2019-04-05 16:39:46 +02:00
|
|
|
|
|
|
|
ResponseBean responseBean = new ResponseBean();
|
|
|
|
Status status = Status.OK;
|
|
|
|
Caller caller = AuthorizationProvider.instance.get();
|
|
|
|
String context = ScopeProvider.instance.get();
|
|
|
|
String username = caller.getClient().getId();
|
|
|
|
List<Comment> comments = null;
|
|
|
|
|
|
|
|
try{
|
|
|
|
logger.info("Retrieving comments for user id " + username);
|
|
|
|
comments = CassandraConnection.getInstance().getDatabookStore().getRecentCommentsByUserAndDate(username, timeInMillis);
|
|
|
|
Filters.filterCommentsPerContext(comments, context);
|
|
|
|
responseBean.setResult(comments);
|
|
|
|
responseBean.setMessage("");
|
|
|
|
responseBean.setSuccess(true);
|
|
|
|
}catch(Exception e){
|
|
|
|
logger.error("Unable to retrieve such comments.", e);
|
|
|
|
responseBean.setMessage(e.getMessage());
|
|
|
|
responseBean.setSuccess(false);
|
|
|
|
status = Status.INTERNAL_SERVER_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
return Response.status(status).entity(responseBean).build();
|
|
|
|
}
|
2023-02-07 11:42:49 +01:00
|
|
|
/**
|
|
|
|
* Create a new comment to a post having as owner the auth token's owner
|
2023-02-09 12:47:01 +01:00
|
|
|
* @param comment The CommentInputBean object
|
2023-02-07 11:42:49 +01:00
|
|
|
* @return
|
|
|
|
* @throws ValidationException
|
|
|
|
*/
|
|
|
|
@POST
|
|
|
|
@Path("comment-post")
|
|
|
|
@Consumes(MediaType.APPLICATION_JSON)
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
@StatusCodes ({
|
2023-11-22 19:52:25 +01:00
|
|
|
@ResponseCode ( code = 201, condition = "Successfull created, the new comment is reported in the 'result' field of the returned object"),
|
|
|
|
@ResponseCode ( code = 500, condition = ErrorMessages.ERROR_IN_API_RESULT)
|
2023-02-07 11:42:49 +01:00
|
|
|
})
|
|
|
|
public Response writeComment(
|
2023-11-22 19:52:25 +01:00
|
|
|
@NotNull(message="Comment to write is missing")
|
|
|
|
@Valid
|
2023-02-08 15:37:24 +01:00
|
|
|
CommentInputBean comment) throws ValidationException {
|
2023-02-07 11:42:49 +01:00
|
|
|
Caller caller = AuthorizationProvider.instance.get();
|
|
|
|
String username = caller.getClient().getId();
|
|
|
|
logger.debug("Request of writing a comment coming from user " + username);
|
|
|
|
String context = ScopeProvider.instance.get();
|
|
|
|
ResponseBean responseBean = new ResponseBean();
|
|
|
|
Status status = Status.OK;
|
2023-02-08 15:37:24 +01:00
|
|
|
|
2023-02-07 11:42:49 +01:00
|
|
|
try {
|
2023-02-08 15:37:24 +01:00
|
|
|
String postId = comment.getPostid();
|
|
|
|
String commentText = comment.getText();
|
|
|
|
String userid = username;
|
|
|
|
Date time = new Date();
|
|
|
|
|
2023-02-08 16:21:17 +01:00
|
|
|
String postOwnerId = CassandraConnection.getInstance().getDatabookStore().readPost(postId).getEntityId();
|
2023-02-08 15:37:24 +01:00
|
|
|
Comment theComment = SocialUtils.commentPost(userid, time, postId, commentText, postOwnerId, context);
|
|
|
|
if (theComment != null)
|
|
|
|
logger.info("Added comment " + theComment.toString());
|
|
|
|
else {
|
|
|
|
logger.error("Unable to write comment");
|
|
|
|
responseBean.setMessage("Unable to write comment, something went wrong please see server log");
|
|
|
|
responseBean.setSuccess(false);
|
|
|
|
status = Status.INTERNAL_SERVER_ERROR;
|
|
|
|
return Response.status(status).entity(responseBean).build();
|
|
|
|
}
|
|
|
|
|
2023-02-09 17:08:54 +01:00
|
|
|
responseBean.setResult(theComment);
|
2023-02-08 15:37:24 +01:00
|
|
|
responseBean.setSuccess(true);
|
|
|
|
return Response.status(status).entity(responseBean).build();
|
|
|
|
} catch(FeedIDNotFoundException ex) {
|
|
|
|
logger.error("Unable to find a post comment", ex);
|
2023-02-07 11:42:49 +01:00
|
|
|
responseBean.setMessage("Could not reach the DB to write the comment, something went wrong");
|
|
|
|
responseBean.setSuccess(false);
|
|
|
|
status = Status.INTERNAL_SERVER_ERROR;
|
|
|
|
return Response.status(status).entity(responseBean).build();
|
2023-11-22 19:52:25 +01:00
|
|
|
}
|
2023-02-08 15:37:24 +01:00
|
|
|
catch(Exception e) {
|
|
|
|
logger.error("Unable to write comment", e);
|
|
|
|
responseBean.setMessage("Could not reach the DB to write the comment, something went wrong");
|
2023-02-08 14:29:57 +01:00
|
|
|
responseBean.setSuccess(false);
|
|
|
|
status = Status.INTERNAL_SERVER_ERROR;
|
|
|
|
return Response.status(status).entity(responseBean).build();
|
2023-02-07 11:42:49 +01:00
|
|
|
}
|
|
|
|
}
|
2023-02-08 14:29:57 +01:00
|
|
|
|
2023-02-09 12:55:34 +01:00
|
|
|
|
2023-11-21 18:38:57 +01:00
|
|
|
|
2023-11-22 19:52:25 +01:00
|
|
|
|
|
|
|
|
2023-11-21 18:38:57 +01:00
|
|
|
//lib api
|
|
|
|
@POST
|
|
|
|
@Consumes(MediaType.APPLICATION_JSON)
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
@Path("add-comment-lib")
|
|
|
|
public Response addCommentLib(@NotNull(message="Comment to write is missing")
|
2023-11-22 19:52:25 +01:00
|
|
|
@Valid
|
|
|
|
Comment comment)throws ValidationException {
|
2023-11-21 18:38:57 +01:00
|
|
|
ResponseBean responseBean = new ResponseBean();
|
|
|
|
Status status = Status.OK;
|
|
|
|
try {
|
|
|
|
logger.info("Writing comment with commentid " + comment.getKey());
|
|
|
|
boolean result = CassandraConnection.getInstance().getDatabookStore().addComment(comment);
|
|
|
|
responseBean.setResult(result);
|
|
|
|
responseBean.setMessage("");
|
|
|
|
responseBean.setSuccess(result);
|
|
|
|
} catch (Exception e) {
|
|
|
|
logger.error("Unable to write comment.", e);
|
|
|
|
responseBean.setMessage(e.getMessage());
|
|
|
|
responseBean.setSuccess(false);
|
|
|
|
status = Status.INTERNAL_SERVER_ERROR;
|
|
|
|
}
|
|
|
|
return Response.status(status).entity(responseBean).build();
|
|
|
|
}
|
|
|
|
|
|
|
|
@GET
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
@Path("read-comment-by-id-lib")
|
|
|
|
public Response readCommentByIdLib(@QueryParam("commentid")
|
|
|
|
String commentid)throws ValidationException{
|
|
|
|
ResponseBean responseBean = new ResponseBean();
|
|
|
|
Status status = Status.OK;
|
|
|
|
try{
|
|
|
|
logger.info("Getting comment with commentid " + commentid);
|
|
|
|
Comment result = CassandraConnection.getInstance().getDatabookStore().readCommentById(commentid);
|
|
|
|
responseBean.setResult(result);
|
|
|
|
responseBean.setMessage("");
|
|
|
|
responseBean.setSuccess(true);
|
|
|
|
}catch(Exception e){
|
|
|
|
logger.error("Unable to find comment.", e);
|
|
|
|
responseBean.setMessage(e.getMessage());
|
|
|
|
responseBean.setSuccess(false);
|
|
|
|
status = Status.INTERNAL_SERVER_ERROR;
|
|
|
|
}
|
|
|
|
return Response.status(status).entity(responseBean).build();
|
|
|
|
}
|
|
|
|
|
|
|
|
@GET
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
@Path("get-comments-by-post-id-lib")
|
|
|
|
@StatusCodes ({
|
|
|
|
@ResponseCode ( code = 200, condition = "The list of comments is put into the 'result' field"),
|
|
|
|
@ResponseCode ( code = 500, condition = ErrorMessages.ERROR_IN_API_RESULT)
|
|
|
|
})
|
|
|
|
public Response getAllCommentsByPostIdLib(
|
|
|
|
@NotNull
|
|
|
|
@QueryParam("postid")
|
|
|
|
String postid) {
|
|
|
|
|
|
|
|
ResponseBean responseBean = new ResponseBean();
|
|
|
|
Status status = Status.OK;
|
|
|
|
List<Comment> comments = null;
|
|
|
|
|
|
|
|
try{
|
|
|
|
logger.info("Retrieving comments for postid " + postid);
|
|
|
|
comments = CassandraConnection.getInstance().getDatabookStore().getAllCommentByPost(postid);
|
|
|
|
responseBean.setResult(comments);
|
|
|
|
responseBean.setSuccess(true);
|
|
|
|
}catch(Exception e){
|
|
|
|
logger.error("Unable to retrieve such comments.", e);
|
|
|
|
responseBean.setMessage(e.getMessage());
|
|
|
|
responseBean.setSuccess(false);
|
|
|
|
status = Status.INTERNAL_SERVER_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
return Response.status(status).entity(responseBean).build();
|
|
|
|
}
|
|
|
|
|
|
|
|
@GET
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
@Path("get-recent-comments-by-user-and-date-lib")
|
|
|
|
public Response getRecentCommentsByUserAndDateLib(
|
|
|
|
@QueryParam("time")
|
|
|
|
@Min(value = 0, message="time cannot be negative")
|
|
|
|
long timeInMillis,
|
|
|
|
@QueryParam("username")
|
|
|
|
String username
|
|
|
|
) throws ValidationException{
|
|
|
|
|
|
|
|
ResponseBean responseBean = new ResponseBean();
|
|
|
|
Status status = Status.OK;
|
|
|
|
List<Comment> comments = null;
|
|
|
|
|
|
|
|
try{
|
|
|
|
logger.info("Retrieving comments for user id " + username);
|
|
|
|
comments = CassandraConnection.getInstance().getDatabookStore().getRecentCommentsByUserAndDate(username, timeInMillis);
|
|
|
|
responseBean.setResult(comments);
|
|
|
|
responseBean.setMessage("");
|
|
|
|
responseBean.setSuccess(true);
|
|
|
|
}catch(Exception e){
|
|
|
|
logger.error("Unable to retrieve such comments.", e);
|
|
|
|
responseBean.setMessage(e.getMessage());
|
|
|
|
responseBean.setSuccess(false);
|
|
|
|
status = Status.INTERNAL_SERVER_ERROR;
|
|
|
|
}
|
|
|
|
return Response.status(status).entity(responseBean).build();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@POST
|
|
|
|
@Consumes(MediaType.APPLICATION_JSON)
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
@Path("edit-comment-lib")
|
|
|
|
public Response editCommentLib(
|
|
|
|
@NotNull(message="Comment to edit is missing")
|
|
|
|
@Valid
|
|
|
|
Comment comment
|
|
|
|
) throws ValidationException{
|
|
|
|
ResponseBean responseBean = new ResponseBean();
|
|
|
|
Status status = Status.OK;
|
|
|
|
try{
|
|
|
|
logger.info("Writing comment with commentid " + comment.getKey());
|
|
|
|
boolean result = CassandraConnection.getInstance().getDatabookStore().editComment(comment);
|
|
|
|
responseBean.setResult(result);
|
|
|
|
responseBean.setMessage("");
|
|
|
|
responseBean.setSuccess(result);
|
|
|
|
}catch(Exception e){
|
|
|
|
logger.error("Unable to write comment.", e);
|
|
|
|
responseBean.setMessage(e.getMessage());
|
|
|
|
responseBean.setSuccess(false);
|
|
|
|
status = Status.INTERNAL_SERVER_ERROR;
|
|
|
|
}
|
|
|
|
return Response.status(status).entity(responseBean).build();
|
|
|
|
}
|
|
|
|
|
|
|
|
@POST
|
|
|
|
@Consumes(MediaType.APPLICATION_JSON)
|
|
|
|
@Produces(MediaType.APPLICATION_JSON)
|
|
|
|
@Path("delete-comment-lib")
|
|
|
|
public Response deleteCommentLib(
|
|
|
|
@QueryParam("commentid")
|
|
|
|
String commentid,
|
|
|
|
@QueryParam("postid")
|
|
|
|
String postid
|
|
|
|
) throws ValidationException{
|
|
|
|
ResponseBean responseBean = new ResponseBean();
|
|
|
|
Status status = Status.OK;
|
|
|
|
try{
|
|
|
|
logger.info("deleting comment with commentid " + commentid);
|
|
|
|
boolean result = CassandraConnection.getInstance().getDatabookStore().deleteComment(commentid, postid);
|
|
|
|
responseBean.setResult(result);
|
|
|
|
responseBean.setMessage("");
|
|
|
|
responseBean.setSuccess(result);
|
|
|
|
}catch(Exception e){
|
|
|
|
logger.error("Unable to delete comment.", e);
|
|
|
|
responseBean.setMessage(e.getMessage());
|
|
|
|
responseBean.setSuccess(false);
|
|
|
|
status = Status.INTERNAL_SERVER_ERROR;
|
|
|
|
}
|
|
|
|
return Response.status(status).entity(responseBean).build();
|
|
|
|
}
|
2023-11-22 19:52:25 +01:00
|
|
|
|
|
|
|
|
2019-04-05 16:39:46 +02:00
|
|
|
}
|