org.xwiki.annotation.rest.internal
Class AnnotationsRESTResource

java.lang.Object
  extended by org.xwiki.rest.XWikiResource
      extended by org.xwiki.annotation.rest.internal.AbstractAnnotationRESTResource
          extended by org.xwiki.annotation.rest.internal.AnnotationsRESTResource
All Implemented Interfaces:
org.xwiki.component.phase.Initializable, XWikiRestComponent

@Component
@Named(value="org.xwiki.annotation.rest.internal.AnnotationsRESTResource")
@Singleton
public class AnnotationsRESTResource
extends AbstractAnnotationRESTResource

Since:
2.3M1
Version:
$Id$

Nested Class Summary
 
Nested classes/interfaces inherited from class org.xwiki.rest.XWikiResource
XWikiResource.DocumentInfo
 
Field Summary
 
Fields inherited from class org.xwiki.annotation.rest.internal.AbstractAnnotationRESTResource
annotationRightService, annotationService, DEFAULT_ACTION, execution
 
Fields inherited from class org.xwiki.rest.XWikiResource
componentManager, logger, objectFactory, queryManager, uriInfo
 
Constructor Summary
AnnotationsRESTResource()
           
 
Method Summary
 javax.ws.rs.core.Response doGetAnnotatedContent(java.lang.String space, java.lang.String page, java.lang.String wiki, AnnotationRequest request)
           
 AnnotationResponse doPostAnnotation(java.lang.String wiki, java.lang.String space, java.lang.String page, AnnotationAddRequest request)
          Add annotation to a given page.
protected  java.util.Map<java.lang.String,java.lang.Object> getMap(AnnotationFieldCollection fields)
          Builds a simple map from a field collection.
 
Methods inherited from class org.xwiki.annotation.rest.internal.AbstractAnnotationRESTResource
filterAnnotations, getErrorResponse, getSuccessResponseWithAnnotatedContent, getXWikiUser
 
Methods inherited from class org.xwiki.rest.XWikiResource
getDocumentInfo, getUriTemplate, initialize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AnnotationsRESTResource

public AnnotationsRESTResource()
Method Detail

doGetAnnotatedContent

public javax.ws.rs.core.Response doGetAnnotatedContent(java.lang.String space,
                                                       java.lang.String page,
                                                       java.lang.String wiki,
                                                       AnnotationRequest request)
Parameters:
wiki - the wiki of the document to get annotations for
space - the space of the document to get annotations for
page - the name of the document to get annotation for
request - the extra fields to be returned from the annotation structure when returning the annotation resume to the client side
Returns:
annotations of a given XWiki page. Note that we're returning a response holding the AnnotatedContent instead of an AnnotatedContent object because we need to be able to set custom expire fields to prevent IE from caching this resource.

doPostAnnotation

public AnnotationResponse doPostAnnotation(java.lang.String wiki,
                                           java.lang.String space,
                                           java.lang.String page,
                                           AnnotationAddRequest request)
Add annotation to a given page.

Parameters:
wiki - the wiki of the document to add annotation on
space - the space of the document to add annotation on
page - the name of the document to add annotation on
request - the request object with the annotation to be added
Returns:
AnnotationRequestResponse, responseCode = 0 if no error

getMap

protected java.util.Map<java.lang.String,java.lang.Object> getMap(AnnotationFieldCollection fields)
Builds a simple map from a field collection.

Parameters:
fields - the collection of fields to build a map for
Returns:
a map of the fields, as string key and Object value pair


Copyright © 2004-2011 XWiki. All Rights Reserved.