ReaderRestView.java 933 Bytes
package fi.codecrew.moya.rest;

import java.util.List;

import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import fi.codecrew.moya.beans.ReaderBeanLocal;
import fi.codecrew.moya.rest.pojo.ReaderEventRestPojo;
import fi.codecrew.moya.rest.pojo.ReaderRestPojo;

@RequestScoped
@Path("/reader")
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
@Produces({ MediaType.APPLICATION_JSON })
public class ReaderRestView {

	@EJB
	private ReaderBeanLocal readerbean;

	@GET
	@Path("/List")
	public List<ReaderRestPojo> getReaderList()
	{
		return ReaderRestPojo.parse(readerbean.getReaders());
	}

	@GET
	@Path("/LastEventusers")
	public List<ReaderEventRestPojo> getLastEventusers()
	{
		return ReaderEventRestPojo.parse(readerbean.getLastReaderEvents());
	}
}