@Override public List<DocumentModel> getComments(CoreSession session, DocumentModel docModel) throws CommentSecurityException { return Stream.concat(first.getComments(session, docModel).stream(), second.getComments(session, docModel).stream()).distinct().collect(Collectors.toList()); }
@Override public Comment createComment(CoreSession session, Comment comment) throws CommentNotFoundException, CommentSecurityException { return second.createComment(session, comment); }
@Override public void deleteComment(DocumentModel docModel, DocumentModel comment) { if (comment.getPropertyValue(COMMENT_PARENT_ID) != null) { second.deleteComment(docModel, comment); } else { first.deleteComment(docModel, comment); } }
if (commentManager.hasFeature(COMMENTS_LINKED_WITH_PROPERTY)) { PageProviderService ppService = Framework.getService(PageProviderService.class); return CoreInstance.doPrivileged(session, s -> { .getComments(s, annotatedDoc) .stream() .filter(annotationModel -> ANNOTATION_DOC_TYPE.equals(annotationModel.getType())
@Override public DocumentModel createLocatedComment(DocumentModel docModel, DocumentModel comment, String path) throws CommentSecurityException { return second.createLocatedComment(docModel, comment, path); }
@Override public Comment getExternalComment(CoreSession session, String entityId) throws CommentNotFoundException, CommentSecurityException { return second.getExternalComment(session, entityId); }
@Override public Comment updateExternalComment(CoreSession session, String entityId, Comment comment) throws CommentNotFoundException, CommentSecurityException { return second.updateExternalComment(session, entityId, comment); }
@Override public Comment getComment(CoreSession session, String commentId) throws CommentNotFoundException, CommentSecurityException { return second.getComment(session, commentId); }
@PUT @Path("{commentId}") public Response updateComment(@PathParam("commentId") String commentId, Comment comment) { CommentManager commentManager = Framework.getService(CommentManager.class); Comment updatedComment = commentManager.updateComment(getContext().getCoreSession(), commentId, comment); return Response.ok(updatedComment).build(); }
@Override public void deleteExternalComment(CoreSession session, String entityId) throws CommentNotFoundException, CommentSecurityException { second.deleteExternalComment(session, entityId); }
@SuppressWarnings("unchecked") public DocumentModel addComment(DocumentModel comment, String path) { comment.setPropertyValue(COMMENT_PARENT_ID, docModel.getId()); return commentManager.createLocatedComment(docModel, comment, path); }
@GET @Path("external/{entityId}") public Comment getExternalComment(@PathParam("entityId") String entityId) { CommentManager commentManager = Framework.getService(CommentManager.class); return commentManager.getExternalComment(getContext().getCoreSession(), entityId); }
@PUT @Path("external/{entityId}") public Comment updateExternalComment(@PathParam("entityId") String entityId, Comment comment) { CommentManager commentManager = Framework.getService(CommentManager.class); commentManager.updateExternalComment(getContext().getCoreSession(), entityId, comment); return comment; }
@GET @Path("{commentId}") public Comment getComment(@PathParam("commentId") String commentId) { CommentManager commentManager = Framework.getService(CommentManager.class); return commentManager.getComment(getContext().getCoreSession(), commentId); }
@Override public Comment updateComment(CoreSession session, String commentId, Comment comment) throws CommentNotFoundException, CommentSecurityException { DocumentRef commentRef = new IdRef(commentId); if (!session.exists(commentRef)) { throw new CommentNotFoundException("The comment " + commentId + " does not exist"); } if (session.getDocument(commentRef).getPropertyValue(COMMENT_PARENT_ID) != null) { return second.updateComment(session, commentId, comment); } else { return first.updateComment(session, commentId, comment); } }
@DELETE @Path("external/{entityId}") public Response deleteExternalComment(@PathParam("entityId") String entityId) { CommentManager commentManager = Framework.getService(CommentManager.class); commentManager.deleteExternalComment(getContext().getCoreSession(), entityId); return Response.noContent().build(); }
@Override public List<DocumentModel> getComments(DocumentModel docModel) { return Stream.concat(first.getComments(docModel).stream(), second.getComments(docModel).stream()) .distinct() .collect(Collectors.toList()); }
@Override public DocumentModel createComment(DocumentModel docModel, String comment) { return second.createComment(docModel, comment); }
@DELETE @Path("{commentId}") public Response deleteComment(@PathParam("commentId") String commentId) { CommentManager commentManager = Framework.getService(CommentManager.class); commentManager.deleteComment(getContext().getCoreSession(), commentId); return Response.noContent().build(); }
@Override public List<Comment> getComments(CoreSession session, String documentId) { return Stream.concat(first.getComments(session, documentId).stream(), second.getComments(session, documentId).stream()).distinct().collect(Collectors.toList()); }