diff src/main/java/de/intevation/lada/rest/ProbeService.java @ 451:89a5dbeb5bd6

Comments.
author Raimund Renkert <raimund.renkert@intevation.de>
date Wed, 11 Feb 2015 13:03:07 +0100
parents 808ea2091c1d
children 01d6da858394
line wrap: on
line diff
--- a/src/main/java/de/intevation/lada/rest/ProbeService.java	Wed Feb 11 13:01:55 2015 +0100
+++ b/src/main/java/de/intevation/lada/rest/ProbeService.java	Wed Feb 11 13:03:07 2015 +0100
@@ -38,25 +38,40 @@
 import de.intevation.lada.util.data.RepositoryType;
 import de.intevation.lada.util.rest.Response;
 
+
+/**
+ * This class produces a RESTful service to interact with probe objects.
+ *
+ * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a>
+ */
 @Path("probe")
 @RequestScoped
 public class ProbeService {
 
+    /* The logger used in this class.*/
     @Inject
     private Logger logger;
 
+    /* The data repository granting read/write access.*/
     @Inject
     @RepositoryConfig(type=RepositoryType.RW)
     private Repository defaultRepo;
 
+    /* The authentication module.*/
     @Inject
     @AuthenticationConfig(type=AuthenticationType.NONE)
     private Authentication authentication;
 
+    /* The authorization module.*/
     @Inject
     @AuthorizationConfig(type=AuthorizationType.NONE)
     private Authorization authorization;
 
+    /**
+     * Get all probe objects.
+     *
+     * @return Response object containing all probe objects.
+     */
     @GET
     @Path("/")
     @Produces("application/json")
@@ -65,10 +80,14 @@
             logger.debug("User is not authenticated!");
             return new Response(false, 699, null);
         }
-        defaultRepo.setDataSource("land");
-        return defaultRepo.getAll(LProbe.class);
+        return defaultRepo.getAll(LProbe.class, "land");
     }
 
+    /**
+     * Get a probe object by id.
+     *
+     * @return Response object containing a single probe.
+     */
     @GET
     @Path("/{id}")
     @Produces(MediaType.APPLICATION_JSON)
@@ -80,10 +99,14 @@
             logger.debug("User is not authenticated!");
             return new Response(false, 699, null);
         }
-        defaultRepo.setDataSource("land");
-        return defaultRepo.getById(LProbe.class, Integer.valueOf(id));
+        return defaultRepo.getById(LProbe.class, Integer.valueOf(id), "land");
     }
 
+    /**
+     * Create a new probe object.
+     *
+     * @return Response object containing the new probe object.
+     */
     @POST
     @Path("/")
     @Produces(MediaType.APPLICATION_JSON)
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)