Mercurial > lada > lada-server
view src/main/java/de/intevation/lada/rest/SUmweltService.java @ 107:5abec5413d65
Let all services and repositories return a response object that contains errors and warnings.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Wed, 12 Jun 2013 11:07:16 +0200 |
parents | a5ee8d69c0b4 |
children | 750585244083 |
line wrap: on
line source
package de.intevation.lada.rest; import java.util.List; import java.util.logging.Logger; import javax.enterprise.context.RequestScoped; import javax.inject.Inject; import javax.ws.rs.GET; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import de.intevation.lada.data.Repository; import de.intevation.lada.model.SUmwelt; import javax.inject.Named; /** * 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 SUmweltService { /** * The Repository for SUmwelt. */ @Inject @Named private Repository 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 Response findAll() { return repository.findAll(SUmwelt.class); } /** * 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") public Response findById(@PathParam("id") String id) { return repository.findById(SUmwelt.class, id); } }