/*
|
* 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.apifdxweb.service.ifaces.abstracts;
|
|
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 AbstractGenericConsultingResourceIFaces<T, K, ID, U> {
|
|
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;
|
}
|
|
public K mapToDto(T entity);
|
|
@GET
|
@Produces({MediaType.APPLICATION_JSON})
|
@Path("findbyid/{id}")
|
@Secured(action = "*")
|
public Response findById(@Context HttpHeaders headers, @PathParam("id") ID id);
|
|
@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, U searchEntity);
|
|
@POST
|
@Produces({MediaType.APPLICATION_JSON})
|
@Secured(action = "consulter", enable = true)
|
@Path("findall")
|
public Response findAll(@Context HttpHeaders headers, U searchEntity);
|
|
@POST
|
@Produces({MediaType.APPLICATION_JSON})
|
@Path("count")
|
@Secured(actions = {"consulter"})
|
public Long count(@Context HttpHeaders headers, U searchEntity);
|
|
@GET
|
@Produces({MediaType.APPLICATION_JSON})
|
@Path("getsearchcolumns")
|
@Secured(actions = {"consulter"})
|
public Response getSearchColumns(@Context HttpHeaders headers);
|
|
}
|