public static Comment newComment(DocumentModel commentModel) { Comment comment = new CommentImpl(); documentModelToComment(commentModel, comment); documentModelToExternalEntity(commentModel, (ExternalEntity) comment); return comment; }
public static Annotation newAnnotation(DocumentModel annotationModel) { Annotation annotation = new AnnotationImpl(); documentModelToAnnotation(annotationModel, annotation); documentModelToExternalEntity(annotationModel, (ExternalEntity) annotation); return annotation; } }
@Override public Comment createComment(CoreSession session, Comment comment) throws CommentNotFoundException, CommentSecurityException { return second.createComment(session, comment); }
public static void documentModelToExternalEntity(DocumentModel documentModel, ExternalEntity entity) { if (documentModel.hasFacet(EXTERNAL_ENTITY_FACET)) { entity.setEntityId((String) documentModel.getPropertyValue(EXTERNAL_ENTITY_ID_PROPERTY)); entity.setOrigin((String) documentModel.getPropertyValue(EXTERNAL_ENTITY_ORIGIN_PROPERTY)); entity.setEntity((String) documentModel.getPropertyValue(EXTERNAL_ENTITY_PROPERTY)); } }
public static void annotationToDocumentModel(Annotation annotation, DocumentModel documentModel) { commentToDocumentModel(annotation, documentModel); documentModel.setPropertyValue(ANNOTATION_XPATH_PROPERTY, annotation.getXpath()); }
@Override public void deleteComment(DocumentModel docModel, DocumentModel comment) { if (comment.getPropertyValue(COMMENT_PARENT_ID) != null) { second.deleteComment(docModel, comment); } else { first.deleteComment(docModel, comment); } }
@Override protected Annotation readEntity(JsonNode jn) { Annotation annotation = new AnnotationImpl(); fillCommentEntity(jn, annotation); annotation.setXpath(jn.get(ANNOTATION_XPATH).textValue()); return annotation; }
public static void documentModelToAnnotation(DocumentModel documentModel, Annotation annotation) { documentModelToComment(documentModel, annotation); annotation.setXpath((String) documentModel.getPropertyValue(ANNOTATION_XPATH_PROPERTY)); }
@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); }
@Override public void deleteExternalComment(CoreSession session, String entityId) throws CommentNotFoundException, CommentSecurityException { second.deleteExternalComment(session, entityId); }
@Override protected Comment readEntity(JsonNode jn) { Comment comment = new CommentImpl(); return fillCommentEntity(jn, comment); }
@Override public DocumentModel getThreadForComment(DocumentModel comment) throws CommentSecurityException { if (comment.getPropertyValue(COMMENT_PARENT_ID) != null) { return second.getThreadForComment(comment); } return first.getThreadForComment(comment); }
@Override public DocumentModel createComment(DocumentModel docModel, String comment) { return second.createComment(docModel, comment); }
@SuppressWarnings("unchecked") public DocumentModel addComment(DocumentModel comment, String path) { comment.setPropertyValue(COMMENT_PARENT_ID, docModel.getId()); return commentManager.createLocatedComment(docModel, comment, path); }
@Override public DocumentModel createComment(DocumentModel docModel, DocumentModel comment) throws CommentSecurityException { return second.createComment(docModel, comment); }
@Override public DocumentModel createComment(DocumentModel docModel, String comment, String author) { return second.createComment(docModel, comment, author); }
@Override public DocumentModel createComment(DocumentModel docModel, DocumentModel parent, DocumentModel child) { return second.createComment(docModel, parent, child); }