@@ -0,0 +1,1728 @@
+/*%0A * To change this license header, choose License Headers in Project Properties.%0A * To change this template file, choose Tools %7C Templates%0A * and open the template in the editor.%0A */%0Apackage com.github.daniel.shuy.jax.rs.jpa.crud;%0A%0Aimport java.util.List;%0Aimport javax.ws.rs.Consumes;%0Aimport javax.ws.rs.DELETE;%0Aimport javax.ws.rs.GET;%0Aimport javax.ws.rs.POST;%0Aimport javax.ws.rs.PUT;%0Aimport javax.ws.rs.Path;%0Aimport javax.ws.rs.PathParam;%0Aimport javax.ws.rs.Produces;%0Aimport javax.ws.rs.core.MediaType;%0A%0A/**%0A * Extend this class to create a CRUD RepositoryCRUD Class.%0A * @param %3CE%3E The Entity Class type%0A * @param %3CR%3E The Repository Class type%0A */%0Apublic abstract class ResourceCRUD%3CE extends EntityCRUD, R extends RepositoryCRUD%3CE%3E%3E %7B%0A    private final R repository;%0A    %0A    public ResourceCRUD(R repository) %7B%0A        this.repository = repository;%0A    %7D%0A    %0A    @POST%0A    @Consumes(MediaType.APPLICATION_JSON)%0A    public void create(E content) %7B%0A        repository.add(content);%0A    %7D%0A    %0A    @GET%0A    @Produces(MediaType.APPLICATION_JSON)%0A    public List%3CE%3E readAll() %7B%0A        return repository.getAll();%0A    %7D%0A    %0A    @GET%0A    @Path(%22%7Bid%7D%22)%0A    @Produces(MediaType.APPLICATION_JSON)%0A    public E read(@PathParam(%22id%22) String id) %7B%0A        long idLong;%0A        try %7B%0A            idLong = Long.parseLong(id);%0A        %7D%0A        catch (NumberFormatException e) %7B%0A            return null;%0A        %7D%0A        %0A        return repository.get(idLong);%0A    %7D%0A%0A    @PUT%0A    @Consumes(MediaType.APPLICATION_JSON)%0A    public void update(E content) %7B%0A        repository.update(content);%0A    %7D%0A    %0A    @DELETE%0A    @Consumes(MediaType.APPLICATION_JSON)%0A    public void delete(E content) %7B%0A        repository.remove(content);%0A    %7D%0A%7D%0A

Add ResourceCRUD