Index: /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/AnnotationResource.java
===================================================================
--- /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/AnnotationResource.java	(revision 6008)
+++ /DASISH/t5.6/backend/annotator-backend/trunk/annotator-backend/src/main/java/eu/dasish/annotation/backend/rest/AnnotationResource.java	(revision 6009)
@@ -70,12 +70,25 @@
     final private String[] admissibleMatchModes = {"exact", "starts_with", "ends_with", "contains"};
 
+   /**
+    * 
+    * @param httpServletResponse a {@link HttpServletResponse} object, to be set to "this" object and to be used to send error messages.
+    */
     public void setHttpServletResponse(HttpServletResponse httpServletResponse) {
         this.httpServletResponse = httpServletResponse;
     }
-
+    
+    /**
+     * 
+     * @param httpServletRequest a {@link HttpServletRequest} object, to be set to "this" object and to be used in the unit tests.
+     */
     public void setHttpServletRequest(HttpServletRequest httpServletRequest) {
         this.httpServletRequest = httpServletRequest;
     }
 
+    /**
+     * 
+     * @param providers a {@link Providers} object, to be set to "this" object and to be used to force 
+     * validation of the input/output xml files w.r.t. the dasish schema.
+     */
     public void setProviders(Providers providers) {
         this.providers = providers;
@@ -86,4 +99,11 @@
     
 
+    /**
+     * 
+     * @param externalIdentifier the string representing the UUID of an annotation.
+     * @return the xml-element representing the annotation with "externalIdentifier" built up 
+     * from the "annotation" table and the corresponding junction tables. 
+     * @throws IOException if sending the error fails.
+     */
     @GET
     @Produces(MediaType.TEXT_XML)
@@ -116,5 +136,10 @@
     }
 
-    //////////////////////////////////////////////////
+    /**
+     * 
+     * @param externalIdentifier the string representing the UUID of an annotation.
+     * @return the xml element representing the list of h-references of the annotation with "externalIdentifier".
+     * @throws IOException if sending the error fails.
+     */
     @GET
     @Produces(MediaType.TEXT_XML)
@@ -146,6 +171,19 @@
         }
     }
-// TODO Unit test 
-
+
+    /**
+     * 
+     * @param link the link representing one of the target sources of the annotation.
+     * @param matchMode the relation of the actual target-source link to "link" parameter: "exact", "starts_with", "ends_with", "contains"
+     * @param text the text fragment that must be present in the annotation body.
+     * @param access the access mode of the logged in user to the requested annotations.
+     * @param namespace not implemented.
+     * @param ownerExternalId the external UUID of the owner of requested annotations.
+     * @param after the minimal creation/update date of the annotation.
+     * @param before the maximal creation/update date of the annotation.
+     * @return the xml-element representing the list of {@link AnnotationInfo} objects representing 
+     * the annotations satisfying the requirements defined by the parameters.
+     * @throws IOException if sending the error fails.
+     */
     @GET
     @Produces(MediaType.TEXT_XML)
@@ -197,4 +235,12 @@
     }
     
+    /**
+     * 
+     * @param n # of requested annotations (to which logged in principal has "read" access.
+     * @return the external UUIDs of some n annotations to which the logged in principal has "read" access,
+     * if the principal has "admin" or "developer" type of account.
+     * @throws IOException if sending the error fails.
+     * @throws NotInDataBaseException if getting annotation fails.
+     */
     @GET
     @Produces(MediaType.TEXT_PLAIN)
@@ -234,6 +280,12 @@
     
     
-// TODO Unit test    
-
+
+   /**
+    * 
+    * @param externalIdentifier the external UUID of an annotation.
+    * @return the xml-element representing the list of permissions, i.e. pairs (principalId, accessMode),
+    * built upon the table "annotations_principals_accesses".
+    * @throws IOException if sending the error fails.
+    */
     @GET
     @Produces(MediaType.TEXT_XML)
@@ -265,6 +317,11 @@
         }
     }
-///////////////////////////////////////////////////////
-
+
+    /**
+     * 
+     * @param externalIdentifier the external UUID of the annotation to be deleted.
+     * @return the message if the annotation is deleted or not.
+     * @throws IOException if sending the error fails.
+     */
     @DELETE
     @Path("{annotationid: " + BackendConstants.regExpIdentifier + "}")
@@ -295,5 +352,13 @@
     }
 
-///////////////////////////////////////////////////////
+    /**
+     * 
+     * @param annotation an {@link Annotation} object,
+     * @return the {@link ResponseBody} element that contains the xml element representing 
+     * the fresh annotation (with its generated by the method external UUID), and the list
+     * of action-elements representing the actions the client should care for,
+     * e.g. add a cached representation for a certain target.
+     * @throws IOException if sending the error fails.
+     */
     @POST
     @Consumes(MediaType.APPLICATION_XML)
@@ -331,6 +396,13 @@
     }
 
-///////////////////////////////////////////////////////
-// TODO: unit test
+   /**
+    * 
+    * @param externalId the external UUID of the annotation to be updated.
+    * @param annotation the {@link Annotation} object that represent the new annotation that should replace the annotation with "externalId".
+    * @return the {@link ResponseBody} element that contains the xml element representing 
+     * the updated annotation, and the list of action-elements representing the actions the client should care for,
+     * e.g. add a cached representation for a certain target.
+     * @throws IOException if sending the error fails. 
+    */
     @PUT
     @Consumes(MediaType.APPLICATION_XML)
@@ -365,5 +437,5 @@
     }
 
-    ///////////////////////////////////////////////////////////
+    
     private class UpdateAnnotation implements ILambda<Map, ResponseBody> {
 
@@ -377,6 +449,14 @@
         }
     }
-    ///////////////////////////////////////////////////////////////////////////////
-
+    
+   /**
+    * 
+    * @param externalIdentifier the external UUID of the annotation whose body must be updated.
+    * @param annotationBody an {@link AnnotationBody} object representation the new body of the annotation,
+    * which should replace the old body.
+    * @return the {@link ResponseBody} element that contains the xml element representing 
+    * the updated annotation, and the list of action-elements representing the actions the client should care for.
+    * @throws IOException if sending the error fails.  
+    */
     @PUT
     @Consumes(MediaType.APPLICATION_XML)
@@ -415,4 +495,12 @@
     }
 
+    /**
+     * 
+     * @param externalIdentifier the external UUID of the annotation whose headline is to be updated.
+     * @param newHeadline the string representing the new headline.
+     * @return the {@link ResponseBody} element that contains the xml element representing 
+     * the updated annotation, and the list of action-elements representing the actions the client should care for.
+     * @throws IOException if sending the error fails.  
+     */
     @PUT
     @Consumes(MediaType.TEXT_PLAIN)
@@ -451,6 +539,14 @@
     }
 
-    //////////////////////////////////////////
-    //////////////////////////////////////////////
+   /**
+    * 
+    * @param annotationDatabaseId the internal database Id of the annotation to be updated.
+    * @param annotationHeadline the annotation's headline.
+    * @param access the new value for the public attribute of the annotation.
+    * @return the message if the database has been updated and how many rows have been updated;
+    * if "annotationDatabaseId" == null or empty then all the annotations with "annotationHeadline"
+    * must be updated,
+    * @throws IOException if sending the error fails.
+    */
     @POST
     @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@@ -513,5 +609,12 @@
     }
 
-    ////////////////////////////////////////////////////
+    /**
+     * 
+     * @param annotationExternalId the external UUID of an annotation.
+     * @param principalExternalId the external UUID of a principal whose access mode to the annotation must be updated.
+     * @param access the access mode that should assigned to the principal.
+     * @return the message about the amount of updated rows.
+     * @throws IOException if sending the error fails.
+     */
     @PUT
     @Consumes(MediaType.APPLICATION_XML)
@@ -531,5 +634,15 @@
     }
 
-    //////////////////////////////////////////////
+    /**
+     * One of 3 principal-related parameters must be non-null and non-empty; one of 2 annotation related parameters must be non-null and non-empty.
+     * @param remoteID the remote ID of the principal whose access mode to the annotation (see below) must be updated.
+     * @param fullName the full name of the principal whose access mode to the annotation must be updated.
+     * @param principalDatabaseId the internal database identifier of the principal whose access mode to the annotation must be updated. 
+     * @param annotationDatabaseId the internal database id of the annotation for which the access mode must be updated.
+     * @param annotationHeadline the headline of the annotation for which the access mode must be updated.
+     * @param access the new access mode.
+     * @return the message explaining how many rows have been updated. 
+     * @throws IOException  if sending error message fails.
+     */
     @POST
     @Consumes(MediaType.APPLICATION_FORM_URLENCODED)
@@ -613,6 +726,16 @@
         }
     }
-    ///////////////////////////////////////////
-
+    
+    
+    /**
+     * 
+     * @param annotationExternalId the external UUID of an annotation.
+     * @param permissions a {@link PermissionList} object representing a list of pairs (principal UUID, access mode) of the
+     * new list of permissions for the annotation.
+     * @return the {@link ResponseBody} element that contains the xml element representing 
+     * the updated annotation, and the list of action-elements representing the actions the client should care for,
+     * e.g. add the e-mail of a certain principal.
+     * @throws IOException if sending the error fails.
+     */
     @PUT
     @Consumes(MediaType.APPLICATION_XML)
@@ -652,5 +775,11 @@
     }
 
-    ////////////////////////////////////////////////////////////
+    /**
+     * 
+     * @param annotationId the external UUID of the annotation.
+     * @param principalId the external UUID of a principal whose access mode must be deleted.
+     * @return the amount of updated/removed rows in the database.
+     * @throws IOException if sending the error fails.
+     */
     @DELETE
     @Produces(MediaType.TEXT_PLAIN)
