@Role
public interface AnnotationService
and org.xwiki.annotation.io.IOTargetService
. IOTargetService
,
IOTargetService
Modifier and Type | Method and Description |
---|---|
void |
addAnnotation(String target,
String selection,
String selectionContext,
int offset,
String author,
Map<String,Object> metadata)
Adds an the specified annotation for the specified target.
|
String |
getAnnotatedHTML(String sourceReference)
Returns the XHTML of the requested source, along with annotations inserted as
span elements inside it. |
String |
getAnnotatedRenderedContent(String sourceReference,
String sourceSyntax,
String outputSyntax,
Collection<Annotation> annotations)
Returns result obtained by rendering with annotations markers the source referenced by the
sourceReference parsed in sourceSyntax . |
Annotation |
getAnnotation(String target,
String id)
Returns the annotation identified by
id on the specified target. |
Collection<Annotation> |
getAnnotations(String target)
Returns all the annotations on the passed content.
|
Collection<Annotation> |
getValidAnnotations(String target)
Shortcut function to get all annotations which are valid on the specified target, regardless of the updates the
document and its annotations suffered from creation ('safe' or 'updated' state).
|
void |
removeAnnotation(String target,
String annotationID)
Remove an annotation given by its identifier, which should be unique among all annotations on the same target.
|
void |
updateAnnotation(String target,
Annotation annotation)
Updates the passed annotation with the new values.
|
String getAnnotatedHTML(String sourceReference) throws AnnotationServiceException
span
elements inside it.
It's a particular case of getAnnotatedRenderedContent(String, String, String, Collection)
for
unspecified input syntax, xhtml/1.0
output syntax and the list of annotations returned by
getValidAnnotations(String)
for this source reference.sourceReference
- reference to the source to be rendered in XHTML with annotationsAnnotationServiceException
- if anything goes wrong retrieving or rendering the requested sourcegetAnnotatedRenderedContent(String, String, String, Collection)
String getAnnotatedRenderedContent(String sourceReference, String sourceSyntax, String outputSyntax, Collection<Annotation> annotations) throws AnnotationServiceException
sourceReference
parsed in sourceSyntax
. The list of annotations to be added markers for is passed
in the annotations
parameter. Note that no test is done on the actual target of the annotations in the
passed list, they will all be rendered, as long as their selected text and context can be identified in the
content.sourceReference
- the reference to the source to be rendered in XHTML with annotationssourceSyntax
- the syntax to parse the source in. If this parameter is null, the default source syntax will
be used, as returned by the target IO service.outputSyntax
- the syntax to render in (e.g. "xhtml/1.0")annotations
- the annotations to render on the content referred by the sourceReference
. Can be the
whole set of annotations on that source or a subset, filtered by various criteriaAnnotationServiceException
- if anything goes wrong retrieving or rendering the requested sourcevoid addAnnotation(String target, String selection, String selectionContext, int offset, String author, Map<String,Object> metadata) throws AnnotationServiceException
target
- serialized reference of the target of the annotationselection
- HTML selection concerned by annotationsselectionContext
- HTML selection contextoffset
- offset of the selection in contextauthor
- the author of the annotationmetadata
- annotation metadata, as key, value pairsAnnotationServiceException
- if selection resolution fail or if an XWikiException occurredvoid removeAnnotation(String target, String annotationID) throws AnnotationServiceException
target
- the string serialized reference to the content on which the annotation is addedannotationID
- annotation identifierAnnotationServiceException
- if anything goes wrong accessing the annotations storevoid updateAnnotation(String target, Annotation annotation) throws AnnotationServiceException
target
- the string serialized reference to the content on which the annotation is addedannotation
- the new description of the annotation to update, with a valid idAnnotationServiceException
- if anything goes wrong accessing the annotations storeCollection<Annotation> getAnnotations(String target) throws AnnotationServiceException
target
- the string serialized reference to the content for which to get the annotationsAnnotationServiceException
- if anything goes wrong accessing the annotations storeAnnotation getAnnotation(String target, String id) throws AnnotationServiceException
id
on the specified target.target
- the serialized reference to the content on which the annotation is addedid
- the identifier of the annotationid
AnnotationServiceException
- if anything goes wrong accessing the annotations storeCollection<Annotation> getValidAnnotations(String target) throws AnnotationServiceException
target
- the string serialized reference to the content for which to get the annotationsAnnotationServiceException
- if anything goes wrong accessing the annotations storeAnnotationState
Copyright © 2004–2022 XWiki. All rights reserved.