changeset 220:f0482fa04e2b

Code documentation and minor code style.
author Raimund Renkert <rrenkert@intevation.de>
date Thu, 04 Jul 2013 13:45:40 +0200
parents 90404d19e75d
children c8cd17181c9f d9d1a46af55d
files src/main/java/de/intevation/lada/authentication/LdapAuthentication.java src/main/java/de/intevation/lada/data/LKommentarMRepository.java src/main/java/de/intevation/lada/data/LKommentarPRepository.java src/main/java/de/intevation/lada/data/LMessungRepository.java src/main/java/de/intevation/lada/data/LMesswertRepository.java src/main/java/de/intevation/lada/data/LOrtRepository.java src/main/java/de/intevation/lada/data/LProbeRepository.java src/main/java/de/intevation/lada/data/LStatusRepository.java src/main/java/de/intevation/lada/data/LZusatzwertRepository.java src/main/java/de/intevation/lada/data/OrtRepository.java src/main/java/de/intevation/lada/data/QueryBuilder.java src/main/java/de/intevation/lada/data/ReadOnlyRepository.java src/main/java/de/intevation/lada/rest/SMessMethodeService.java src/main/java/de/intevation/lada/rest/SStaatService.java
diffstat 14 files changed, 402 insertions(+), 131 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/de/intevation/lada/authentication/LdapAuthentication.java	Thu Jul 04 13:43:11 2013 +0200
+++ b/src/main/java/de/intevation/lada/authentication/LdapAuthentication.java	Thu Jul 04 13:45:40 2013 +0200
@@ -189,5 +189,4 @@
         response.setNetzbetreiber(nb);
         return response;
     }
-
-}
+}
\ No newline at end of file
--- a/src/main/java/de/intevation/lada/data/LKommentarMRepository.java	Thu Jul 04 13:43:11 2013 +0200
+++ b/src/main/java/de/intevation/lada/data/LKommentarMRepository.java	Thu Jul 04 13:45:40 2013 +0200
@@ -18,8 +18,7 @@
 import de.intevation.lada.rest.Response;
 
 /**
- * This Container is an interface to request, filter and select LKommentarM
- * obejcts from the connected database.
+ * This Container is an interface to read, write and update LKommentarM objects.
  * 
  * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a>
  */
@@ -34,7 +33,7 @@
     private EntityManager em;
 
     /**
-     * Manager class for LPRobe. Used to manipulate data objects.
+     * The data manager providing database operations.
      */
     @Inject
     @Named("datamanager")
@@ -46,8 +45,8 @@
     /**
      * Filter object list by the given criteria.
      *
-     * @param criteria
-     * @return List of objects.
+     * @param criteria  The query filter.
+     * @return Response object.
      */
     public <T> Response filter(CriteriaQuery<T> filter) {
         List<T> result = em.createQuery(filter).getResultList();
@@ -58,8 +57,8 @@
     /**
      * Get all objects of type <link>clazz</link>from database.
      *
-     * @param clazz The class type.
-     * @return List of objects.
+     * @param clazz The object type.
+     * @return Response object.
      */
     public <T> Response findAll(Class<T> clazz) {
         CriteriaBuilder builder = em.getCriteriaBuilder();
@@ -73,9 +72,9 @@
     /**
      * Find a single object identified by its id.
      * 
-     * @param clazz The class type.
-     * @param id The object id.
-     * @return The requested object of type clazz
+     * @param clazz The object type.
+     * @param id    The object id.
+     * @return Response object.
      */
     public <T> Response findById(Class<T> clazz, String id) {
         T item = em.find(clazz, id);
@@ -85,7 +84,12 @@
         return new Response(true, 200, item);
     }
 
-    @Override
+    /**
+     * Create a new LKommentarM object.
+     *
+     * @param object    The new object.
+     * @return Response object.
+     */
     public Response create(Object object) {
         if (!(object instanceof LKommentarM)) {
             return new Response(false, 602, object);
@@ -115,7 +119,12 @@
         return response;
     }
 
-    @Override
+    /**
+     * Update a LKommentarM object.
+     *
+     * @param object    The object to update.
+     * @return Response object.
+     */
     public Response update(Object object) {
         if (!(object instanceof LKommentarM)) {
             return new Response(false, 602, object);
@@ -145,7 +154,12 @@
         return response;
     }
 
-    @Override
+    /**
+     * Delete a LKommentarM object.
+     *
+     * @param object    The object to delete
+     * @return Response object.
+     */
     public Response delete(Object object) {
         if (!(object instanceof LKommentarM)) {
             return new Response(false, 602, null);
--- a/src/main/java/de/intevation/lada/data/LKommentarPRepository.java	Thu Jul 04 13:43:11 2013 +0200
+++ b/src/main/java/de/intevation/lada/data/LKommentarPRepository.java	Thu Jul 04 13:45:40 2013 +0200
@@ -18,6 +18,11 @@
 import de.intevation.lada.model.LKommentarP;
 import de.intevation.lada.rest.Response;
 
+/**
+ * This Container is an interface to read, write and update LKommentarP objects.
+ * 
+ * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a>
+ */
 @ApplicationScoped
 @Named("lkommentarRepository")
 public class LKommentarPRepository implements Repository
@@ -28,10 +33,16 @@
     @Inject
     private EntityManager em;
 
+    /**
+     * The data manager providing database operations.
+     */
     @Inject
     @Named("datamanager")
     private Manager manager;
 
+    /**
+     * The logger for this class.
+     */
     @Inject
     private Logger logger;
 
@@ -42,8 +53,8 @@
     /**
      * Filter object list by the given criteria.
      *
-     * @param criteria
-     * @return List of objects.
+     * @param criteria  The query filter.
+     * @return Response object.
      */
     public <T> Response filter(CriteriaQuery<T> filter) {
         List<T> result = em.createQuery(filter).getResultList();
@@ -54,34 +65,39 @@
     /**
      * Get all objects of type <link>clazz</link>from database.
      *
-    * @param clazz The class type.
-    * @return List of objects.
-    */
-   public <T> Response findAll(Class<T> clazz) {
-       CriteriaBuilder builder = em.getCriteriaBuilder();
-       CriteriaQuery<T> criteria = builder.createQuery(clazz);
-       Root<T> member = criteria.from(clazz);
-       criteria.select(member);
-       List<T> result = em.createQuery(criteria).getResultList();
-       return new Response(true, 200, result);
-   }
+     * @param clazz The object type.
+     * @return Response object.
+     */
+    public <T> Response findAll(Class<T> clazz) {
+        CriteriaBuilder builder = em.getCriteriaBuilder();
+        CriteriaQuery<T> criteria = builder.createQuery(clazz);
+        Root<T> member = criteria.from(clazz);
+        criteria.select(member);
+        List<T> result = em.createQuery(criteria).getResultList();
+        return new Response(true, 200, result);
+    }
 
-   /**
-    * Find a single object identified by its id.
-    * 
-    * @param clazz The class type.
-    * @param id The object id.
-    * @return The requested object of type clazz
-    */
-   public <T> Response findById(Class<T> clazz, String id) {
-       T item = em.find(clazz, id);
-       if (item == null) {
-           return new Response(false, 600, null);
-       }
-       return new Response(true, 200, item);
-   }
+    /**
+     * Find a single object identified by its id.
+     * 
+     * @param clazz The object type.
+     * @param id    The object id.
+     * @return Response object.
+     */
+    public <T> Response findById(Class<T> clazz, String id) {
+        T item = em.find(clazz, id);
+        if (item == null) {
+            return new Response(false, 600, null);
+        }
+        return new Response(true, 200, item);
+    }
 
-
+    /**
+     * Create a new LKommentarP object.
+     *
+     * @param object    The new object.
+     * @return Response object.
+     */
     public Response create(Object object) {
         if (!(object instanceof LKommentarP)) {
             return new Response(false, 602, object);
@@ -111,6 +127,12 @@
         return response;
     }
 
+    /**
+     * Update a LKommentarP object.
+     *
+     * @param object    The object to update.
+     * @return Response object.
+     */
     public Response update(Object object) {
         if (!(object instanceof LKommentarP)) {
             return new Response(false, 602, object);
@@ -140,6 +162,12 @@
         return response;
     }
 
+    /**
+     * Delete a LKommentarP object.
+     *
+     * @param object    The object to delete.
+     * @return Response object.
+     */
     public Response delete(Object object) {
         if (!(object instanceof LKommentarP)) {
             return new Response(false, 602, null);
--- a/src/main/java/de/intevation/lada/data/LMessungRepository.java	Thu Jul 04 13:43:11 2013 +0200
+++ b/src/main/java/de/intevation/lada/data/LMessungRepository.java	Thu Jul 04 13:45:40 2013 +0200
@@ -21,8 +21,7 @@
 import de.intevation.lada.validation.Validator;
 
 /**
- * This Container is an interface to request, filter and select LMessung
- * obejcts from the connected database.
+ * This Container is an interface to read, write and update LMessung obejcts.
  * 
  * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a>
  */
@@ -37,12 +36,15 @@
     private EntityManager em;
 
     /**
-     * Manager class for LPRobe. Used to manipulate data objects.
+     * The data manager providing database operations.
      */
     @Inject
     @Named("datamanager")
     private Manager manager;
 
+    /**
+     * The validator used for LMessung objects.
+     */
     @Inject
     @Named("lmessungvalidator")
     private Validator validator;
@@ -54,8 +56,8 @@
     /**
      * Filter object list by the given criteria.
      *
-     * @param criteria
-     * @return List of objects.
+     * @param criteria  The query filter.
+     * @return Response opbject.
      */
     public <T> Response filter(CriteriaQuery<T> filter) {
         List<T> result = em.createQuery(filter).getResultList();
@@ -66,8 +68,8 @@
     /**
      * Get all objects of type <link>clazz</link>from database.
      *
-     * @param clazz The class type.
-     * @return List of objects.
+     * @param clazz The object type.
+     * @return Response object.
      */
     public <T> Response findAll(Class<T> clazz) {
         CriteriaBuilder builder = em.getCriteriaBuilder();
@@ -81,9 +83,9 @@
     /**
      * Find a single object identified by its id.
      * 
-     * @param clazz The class type.
-     * @param id The object id.
-     * @return The requested object of type clazz
+     * @param clazz The object type.
+     * @param id    The object id.
+     * @return Response object.
      */
     public <T> Response findById(Class<T> clazz, String id) {
         T item = em.find(clazz, id);
@@ -94,10 +96,10 @@
     }
 
     /**
-     * Validate and persist a new LProbe object.
+     * Validate and persist a new LMessung object.
      *
-     * @param probe The new LProbe object
-     * @return Response.
+     * @param probe The new object
+     * @return Response object.
      */
     public Response create(Object object) {
         if (!(object instanceof LMessung)) {
@@ -105,7 +107,6 @@
         }
         LMessung messung = (LMessung)object;
         Response response = new Response(true, 200, messung);
-        // Try to save the new LMessung.
         try {
             Map<String, Integer> warnings = validator.validate(messung);
             manager.create(messung);
@@ -137,6 +138,12 @@
         return response;
     }
 
+    /**
+     * Update a LMessung object.
+     *
+     * @param object    The object to update
+     * @return Response object.
+     */
     public Response update(Object object) {
         if (!(object instanceof LMessung)) {
             return new Response(false, 602, object);
@@ -175,9 +182,12 @@
         return response;
     }
 
-    @Override
+    /**
+     * This class does not support this operation.
+     *
+     * @param object
+     */
     public Response delete(Object object) {
-        // TODO Auto-generated method stub
         return null;
     }
 }
--- a/src/main/java/de/intevation/lada/data/LMesswertRepository.java	Thu Jul 04 13:43:11 2013 +0200
+++ b/src/main/java/de/intevation/lada/data/LMesswertRepository.java	Thu Jul 04 13:45:40 2013 +0200
@@ -18,8 +18,7 @@
 import de.intevation.lada.rest.Response;
 
 /**
- * This Container is an interface to request, filter and select LMesswert
- * obejcts from the connected database.
+ * This Container is an interface to read, write and update LMesswert obejcts.
  * 
  * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a>
  */
@@ -34,7 +33,7 @@
     private EntityManager em;
 
     /**
-     * Manager class for LPRobe. Used to manipulate data objects.
+     * The data manager providing database operations.
      */
     @Inject
     @Named("datamanager")
@@ -46,8 +45,8 @@
     /**
      * Filter object list by the given criteria.
      *
-     * @param criteria
-     * @return List of objects.
+     * @param criteria  The query filter.
+     * @return Response object.
      */
     public <T> Response filter(CriteriaQuery<T> filter) {
         List<T> result = em.createQuery(filter).getResultList();
@@ -58,8 +57,8 @@
     /**
      * Get all objects of type <link>clazz</link>from database.
      *
-     * @param clazz The class type.
-     * @return List of objects.
+     * @param clazz The object type.
+     * @return Response object.
      */
     public <T> Response findAll(Class<T> clazz) {
         CriteriaBuilder builder = em.getCriteriaBuilder();
@@ -73,9 +72,9 @@
     /**
      * Find a single object identified by its id.
      * 
-     * @param clazz The class type.
-     * @param id The object id.
-     * @return The requested object of type clazz
+     * @param clazz The object type.
+     * @param id    The object id.
+     * @return Response object.
      */
     public <T> Response findById(Class<T> clazz, String id) {
         T item = em.find(clazz, id);
@@ -85,13 +84,18 @@
         return new Response(true, 200, item);
     }
 
+    /**
+     * Create a new LMesswert object.
+     *
+     * @param object The new object.
+     * @return Response object.
+     */
     public Response create(Object object) {
         if (!(object instanceof LMesswert)) {
             return new Response(false, 602, object);
         }
         LMesswert messwert = (LMesswert)object;
         Response response = new Response(true, 200, messwert);
-        // Try to save the new LProbe.
         try {
             manager.create(messwert);
             return response;
@@ -115,13 +119,18 @@
         return response;
     }
 
+    /**
+     * Update a LMesswert object.
+     *
+     * @param object The object to update.
+     * @return Response object.
+     */
     public Response update(Object object) {
         if (!(object instanceof LMesswert)) {
             return new Response(false, 602, object);
         }
         LMesswert messwert = (LMesswert)object;
         Response response = new Response(true, 200, messwert);
-        // Try to save the new LProbe.
         try {
             manager.update(messwert);
             return response;
@@ -145,8 +154,12 @@
         return response;
     }
 
+    /**
+     * This class does not support this operation.
+     *
+     * @param object.
+     */
     public Response delete(Object object) {
-        // TODO Auto-generated method stub
         return null;
     }
 }
\ No newline at end of file
--- a/src/main/java/de/intevation/lada/data/LOrtRepository.java	Thu Jul 04 13:43:11 2013 +0200
+++ b/src/main/java/de/intevation/lada/data/LOrtRepository.java	Thu Jul 04 13:45:40 2013 +0200
@@ -20,6 +20,11 @@
 import de.intevation.lada.validation.ValidationException;
 import de.intevation.lada.validation.Validator;
 
+/**
+ * This Container is an interface to read, write and update LOrt objects.
+ * 
+ * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a>
+ */
 @ApplicationScoped
 @Named("lortrepository")
 public class LOrtRepository implements Repository
@@ -30,10 +35,16 @@
     @Inject
     private EntityManager em;
 
+    /**
+     * The validator used for LOrt objects.
+     */
     @Inject
     @Named("lortvalidator")
     private Validator validator;
 
+    /**
+     * The data manager providing database operations.
+     */
     @Inject
     @Named("datamanager")
     private Manager manager;
@@ -46,8 +57,8 @@
     /**
      * Filter object list by the given criteria.
      *
-     * @param criteria
-     * @return List of objects.
+     * @param criteria  The query filter.
+     * @return Response object.
      */
     public <T> Response filter(CriteriaQuery<T> filter) {
         List<T> result = em.createQuery(filter).getResultList();
@@ -57,8 +68,8 @@
     /**
      * Get all objects of type <link>clazz</link>from database.
      *
-     * @param clazz The class type.
-     * @return List of objects.
+     * @param clazz The object type.
+     * @return Response object.
      */
     public <T> Response findAll(Class<T> clazz) {
         CriteriaBuilder builder = em.getCriteriaBuilder();
@@ -72,9 +83,9 @@
     /**
      * Find a single object identified by its id.
      *
-     * @param clazz The class type.
-     * @param id The object id.
-     * @return The requested object of type clazz
+     * @param clazz The object type.
+     * @param id    The object id.
+     * @return Response object.
      */
     public <T> Response findById(Class<T> clazz, String id) {
         T item = em.find(clazz, id);
@@ -85,10 +96,10 @@
     }
 
     /**
-     * Validate and persist a new LProbe object.
+     * Validate and persist a new LOrt object.
      *
-     * @param probe The new LProbe object
-     * @return Response.
+     * @param object    The new object
+     * @return Response object.
      */
     public Response create(Object object) {
         if (!(object instanceof LOrt)) {
@@ -128,6 +139,12 @@
         return response;
     }
 
+    /**
+     * Validate and update a LOrt object.
+     *
+     * @param object    The object to update.
+     * @return Response object.
+     */
     public Response update(Object object) {
         if (!(object instanceof LOrt)) {
             return new Response(false, 600, object);
@@ -166,7 +183,12 @@
         return response;
     }
 
-    @Override
+    /**
+     * Delete a LOrt object.
+     *
+     * @param object    The object to delete.
+     * @return Response object.
+     */
     public Response delete(Object object) {
         if (!(object instanceof LOrt)) {
             return new Response(false, 602, null);
--- a/src/main/java/de/intevation/lada/data/LProbeRepository.java	Thu Jul 04 13:43:11 2013 +0200
+++ b/src/main/java/de/intevation/lada/data/LProbeRepository.java	Thu Jul 04 13:45:40 2013 +0200
@@ -20,8 +20,7 @@
 import de.intevation.lada.validation.Validator;
 
 /**
- * This Container is an interface to request, filter and select LProbe
- * obejcts from the connected database.
+ * This Container is an interface to read, write and update LProbe objects.
  * 
  * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a>
  */
@@ -35,12 +34,15 @@
     private EntityManager em;
 
     /**
-     * Manager class for LPRobe. Used to manipulate data objects.
+     * The data manager providing database operations.
      */
     @Inject
     @Named("datamanager")
     private Manager manager;
 
+    /**
+     * The validator used for LProbe objects.
+     */
     @Inject
     @Named("lprobevalidator")
     private Validator validator;
@@ -48,17 +50,24 @@
     public EntityManager getEntityManager() {
         return this.em;
     }
+
     /**
      * Filter object list by the given criteria.
      *
-     * @param criteria
-     * @return List of objects.
+     * @param criteria  The query filter
+     * @return Response object.
      */
     public <T> Response filter(CriteriaQuery<T> filter) {
         List<T> result = em.createQuery(filter).getResultList();
         return new Response(true, 200, result);
     }
 
+    /**
+     * Get all objects.
+     *
+     * @param clazz The object type. (unused)
+     * @return Response object.
+     */
     public <T> Response findAll(Class<T> clazz) {
         QueryBuilder<LProbeInfo> builder =
             new QueryBuilder<LProbeInfo>(this.getEntityManager(), LProbeInfo.class);
@@ -66,6 +75,13 @@
         return filter(builder.getQuery());
     }
 
+    /**
+     * Find object identified by its id.
+     *
+     * @param clazz The object type.(unused)
+     * @param id    The object id.
+     * @return Response object.
+     */
     public <T> Response findById(Class<T> clazz, String id) {
         QueryBuilder<LProbeInfo> builder =
             new QueryBuilder<LProbeInfo>(this.getEntityManager(), LProbeInfo.class);
@@ -118,13 +134,18 @@
         return response;
     }
 
+    /**
+     * Validate and update a LProbe object.
+     *
+     * @param object    The object to update.
+     * @return Response object.
+     */
     public Response update(Object object) {
         if (!(object instanceof LProbe)) {
             return new Response(false, 602, object);
         }
         LProbe probe = (LProbe)object;
         Response response = new Response(true, 200, probe);
-        // Try to save the new LProbe.
         try {
             Map<String, Integer> warnings = validator.validate(probe);
             manager.update(probe);
@@ -156,7 +177,11 @@
         return response;
     }
 
-    @Override
+    /**
+     * This class does not support this operation.
+     *
+     * @param object
+     */
     public Response delete(Object object) {
         return null;
     }
--- a/src/main/java/de/intevation/lada/data/LStatusRepository.java	Thu Jul 04 13:43:11 2013 +0200
+++ b/src/main/java/de/intevation/lada/data/LStatusRepository.java	Thu Jul 04 13:45:40 2013 +0200
@@ -18,8 +18,8 @@
 import de.intevation.lada.rest.Response;
 
 /**
- * This Container is an interface to request, filter and select LMesswert
- * obejcts from the connected database.
+ * This Container is an interface to read, write and update LStatus
+ * objects from the connected database.
  * 
  * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a>
  */
@@ -34,7 +34,7 @@
     private EntityManager em;
 
     /**
-     * Manager class for LPRobe. Used to manipulate data objects.
+     * The data manager providing database operations.
      */
     @Inject
     @Named("datamanager")
@@ -47,8 +47,8 @@
     /**
      * Filter object list by the given criteria.
      *
-     * @param criteria
-     * @return List of objects.
+     * @param criteria  The query filter.
+     * @return Response object.
      */
     public <T> Response filter(CriteriaQuery<T> filter) {
         List<T> result = em.createQuery(filter).getResultList();
@@ -59,8 +59,8 @@
     /**
      * Get all objects of type <link>clazz</link>from database.
      *
-     * @param clazz The class type.
-     * @return List of objects.
+     * @param clazz     The object type.
+     * @return Response object.
      */
     public <T> Response findAll(Class<T> clazz) {
         CriteriaBuilder builder = em.getCriteriaBuilder();
@@ -74,9 +74,9 @@
     /**
      * Find a single object identified by its id.
      * 
-     * @param clazz The class type.
-     * @param id The object id.
-     * @return The requested object of type clazz
+     * @param clazz The object type.
+     * @param id    The object id.
+     * @return Response object.
      */
     public <T> Response findById(Class<T> clazz, String id) {
         T item = em.find(clazz, id);
@@ -86,13 +86,18 @@
         return new Response(true, 200, item);
     }
 
+    /**
+     * Create a new LStatus object.
+     *
+     * @param object    The new object.
+     * @return Response object.
+     */
     public Response create(Object object) {
         if (!(object instanceof LStatus)) {
             return new Response(false, 602, object);
         }
         LStatus status = (LStatus)object;
         Response response = new Response(true, 200, status);
-        // Try to save the new LProbe.
         try {
             manager.create(status);
             return response;
@@ -116,6 +121,12 @@
         return response;
     }
 
+    /**
+     * Update a Lstatus object.
+     *
+     * @param object    The object to update.
+     * @return Response object.
+     */
     public Response update(Object object) {
         if (!(object instanceof LStatus)) {
             return new Response(false, 602, object);
@@ -145,6 +156,11 @@
         return response;
     }
 
+    /**
+     * This class does not support this operation.
+     *
+     * @param object
+     */
     public Response delete(Object object) {
         return null;
     }
--- a/src/main/java/de/intevation/lada/data/LZusatzwertRepository.java	Thu Jul 04 13:43:11 2013 +0200
+++ b/src/main/java/de/intevation/lada/data/LZusatzwertRepository.java	Thu Jul 04 13:45:40 2013 +0200
@@ -19,8 +19,8 @@
 import de.intevation.lada.rest.Response;
 
 /**
- * This Container is an interface to request, filter and select LZusatzWert
- * obejcts from the connected database.
+ * This Container is an interface to read, write and update LZusatzWert
+ * objects from the connected database.
  * 
  * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a>
  */
@@ -35,7 +35,7 @@
     private EntityManager em;
 
     /**
-     * Manager class for LPRobe. Used to manipulate data objects.
+     * The data manager providing database operations.
      */
     @Inject
     @Named("datamanager")
@@ -44,11 +44,12 @@
     public EntityManager getEntityManager() {
         return this.em;
     }
+
     /**
      * Filter object list by the given criteria.
      *
-     * @param criteria
-     * @return List of objects.
+     * @param criteria  The query filter.
+     * @return Response object.
      */
     public <T> Response filter(CriteriaQuery<T> filter) {
         List<T> result = em.createQuery(filter).getResultList();
@@ -59,8 +60,8 @@
     /**
      * Get all objects of type <link>clazz</link>from database.
      *
-     * @param clazz The class type.
-     * @return List of objects.
+     * @param clazz     The object type.
+     * @return Response object.
      */
     public <T> Response findAll(Class<T> clazz) {
         CriteriaBuilder builder = em.getCriteriaBuilder();
@@ -74,9 +75,9 @@
     /**
      * Find a single object identified by its id.
      * 
-     * @param clazz The class type.
-     * @param id The object id.
-     * @return The requested object of type clazz
+     * @param clazz     The object type.
+     * @param id        The object id.
+     * @return Response object.
      */
     public <T> Response findById(Class<T> clazz, String id) {
         T item = em.find(clazz, id);
@@ -86,6 +87,12 @@
         return new Response(true, 200, item);
     }
 
+    /**
+     * Create a new LZusatzwert object.
+     *
+     * @param object    The new object.
+     * @return Response object.
+     */
     public Response create(Object object) {
         if (!(object instanceof LZusatzWert)) {
             return new Response(false, 602, object);
@@ -121,6 +128,12 @@
         return response;
     }
 
+    /**
+     * Update a LZusatzwert object.
+     *
+     * @param object    The object to update.
+     * @return Response object.
+     */
     public Response update(Object object) {
         if (!(object instanceof LZusatzWert)) {
             return new Response(false, 602, object);
@@ -154,6 +167,12 @@
         return response;
     }
 
+    /**
+     * Delete a LZusatzwert object.
+     *
+     * @param object    The object to delete.
+     * @return Response object.
+     */
     public Response delete(Object object) {
         if (!(object instanceof LZusatzWert)) {
             return new Response(false, 602, null);
--- a/src/main/java/de/intevation/lada/data/OrtRepository.java	Thu Jul 04 13:43:11 2013 +0200
+++ b/src/main/java/de/intevation/lada/data/OrtRepository.java	Thu Jul 04 13:45:40 2013 +0200
@@ -17,6 +17,11 @@
 import de.intevation.lada.model.Ort;
 import de.intevation.lada.rest.Response;
 
+/**
+ * Repository that allows read, write and update operations on 'Ort' objects.
+ * 
+ * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a>
+ */
 @ApplicationScoped
 @Named("ortrepository")
 public class OrtRepository implements Repository
@@ -27,6 +32,9 @@
     @Inject
     private EntityManager em;
 
+    /**
+     * THe data manager providing database operations.
+     */
     @Inject
     @Named("datamanager")
     private Manager manager;
@@ -38,8 +46,8 @@
     /**
      * Filter object list by the given criteria.
      *
-     * @param criteria
-     * @return List of objects.
+     * @param criteria  The query filter.
+     * @return Response object.
      */
     public <T> Response filter(CriteriaQuery<T> filter) {
         List<T> result = em.createQuery(filter).getResultList();
@@ -50,8 +58,8 @@
     /**
      * Get all objects of type <link>clazz</link>from database.
      *
-     * @param clazz The class type.
-     * @return List of objects.
+     * @param clazz The object type.
+     * @return Response object
      */
     public <T> Response findAll(Class<T> clazz) {
         CriteriaBuilder builder = em.getCriteriaBuilder();
@@ -65,9 +73,9 @@
     /**
      * Find a single object identified by its id.
      * 
-     * @param clazz The class type.
-     * @param id The object id.
-     * @return The requested object of type clazz
+     * @param clazz     The object type.
+     * @param id        The object id.
+     * @return Response object.
      */
     public <T> Response findById(Class<T> clazz, String id) {
         T item = em.find(clazz, id);
@@ -77,6 +85,12 @@
         return new Response(true, 200, item);
     }
 
+    /**
+     * Create a new 'Ort' object.
+     *
+     * @param object    The new object.
+     * @return Response object.
+     */
     public Response create(Object object) {
         if (!(object instanceof Ort)) {
             return new Response(false, 602, object);
@@ -97,6 +111,12 @@
         }
     }
 
+    /**
+     * Update a 'Ort' object.
+     *
+     * @param object    The object to update.
+     * @return Response object.
+     */
     public Response update(Object object) {
         if (!(object instanceof Ort)) {
             return new Response(false, 602, object);
@@ -126,6 +146,12 @@
         return response;
     }
 
+    /**
+     * Delete a 'Ort' object.
+     *
+     * @param object    The object to delete.
+     * @return Response object.
+     */
     public Response delete(Object object) {
         if (!(object instanceof Ort)) {
             return new Response(false, 602, null);
--- a/src/main/java/de/intevation/lada/data/QueryBuilder.java	Thu Jul 04 13:43:11 2013 +0200
+++ b/src/main/java/de/intevation/lada/data/QueryBuilder.java	Thu Jul 04 13:45:40 2013 +0200
@@ -8,6 +8,9 @@
 import javax.persistence.criteria.Predicate;
 import javax.persistence.criteria.Root;
 
+/**
+ * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a>
+ */
 public class QueryBuilder<T>
 {
     private EntityManager manager;
@@ -17,6 +20,12 @@
     private Class<T> clazz;
     private Predicate filter;
 
+    /**
+     * Create a new QueryBuilder for the specified class.
+     *
+     * @param manager
+     * @param clazz
+     */
     public QueryBuilder(EntityManager manager, Class<T> clazz) {
         this.manager = manager;
         this.clazz = clazz;
@@ -25,11 +34,23 @@
         this.root = this.query.from(this.clazz);
     }
 
+    /**
+     * Get the criteria query build with this class.
+     *
+     * @return The query.
+     */
     public CriteriaQuery<T> getQuery() {
         this.query.where(this.filter);
         return this.query;
     }
 
+    /**
+     * Logical AND operation.
+     *
+     * @param id    The database column name.
+     * @param value The filter value
+     * @return The builder itself.
+     */
     public QueryBuilder<T> and(String id, String value) {
         Predicate p = this.builder.equal(this.root.get(id), value);
         if (this.filter != null) {
@@ -41,6 +62,13 @@
         return this;
     }
 
+    /**
+     * Logical OR operation.
+     *
+     * @param id    The database column name
+     * @param value The filter value.
+     * @return The builder itself.
+     */
     public QueryBuilder<T> or(String id, String value) {
         Predicate p = this.builder.equal(this.root.get(id), value);
         if (this.filter != null) {
@@ -52,6 +80,14 @@
         return this;
     }
 
+    /**
+     * Logical AND operation.
+     * All elements in <i>values</i> will be concatenated with AND operator.
+     *
+     * @param id        The database column name.
+     * @param values    List of values.
+     * @return The builder itself.
+     */
     public QueryBuilder<T> and(String id, List<String> values) {
         for(String v: values) {
             this.and(id, v);
@@ -59,6 +95,14 @@
         return this;
     }
 
+    /**
+     * Logical OR operation.
+     * All elements in <i>values</i> will be concatenated with OR operator.
+     *
+     * @param id        The database column name.
+     * @param values    List of values.
+     * @return The builder itself.
+     */
     public QueryBuilder<T> or(String id, List<String> values) {
         for (String v: values) {
             this.or(id, v);
@@ -66,6 +110,14 @@
         return this;
     }
 
+    /**
+     * Logical AND operation.
+     * The actually defined query will be concatenated with the query defined
+     * in the builder <i>b</i>.
+     *
+     * @param b     A builder.
+     * @return The builder itself.
+     */
     public QueryBuilder<T> and(QueryBuilder<T> b) {
         if (b == null || b.filter == null) {
             return this;
@@ -79,6 +131,14 @@
         return this;
     }
 
+    /**
+     * Logical OR operation.
+     * The actually defined query will be concatenated with the query defined
+     * in the builder <i>b</i>.
+     *
+     * @param b     A builder.
+     * @return The builder itself.
+     */
     public QueryBuilder<T> or(QueryBuilder<T> b) {
         if (b == null || b.filter == null) {
             return this;
@@ -92,10 +152,19 @@
         return this;
     }
 
+    /**
+     * Use 'distinct' in the query.
+     */
     public void distinct() {
         this.query.distinct(true);
     }
 
+    /**
+     * Order result by the specified column name
+     *
+     * @param id    The column name.
+     * @param asc   Ascending(true), Descending(false).
+     */
     public void orderBy(String id, boolean asc) {
         if (asc) {
             this.query.orderBy(this.builder.asc(this.root.get(id)));
@@ -105,10 +174,15 @@
         }
     }
 
+    /**
+     * Get an empty instance of this builder to create subfilters.
+     *
+     * @return An empty instance of this builder.
+     */
     public QueryBuilder<T> getEmptyBuilder(){
         QueryBuilder<T> copy = new QueryBuilder<T>(manager, clazz);
         copy.builder = this.builder;
         copy.root = this.root;
         return copy;
     }
-}
+}
\ No newline at end of file
--- a/src/main/java/de/intevation/lada/data/ReadOnlyRepository.java	Thu Jul 04 13:43:11 2013 +0200
+++ b/src/main/java/de/intevation/lada/data/ReadOnlyRepository.java	Thu Jul 04 13:45:40 2013 +0200
@@ -12,6 +12,11 @@
 
 import de.intevation.lada.rest.Response;
 
+/**
+ * Repository that allows read only access to model objects.
+ * 
+ * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a>
+ */
 @ApplicationScoped
 @Named("readonlyrepository")
 public class ReadOnlyRepository implements Repository
@@ -29,8 +34,8 @@
     /**
      * Filter object list by the given criteria.
      *
-     * @param criteria
-     * @return List of objects.
+     * @param criteria  The filter query.
+     * @return Response object.
      */
     public <T> Response filter(CriteriaQuery<T> filter) {
         List<T> result = em.createQuery(filter).getResultList();
@@ -40,8 +45,8 @@
     /**
      * Get all objects of type <link>clazz</link>from database.
      *
-     * @param clazz The class type.
-     * @return List of objects.
+     * @param clazz     The object type.
+     * @return Response object.
      */
     public <T> Response findAll(Class<T> clazz) {
         CriteriaBuilder builder = em.getCriteriaBuilder();
@@ -55,9 +60,9 @@
     /**
      * Find a single object identified by its id.
      * 
-     * @param clazz The class type.
-     * @param id The object id.
-     * @return The requested object of type clazz
+     * @param clazz     The object type.
+     * @param id        The object id.
+     * @return Response object.
      */
     public <T> Response findById(Class<T> clazz, String id) {
         T item = em.find(clazz, id);
@@ -67,15 +72,30 @@
         return new Response(true, 200, item);
     }
 
+    /**
+     * This class does not support this operation.
+     *
+     * @param object
+     */
     public Response create(Object object) {
         return null;
     }
 
+    /**
+     * This class does not support this operation.
+     *
+     * @param object
+     */
     public Response update(Object object) {
         return null;
     }
 
+    /**
+     * This class does not support this operation.
+     *
+     * @param object
+     */
     public Response delete(Object object) {
         return null;
     }
-}
+}
\ No newline at end of file
--- a/src/main/java/de/intevation/lada/rest/SMessMethodeService.java	Thu Jul 04 13:43:11 2013 +0200
+++ b/src/main/java/de/intevation/lada/rest/SMessMethodeService.java	Thu Jul 04 13:45:40 2013 +0200
@@ -17,12 +17,17 @@
 import de.intevation.lada.data.Repository;
 import de.intevation.lada.model.SMessMethode;
 
+/**
+ * This class produces a RESTful service to read SMessMethode objects.
+ * 
+ * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a>
+ */
 @Path("/messmethode")
 @RequestScoped
 public class SMessMethodeService
 {
     /**
-     * The Repository for SUmwelt.
+     * The Repository for SMessMethode.
      */
     @Inject
     @Named("readonlyrepository")
@@ -36,7 +41,7 @@
     private Authentication authentication;
 
     /**
-     * Request all SStaat objects.
+     * Request all SMessMethode objects.
      *
      * @param headers   The HTTP header containing authorization information.
      * @return Response object.
@@ -56,7 +61,7 @@
     }
 
     /**
-     * Request a SStaat object via its id.
+     * Request a SMessMethode object via its id.
      *
      * @param id The object id.
      * @param headers   The HTTP header containing authorization information.
--- a/src/main/java/de/intevation/lada/rest/SStaatService.java	Thu Jul 04 13:43:11 2013 +0200
+++ b/src/main/java/de/intevation/lada/rest/SStaatService.java	Thu Jul 04 13:45:40 2013 +0200
@@ -27,7 +27,7 @@
 public class SStaatService
 {
     /**
-     * The Repository for SUmwelt.
+     * The Repository for SStaat.
      */
     @Inject
     @Named("readonlyrepository")
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)