Mercurial > lada > lada-server
changeset 109:a2427e766398
Extracted filter method to have a generic criteria filter in the repository.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Wed, 12 Jun 2013 13:15:19 +0200 |
parents | 03df43fdd359 |
children | 30e3ae65cd94 |
files | src/main/java/de/intevation/lada/data/LProbeRepository.java |
diffstat | 1 files changed, 12 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/de/intevation/lada/data/LProbeRepository.java Wed Jun 12 13:13:03 2013 +0200 +++ b/src/main/java/de/intevation/lada/data/LProbeRepository.java Wed Jun 12 13:15:19 2013 +0200 @@ -47,7 +47,7 @@ private LProbeManager manager; /** - * Filter for LProbe objects. + * Filter for LProbe objects used for calls from a service. * * @param mstId mst_id * @param uwbId umw_id @@ -86,11 +86,21 @@ Predicate beg = cb.equal(member.get("probeentnahmeBeginn"), new Date(begin)); criteria.where(beg); } - List<LProbe> result = em.createQuery(criteria).getResultList(); + List<LProbe> result = filter(criteria); return new Response(true, 200, result); } /** + * Filter LProbe object list by the given criteria. + * + * @param criteria + * @return List of LProbe objects. + */ + public List<LProbe> filter(CriteriaQuery<LProbe> criteria) { + return em.createQuery(criteria).getResultList(); + } + + /** * Validate and persist a new LProbe object. * * @param probe The new LProbe object