changeset 39:e0a5477f657e

Documentation.
author Raimund Renkert <rrenkert@intevation.de>
date Thu, 23 May 2013 15:29:13 +0200
parents c20674399ad7
children 0dd63fcc9581
files src/main/java/de/intevation/lada/data/LProbeRepository.java src/main/java/de/intevation/lada/data/SMessstelleRepository.java src/main/java/de/intevation/lada/data/SUmweltRepository.java src/main/java/de/intevation/lada/rest/LProbeRESTService.java src/main/java/de/intevation/lada/rest/SMessstelleRESTService.java src/main/java/de/intevation/lada/rest/SUmweltRESTService.java
diffstat 6 files changed, 146 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/de/intevation/lada/data/LProbeRepository.java	Thu May 23 14:50:02 2013 +0200
+++ b/src/main/java/de/intevation/lada/data/LProbeRepository.java	Thu May 23 15:29:13 2013 +0200
@@ -1,19 +1,3 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2012, Red Hat, Inc. and/or its affiliates, and individual
- * contributors by the @authors tag. See the copyright.txt in the 
- * distribution for a full listing of individual contributors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,  
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
 package de.intevation.lada.data;
 
 import java.util.Date;
@@ -32,30 +16,46 @@
 import de.intevation.lada.model.LProbe;
 import de.intevation.lada.service.LProbeService;
 
+/**
+ * This Container is an interface to request, filter and select LProbe
+ * obejcts from the connected database.
+ * 
+ * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a>
+ */
 @ApplicationScoped
 public class LProbeRepository {
 
+    /**
+     * The entitymanager managing the data.
+     */
     @Inject
     @PersistenceContext(type=PersistenceContextType.EXTENDED)
     private EntityManager em;
 
+    /**
+     * Service class for LPRobe. Used to manipulate data objects.
+     */
     @Inject
     private LProbeService service;
 
+    /**
+     * Find a single LProbe object identified by its id.
+     *
+     * @param id The mst_id
+     * @return The SMessStelle object.
+     */
     public LProbe findById(String id) {
         return em.find(LProbe.class, id);
     }
 
-    public void delete(LProbe item) {
-        try {
-            service.delete(item.getProbeId());
-        }
-        catch (Exception e) {
-             // TODO Auto-generated catch block
-            e.printStackTrace();
-        }
-    }
-
+    /**
+     * Filter for LProbe objects.
+     *
+     * @param mstId mst_id
+     * @param uwbId umw_id
+     * @param begin probeentnahmebegin
+     * @return
+     */
     public List<LProbe> filter(String mstId, String uwbId, Long begin) {
         CriteriaBuilder cb = em.getCriteriaBuilder();
         CriteriaQuery<LProbe> criteria = cb.createQuery(LProbe.class);
@@ -91,6 +91,11 @@
         return em.createQuery(criteria).getResultList();
     }
 
+    /**
+     * Get all LProbe objects from database.
+     *
+     * @return List of LProbe objects.
+     */
     public List<LProbe> findAll() {
         CriteriaBuilder cb = em.getCriteriaBuilder();
         CriteriaQuery<LProbe> criteria = cb.createQuery(LProbe.class);
--- a/src/main/java/de/intevation/lada/data/SMessstelleRepository.java	Thu May 23 14:50:02 2013 +0200
+++ b/src/main/java/de/intevation/lada/data/SMessstelleRepository.java	Thu May 23 15:29:13 2013 +0200
@@ -11,13 +11,27 @@
 
 import de.intevation.lada.model.SMessStelle;
 
-
+/**
+ * This Container is an interface to request, filter and select SMessStelle
+ * obejcts from the connected database.
+ * 
+ * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a>
+ */
 @ApplicationScoped
 public class SMessstelleRepository
 {
+
+    /**
+     * The entitymanager managing the data.
+     */
     @Inject
     EntityManager em;
 
+    /**
+     * Get all SMessStelle object from database.
+     *
+     * @return List of SMessStelle objects.
+     */
     public List<SMessStelle> findAll() {
         CriteriaBuilder builder = em.getCriteriaBuilder();
         CriteriaQuery<SMessStelle> criteria = builder.createQuery(SMessStelle.class);
@@ -26,6 +40,12 @@
         return em.createQuery(criteria).getResultList();
     }
 
+    /**
+     * Find a single SMessStelle object identified by its id.
+     *
+     * @param id The mst_id
+     * @return The SMessStelle object.
+     */
     public SMessStelle findById(String id) {
         return em.find(SMessStelle.class, id);
     }
--- a/src/main/java/de/intevation/lada/data/SUmweltRepository.java	Thu May 23 14:50:02 2013 +0200
+++ b/src/main/java/de/intevation/lada/data/SUmweltRepository.java	Thu May 23 15:29:13 2013 +0200
@@ -11,12 +11,26 @@
 
 import de.intevation.lada.model.SUmwelt;
 
+/**
+ * This Container is an interface to request, filter and select LProbe
+ * obejcts from the connected database.
+ * 
+ * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a>
+ */
 @ApplicationScoped
 public class SUmweltRepository {
 
+    /**
+     * The entitymanager managing the data.
+     */
     @Inject
     EntityManager em;
 
+    /**
+     * Get all SUmwelt objects from database.
+     *
+     * @return List of LProbe objects.
+     */
     public List<SUmwelt> findAll() {
         CriteriaBuilder builder = em.getCriteriaBuilder();
         CriteriaQuery<SUmwelt> criteria = builder.createQuery(SUmwelt.class);
@@ -25,6 +39,12 @@
         return em.createQuery(criteria).getResultList();
     }
 
+    /**
+     * Find a single SUmwelt object identified by its id.
+     *
+     * @param id The mst_id
+     * @return The SMessStelle object.
+     */
     public SUmwelt findById(String id) {
         return em.find(SUmwelt.class, id);
     }
--- a/src/main/java/de/intevation/lada/rest/LProbeRESTService.java	Thu May 23 14:50:02 2013 +0200
+++ b/src/main/java/de/intevation/lada/rest/LProbeRESTService.java	Thu May 23 15:29:13 2013 +0200
@@ -20,21 +20,32 @@
 import de.intevation.lada.service.LProbeService;
 
 /**
- * JAX-RS Example
- *
- * This class produces a RESTful service to read the contents of the members table.
-*/
-
+ * This class produces a RESTful service to read the contents of LProbe table.
+ * 
+ * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a>
+ */
 @Path("/proben")
 @RequestScoped
 public class LProbeRESTService {
 
+    /**
+     * The Repository for LProbe.
+     */
     @Inject
     private LProbeRepository repository;
 
+    /**
+     * The logger for this class.
+     */
     @Inject
     private Logger log;
 
+    /**
+     * Request a LProbe via its id.
+     *
+     * @param id The LProbe id
+     * @return JSON Object via REST service.
+     */
     @GET
     @Path("/{id}")
     @Produces("text/json")
@@ -42,6 +53,18 @@
        return repository.findById(id);
     }
 
+    /**
+     * Request LProbe via a filter.
+     *
+     * Query parameters are used for the filter in form of key-value pairs.
+     * This filter can take the three parameters
+     *   mst=$MSTID (String)
+     *   uwb=$UWBID (String)
+     *   begin=$PROBEENTNAHMEBEGIN (Timestamp)
+     *
+     * @param info The URL query parameters.
+     * @return JSON Object via Rest service.
+     */
     @GET
     @Produces("text/json")
     public List<LProbe> filter(@Context UriInfo info) {
--- a/src/main/java/de/intevation/lada/rest/SMessstelleRESTService.java	Thu May 23 14:50:02 2013 +0200
+++ b/src/main/java/de/intevation/lada/rest/SMessstelleRESTService.java	Thu May 23 15:29:13 2013 +0200
@@ -13,16 +13,33 @@
 import de.intevation.lada.data.SMessstelleRepository;
 import de.intevation.lada.model.SMessStelle;
 
+/**
+ * This class produces a RESTful service to read the contents of s_messstelle
+ * table.
+ *
+ * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a>
+ */
 @Path("/mst")
 @RequestScoped
 public class SMessstelleRESTService
 {
+    /**
+     * The Repository for SMessStelle.
+     */
     @Inject
     private SMessstelleRepository repository;
 
+    /**
+     * The logger for this class
+     */
     @Inject
     private Logger logger;
 
+    /**
+     * Request all SMessStelle objects.
+     *
+     * @return JSON Object via Rest service
+     */
     @GET
     @Produces("text/json")
     public List<SMessStelle> findAll() {
@@ -30,6 +47,12 @@
         return result;
     }
 
+    /**
+     * Request a single SMessStelle via its id.
+     *
+     * @param id The mst_id
+     * @return JSON Object via REST service.
+     */
     @GET
     @Path("/{id:[0-9][0-9]*}")
     @Produces("text/json")
--- a/src/main/java/de/intevation/lada/rest/SUmweltRESTService.java	Thu May 23 14:50:02 2013 +0200
+++ b/src/main/java/de/intevation/lada/rest/SUmweltRESTService.java	Thu May 23 15:29:13 2013 +0200
@@ -13,15 +13,32 @@
 import de.intevation.lada.data.SUmweltRepository;
 import de.intevation.lada.model.SUmwelt;
 
+/**
+ * This class produces a RESTful service to read the contents of s_umwelt table.
+ * 
+ * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a>
+ */
 @Path("/uwb")
 @RequestScoped
 public class SUmweltRESTService {
+
+    /**
+     * The Repository for SUmwelt.
+     */
     @Inject
     private SUmweltRepository repository;
 
+    /**
+     * The logger for this class.
+     */
     @Inject
     private Logger log;
 
+    /**
+     * Request all SUmwelt objects.
+     *
+     * @return JSON Object via Rest service
+     */
     @GET
     @Produces("text/json")
     public List<SUmwelt> listAllMembers() {
@@ -29,6 +46,12 @@
         return result;
     }
 
+    /**
+     * Request a SUmwelt object via its id.
+     *
+     * @param id The SUmwelt id
+     * @return JSON Object via REST service.
+     */
     @GET
     @Path("/{id:[0-9][0-9]*}")
     @Produces("text/json")
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)