/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package service;

import be.luckycode.projetawebservice.Bugcategory;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;

/**
 *
 * @author michael
 */
@Stateless
@Path("bugcategories")
public class BugcategoryFacadeREST extends AbstractFacade<Bugcategory> {
    @PersistenceContext(unitName = "be.luckycode_projeta-webservice_war_1.0-SNAPSHOTPU")
    private EntityManager em;

    public BugcategoryFacadeREST() {
        super(Bugcategory.class);
    }

    @POST
    @Override
    @Consumes({"application/xml", "application/json"})
    public void create(Bugcategory entity) {
        super.create(entity);
    }

    @PUT
    @Override
    @Consumes({"application/xml", "application/json"})
    public void edit(Bugcategory entity) {
        super.edit(entity);
    }

    @DELETE
    @Path("{id}")
    public void remove(@PathParam("id") Integer id) {
        super.remove(super.find(id));
    }

    @GET
    @Path("{id}")
    @Produces({"application/xml", "application/json"})
    public Bugcategory find(@PathParam("id") Integer id) {
        return super.find(id);
    }

    @GET
    @Override
    @Produces({"application/xml", "application/json"})
    public List<Bugcategory> findAll() {
        return super.findAll();
    }

    @GET
    @Path("{from}/{to}")
    @Produces({"application/xml", "application/json"})
    public List<Bugcategory> findRange(@PathParam("from") Integer from, @PathParam("to") Integer to) {
        return super.findRange(new int[]{from, to});
    }

    @GET
    @Path("count")
    @Produces("text/plain")
    public String countREST() {
        return String.valueOf(super.count());
    }

    @java.lang.Override
    protected EntityManager getEntityManager() {
        return em;
    }
    
}

@@ -185,16 +185,63 @@
 l.List;%0A
+import javax.annotation.security.RolesAllowed;%0A
 import j
@@ -260,16 +260,16 @@
 teless;%0A
-
 import j
@@ -932,36 +932,16 @@
 onsumes(
-%7B%22application/xml%22, 
 %22applica
@@ -942,33 +942,32 @@
 pplication/json%22
-%7D
 )%0A    public voi
@@ -1066,37 +1066,52 @@
    @
-Consumes(%7B%22application/xml%22, 
+RolesAllowed(%22administrator%22)%0A    @Consumes(
 %22app
@@ -1116,33 +1116,32 @@
 pplication/json%22
-%7D
 )%0A    public voi
@@ -1216,16 +1216,51 @@
 @DELETE%0A
+    @RolesAllowed(%22administrator%22)%0A
     @Pat
@@ -1580,36 +1580,33 @@
   @P
-roduces(%7B%22application/xml%22, 
+ath(%22all%22)%0A    @Produces(
 %22app
@@ -1611,33 +1611,32 @@
 pplication/json%22
-%7D
 )%0A    public Lis

Return bug categories.