view src/main/java/de/intevation/lada/rest/SProbenartService.java @ 135:f33f6e1ba9f8

Changed scope of repositories.
author Raimund Renkert <rrenkert@intevation.de>
date Thu, 13 Jun 2013 17:19:53 +0200
parents 8250e5bb7c84
children 42e0085692df
line wrap: on
line source
package de.intevation.lada.rest;

import java.util.logging.Logger;

import javax.enterprise.context.RequestScoped;
import javax.inject.Inject;
import javax.inject.Named;
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.SProbenart;

/**
 * This class produces a RESTful service to read the contents of SProbenart table.
 * 
 * @author <a href="mailto:rrenkert@intevation.de">Raimund Renkert</a>
 */
@Path("/probenart")
@RequestScoped
public class SProbenartService
{
    /**
     * The Repository for SProbenart.
     */
    @Inject
    @Named("readolyrepository")
    private Repository repository;

    /**
     * The logger for this class
     */
    @Inject
    private Logger logger;

    /**
     * Request all SProbenart objects.
     *
     * @return JSON Object via Rest service
     */
    @GET
    @Produces("text/json")
    public Response findAll() {
        return repository.findAll(SProbenart.class);
    }

    /**
     * Request a single SProbenart via its id.
     *
     * @param id The mst_id
     * @return JSON Object via REST service.
     */
    @GET
    @Path("/{id}")
    @Produces("text/json")
    public Response findById(@PathParam("id") String id) {
        return repository.findById(SProbenart.class, id);
    }
}
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)