Interface AnnotationService
- All Known Implementing Classes:
AnnotationServiceImpl
public interface AnnotationService
Annotation API to perform CRUD operations on annotations.
- Since:
- 10.1
-
Method Summary
Modifier and TypeMethodDescriptioncreateAnnotation
(CoreSession session, Annotation annotation) Creates an annotation on a document.void
deleteAnnotation
(CoreSession session, String annotationId) Deletes an annotation for a document.default void
deleteExternalAnnotation
(CoreSession session, String entityId) Deprecated.void
deleteExternalAnnotation
(CoreSession session, String documentId, String entityId) Deletes an external annotation by its {code entityId} under the document withdocumentId
.getAnnotation
(CoreSession session, String annotationId) Gets an annotation.getAnnotations
(CoreSession session, String documentId, String xpath) Gets all annotations for a document.default Annotation
getExternalAnnotation
(CoreSession session, String entityId) Deprecated.since 11.1, usegetExternalAnnotation(CoreSession, String, String)
insteadgetExternalAnnotation
(CoreSession session, String documentId, String entityId) Gets an external annotation by itsentityId
under the document withdocumentId
.void
updateAnnotation
(CoreSession session, String annotationId, Annotation annotation) Updates an annotation for a document.updateExternalAnnotation
(CoreSession session, String documentId, String entityId, Annotation annotation) Updates an external annotation by itsentityId
under the document withdocumentId
.default void
updateExternalAnnotation
(CoreSession session, String entityId, Annotation annotation) Deprecated.since 11.1, useupdateExternalAnnotation(CoreSession, String, String, Annotation)
instead
-
Method Details
-
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
null
if 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:
CommentNotFoundException
CommentSecurityException
- Since:
- 10.3
-
getExternalAnnotation
Gets an external annotation by itsentityId
under the document withdocumentId
.- Returns:
- the annotation with given
entityId
under 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:
CommentNotFoundException
CommentSecurityException
- Since:
- 10.3
-
updateExternalAnnotation
Annotation updateExternalAnnotation(CoreSession session, String documentId, String entityId, Annotation annotation) Updates an external annotation by itsentityId
under the document withdocumentId
.- Returns:
- the updated annotation with given
entityId
under 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:
CommentNotFoundException
CommentSecurityException
- Since:
- 10.3
-
deleteExternalAnnotation
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
-
deleteExternalAnnotation(CoreSession, String, String)
instead