ProductRestView.java
811 Bytes
package fi.codecrew.moya.rest.v2;
import java.util.List;
import javax.ejb.EJB;
import javax.enterprise.context.RequestScoped;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import com.wordnik.swagger.annotations.Api;
import fi.codecrew.moya.beans.ProductBeanLocal;
import fi.codecrew.moya.rest.v2.pojo.ProductPojo;
@RequestScoped
@Path("/v2/product")
@Api(value = "/v2/product", description = "Product operations")
public class ProductRestView {
@EJB
private ProductBeanLocal prodbean;
@GET
@Path("/all")
@Produces(MediaType.APPLICATION_JSON)
public Response getAllProducts() {
List<ProductPojo> ret = ProductPojo.convert(prodbean.findProductsForEvent());
return Response.ok(ret).build();
}
}