# HG changeset patch # User Raimund Renkert # Date 1369315753 -7200 # Node ID e0a5477f657eab15bf2e3ea7f6f27911b704a36e # Parent c20674399ad7ceb27ca674d1ac91eb86465699f3 Documentation. diff -r c20674399ad7 -r e0a5477f657e src/main/java/de/intevation/lada/data/LProbeRepository.java --- 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 Raimund Renkert + */ @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 filter(String mstId, String uwbId, Long begin) { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery 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 findAll() { CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriaQuery criteria = cb.createQuery(LProbe.class); diff -r c20674399ad7 -r e0a5477f657e src/main/java/de/intevation/lada/data/SMessstelleRepository.java --- 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 Raimund Renkert + */ @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 findAll() { CriteriaBuilder builder = em.getCriteriaBuilder(); CriteriaQuery 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); } diff -r c20674399ad7 -r e0a5477f657e src/main/java/de/intevation/lada/data/SUmweltRepository.java --- 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 Raimund Renkert + */ @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 findAll() { CriteriaBuilder builder = em.getCriteriaBuilder(); CriteriaQuery 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); } diff -r c20674399ad7 -r e0a5477f657e src/main/java/de/intevation/lada/rest/LProbeRESTService.java --- 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 Raimund Renkert + */ @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 filter(@Context UriInfo info) { diff -r c20674399ad7 -r e0a5477f657e src/main/java/de/intevation/lada/rest/SMessstelleRESTService.java --- 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 Raimund Renkert + */ @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 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") diff -r c20674399ad7 -r e0a5477f657e src/main/java/de/intevation/lada/rest/SUmweltRESTService.java --- 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 Raimund Renkert + */ @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 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")