Mercurial > lada > lada-server
changeset 38:c20674399ad7
Code cleanup.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Thu, 23 May 2013 14:50:02 +0200 |
parents | d490e369d9ee |
children | e0a5477f657e |
files | 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/RESTService.java src/main/java/de/intevation/lada/service/SUmweltService.java |
diffstat | 4 files changed, 0 insertions(+), 108 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/de/intevation/lada/data/SUmweltRepository.java Thu May 23 14:49:23 2013 +0200 +++ b/src/main/java/de/intevation/lada/data/SUmweltRepository.java Thu May 23 14:50:02 2013 +0200 @@ -5,25 +5,18 @@ import javax.enterprise.context.ApplicationScoped; import javax.inject.Inject; import javax.persistence.EntityManager; -import javax.persistence.PersistenceContext; -import javax.persistence.PersistenceContextType; import javax.persistence.criteria.CriteriaBuilder; import javax.persistence.criteria.CriteriaQuery; import javax.persistence.criteria.Root; import de.intevation.lada.model.SUmwelt; -import de.intevation.lada.service.SUmweltService; @ApplicationScoped public class SUmweltRepository { @Inject - @PersistenceContext(type=PersistenceContextType.EXTENDED) EntityManager em; - @Inject - SUmweltService service; - public List<SUmwelt> findAll() { CriteriaBuilder builder = em.getCriteriaBuilder(); CriteriaQuery<SUmwelt> criteria = builder.createQuery(SUmwelt.class);
--- a/src/main/java/de/intevation/lada/rest/LProbeRESTService.java Thu May 23 14:49:23 2013 +0200 +++ b/src/main/java/de/intevation/lada/rest/LProbeRESTService.java Thu May 23 14:50:02 2013 +0200 @@ -43,16 +43,6 @@ } @GET - @Path("/deleteLast") - @Produces("text/plain") - public String deleteLast() { - final List<LProbe> result = repository.findAll(); - LProbe last_element = result.get(result.size()-1); - repository.delete(last_element); - return "Gelöscht id" + last_element.getProbeId(); - } - - @GET @Produces("text/json") public List<LProbe> filter(@Context UriInfo info) { MultivaluedMap<String, String> params = info.getQueryParameters(); @@ -79,24 +69,4 @@ } return repository.filter(mstId, uwbId, begin); } - //@GET - //@Produces("text/xml") - //public List<Member> listAllMembers() { - // // Us @SupressWarnings to force IDE to ignore warnings about "genericizing" the results of - // // this query - // @SuppressWarnings("unchecked") - // // We recommend centralizing inline queries such as this one into @NamedQuery annotations on - // // the @Entity class - // // as described in the named query blueprint: - // // https://blueprints.dev.java.net/bpcatalog/ee5/persistence/namedquery.html - // final List<Member> results = em.createQuery("select m from Member m order by m.name").getResultList(); - // return results; - //} - - //@GET - //@Path("/{id:[0-9][0-9]*}") - //@Produces("text/xml") - //public Member lookupMemberById(@PathParam("id") long id) { - // return em.find(Member.class, id); - //} }
--- a/src/main/java/de/intevation/lada/rest/RESTService.java Thu May 23 14:49:23 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -package de.intevation.lada.rest; - -import javax.enterprise.context.RequestScoped; -import javax.ws.rs.GET; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; - -@Path("/default") -@RequestScoped -public class RESTService { - - @GET - @Produces("text/plain") - public String listAll() { - return "Hallo Welt!"; - } -} - -/** - * JAX-RS Example - * - * This class produces a RESTful service to read the contents of the members table. - -@Path("/members") -@RequestScoped -public class MemberResourceRESTService { - @Inject - private EntityManager em; - - @GET - @Produces("text/xml") - public List<Member> listAllMembers() { - // Use @SupressWarnings to force IDE to ignore warnings about "genericizing" the results of - // this query - @SuppressWarnings("unchecked") - // We recommend centralizing inline queries such as this one into @NamedQuery annotations on - // the @Entity class - // as described in the named query blueprint: - // https://blueprints.dev.java.net/bpcatalog/ee5/persistence/namedquery.html - final List<Member> results = em.createQuery("select m from Member m order by m.name").getResultList(); - return results; - } - - @GET - @Path("/{id:[0-9][0-9]*}") - @Produces("text/xml") - public Member lookupMemberById(@PathParam("id") long id) { - return em.find(Member.class, id); - } -} -*/
--- a/src/main/java/de/intevation/lada/service/SUmweltService.java Thu May 23 14:49:23 2013 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -package de.intevation.lada.service; - -import java.util.logging.Logger; - -import javax.ejb.Stateless; -import javax.ejb.TransactionAttribute; -import javax.ejb.TransactionAttributeType; -import javax.inject.Inject; -import javax.persistence.EntityManager; - -import de.intevation.lada.model.SUmwelt; - -@Stateless -public class SUmweltService { - @Inject - private Logger log; - - @Inject - private EntityManager em; -}