Interface AnnotationService
-
- All Known Implementing Classes:
AnnotationServiceImpl
public interface AnnotationServiceAnnotation API to perform CRUD operations on annotations.- Since:
- 10.1
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description AnnotationcreateAnnotation(CoreSession session, Annotation annotation)Creates an annotation on a document.voiddeleteAnnotation(CoreSession session, String annotationId)Deletes an annotation for a document.default voiddeleteExternalAnnotation(CoreSession session, String entityId)Deprecated.since 11.1, usedeleteExternalAnnotation(CoreSession, String, String)insteadvoiddeleteExternalAnnotation(CoreSession session, String documentId, String entityId)Deletes an external annotation by its {code entityId} under the document withdocumentId.AnnotationgetAnnotation(CoreSession session, String annotationId)Gets an annotation.List<Annotation>getAnnotations(CoreSession session, String documentId, String xpath)Gets all annotations for a document.default AnnotationgetExternalAnnotation(CoreSession session, String entityId)Deprecated.since 11.1, usegetExternalAnnotation(CoreSession, String, String)insteadAnnotationgetExternalAnnotation(CoreSession session, String documentId, String entityId)Gets an external annotation by itsentityIdunder the document withdocumentId.voidupdateAnnotation(CoreSession session, String annotationId, Annotation annotation)Updates an annotation for a document.AnnotationupdateExternalAnnotation(CoreSession session, String documentId, String entityId, Annotation annotation)Updates an external annotation by itsentityIdunder the document withdocumentId.default voidupdateExternalAnnotation(CoreSession session, String entityId, Annotation annotation)Deprecated.since 11.1, useupdateExternalAnnotation(CoreSession, String, String, Annotation)instead
-
-
-
Method Detail
-
createAnnotation
Annotation createAnnotation(CoreSession session, Annotation annotation) throws CommentSecurityException
Creates an annotation on a document.- Parameters:
session- the core sessionannotation- the annotation to create- Returns:
- the created annotation
- Throws:
CommentSecurityException- if the current user does have the right permissions on the document to annotate.
-
getAnnotation
Annotation getAnnotation(CoreSession session, String annotationId) throws CommentNotFoundException, CommentSecurityException
Gets an annotation.- Parameters:
session- the core sessionannotationId- the annotation document model id- Returns:
- the annotation, or
nullif the annotation with the given id was not found - Throws:
CommentNotFoundException- if no annotation was found with the given idCommentSecurityException- if the current user does have the right permissions on the annotated document.
-
getAnnotations
List<Annotation> getAnnotations(CoreSession session, String documentId, String xpath) throws CommentNotFoundException, CommentSecurityException
Gets all annotations for a document.- Parameters:
session- the core sessiondocumentId- the annotated document idxpath- the annotated blob xpath in the document- Returns:
- the list of annotations, or an empty list if no annotation is found
- Throws:
CommentNotFoundException- if no annotation was found with the given idCommentSecurityException- if the current user does have the right permissions on the annotated document.
-
updateAnnotation
void updateAnnotation(CoreSession session, String annotationId, Annotation annotation) throws CommentNotFoundException, CommentSecurityException
Updates an annotation for a document.- Parameters:
session- the core sessionannotationId- the annotation document model idannotation- the annotation containing the modifications- Throws:
CommentNotFoundException- if no annotation was found with the given idCommentSecurityException- if the current user does have the right permissions on the annotated document.
-
deleteAnnotation
void deleteAnnotation(CoreSession session, String annotationId) throws CommentNotFoundException, CommentSecurityException
Deletes an annotation for a document.- Parameters:
session- the core sessionannotationId- the annotation document model id- Throws:
CommentNotFoundException- if no annotation was found with the given idCommentSecurityException- if the current user does have the right permissions on the annotated document.
-
getExternalAnnotation
@Deprecated(since="11.1") default Annotation getExternalAnnotation(CoreSession session, String entityId) throws CommentNotFoundException, CommentSecurityException
Deprecated.since 11.1, usegetExternalAnnotation(CoreSession, String, String)instead- Throws:
CommentNotFoundExceptionCommentSecurityException- Since:
- 10.3
-
getExternalAnnotation
Annotation getExternalAnnotation(CoreSession session, String documentId, String entityId)
Gets an external annotation by itsentityIdunder the document withdocumentId.- Returns:
- the annotation with given
entityIdunder the document with givendocumentId - Throws:
CommentNotFoundException- if no annotation was found with the given external entity idCommentSecurityException- if the current user does have the right permissions on the annotated document.- Since:
- 11.1
-
updateExternalAnnotation
@Deprecated(since="11.1") default void updateExternalAnnotation(CoreSession session, String entityId, Annotation annotation) throws CommentNotFoundException, CommentSecurityException
Deprecated.since 11.1, useupdateExternalAnnotation(CoreSession, String, String, Annotation)instead- Throws:
CommentNotFoundExceptionCommentSecurityException- Since:
- 10.3
-
updateExternalAnnotation
Annotation updateExternalAnnotation(CoreSession session, String documentId, String entityId, Annotation annotation)
Updates an external annotation by itsentityIdunder the document withdocumentId.- Returns:
- the updated annotation with given
entityIdunder the document with givendocumentId - Throws:
CommentNotFoundException- if no annotation was found with the given external entity idCommentSecurityException- if the current user does have the right permissions on the annotated document.- Since:
- 11.1
-
deleteExternalAnnotation
@Deprecated(since="11.1") default void deleteExternalAnnotation(CoreSession session, String entityId) throws CommentNotFoundException, CommentSecurityException
Deprecated.since 11.1, usedeleteExternalAnnotation(CoreSession, String, String)instead- Throws:
CommentNotFoundExceptionCommentSecurityException- Since:
- 10.3
-
deleteExternalAnnotation
void deleteExternalAnnotation(CoreSession session, String documentId, String entityId)
Deletes an external annotation by its {code entityId} under the document withdocumentId.- Throws:
CommentNotFoundException- if no annotation was found with the given external entity idCommentSecurityException- if the current user does have the right permissions on the annotated document.- Since:
- 11.1
-
-