Kenmegne
7 days ago 1bc8864f134272c4bf23a9b05831803a423a4771
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package com.megatim.apifdxweb.service.ifaces.abstracts;
 
import java.io.Serializable;
import javax.annotation.security.PermitAll;
import javax.validation.Valid;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
 
public interface AbstractGenericCrudResourceIFaces<T, K, ID extends Serializable, U> { //U représente le type de l'objet sur lequel on va appliquer la recherche
 
    K mapToDto(T entity);
 
    @POST
    @Consumes({MediaType.APPLICATION_JSON})
    @Produces({MediaType.APPLICATION_JSON})
    @Path("add")
    @PermitAll
    public Response save(@Context HttpHeaders headers, @Valid T entity);
 
    @POST
    @Consumes({MediaType.APPLICATION_JSON})
    @Produces({MediaType.APPLICATION_JSON})
    @Path("update/{id}")
    @PermitAll
    public Response update(@Context HttpHeaders headers, @PathParam("id") ID id, @Valid T entity);
 
    @POST
    @Consumes({MediaType.APPLICATION_JSON})
    @Produces({MediaType.APPLICATION_JSON})
    @Path("delete/{id}")
    @PermitAll
    public void delete(@Context HttpHeaders headers, @PathParam("id") ID id);
 
    @GET
    @Produces({MediaType.APPLICATION_JSON})
    @Path("findbyid/{id}")
    @PermitAll
    public Response findById(@Context HttpHeaders headers, @PathParam("id") ID id);
 
    @POST
    @Produces({MediaType.APPLICATION_JSON})
    @Path("findwithpagination/{pageNumber}/{pagesize}")
    @PermitAll
    public Response findWithPagination(@Context HttpHeaders headers, @PathParam("pageNumber") Integer pageNumber, @PathParam("pagesize") Integer pagesize, U searchEntity);
 
    @POST
    @Produces({MediaType.APPLICATION_JSON})
    @PermitAll
    @Path("findall")
    public Response findAll(@Context HttpHeaders headers, U searchEntity);
 
    @POST
    @Produces({MediaType.APPLICATION_JSON})
    @Path("count")
    @PermitAll
    public Long count(@Context HttpHeaders headers, U searchEntity);
}