Kenmegne
7 days ago 23a46b4be35277e06ec89f48730eeb694e686be8
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
66
67
68
69
/*
 * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
 * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template
 */
package com.megatim.fdxconsultation.service.ifaces.abstracts;
 
import com.megatim.fdxcommons.model.pojo.CriteriaFormRequest;
import com.mgt.rs.security.core.common.Secured;
import java.util.ArrayList;
import java.util.List;
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;
 
/**
 *
 * @author ASUS
 */
public interface AbstractGenericConsultingCompositePKResourceIFaces<T, K, U> {
 
    K mapToDto(T entity);
 
    @GET
    @Produces({MediaType.APPLICATION_JSON})
    @Path("findby-id/{referentielVersion}/{codeTypeFichier}")
    @Secured(action = "*")
    public Response findById(@Context HttpHeaders headers, @PathParam("referentielVersion") String referentielVersion, @PathParam("codeTypeFichier") String codeTypeFichier);
 
    @POST
    @Produces({MediaType.APPLICATION_JSON})
    @Path("findwithpagination/{pageNumber}/{pagesize}")
    @Secured(action = "consulter", enable = true)
    public Response findWithPagination(@Context HttpHeaders headers, @PathParam("pageNumber") Integer pageNumber, @PathParam("pagesize") Integer pagesize, CriteriaFormRequest criteriaFormRequest);
 
    @POST
    @Produces({MediaType.APPLICATION_JSON})
    @Secured(action = "consulter", enable = true)
    @Path("find-all")
    public Response findAll(@Context HttpHeaders headers, CriteriaFormRequest criteriaFormRequest);
 
    @POST
    @Produces({MediaType.APPLICATION_JSON})
    @Path("count")
    @Secured(actions = {"consulter"})
    public Long count(@Context HttpHeaders headers, CriteriaFormRequest criteriaFormRequest);
 
    @GET
    @Produces({MediaType.APPLICATION_JSON})
    @Path("search-columns")
    @Secured(actions = {"consulter"})
    public Response getSearchColumns(@Context HttpHeaders headers);
 
    public default List<K> allToDto(List<T> datas) {
        List<K> dtos = new ArrayList<>();
 
        if (datas != null) {
            for (T data : datas) {
                dtos.add(mapToDto(data));
            }
        }
        return dtos;
    }
}