Search in sources :

Example 1 with IUserRoleInterceptor

use of eu.europa.ec.fisheries.uvms.activity.rest.IUserRoleInterceptor in project UVMS-ActivityModule-APP by UnionVMS.

the class FishingActivityResource method listFishingTripsByQuery.

@POST
@Path("/listTrips")
@Consumes(value = { MediaType.APPLICATION_JSON })
@Produces(MediaType.APPLICATION_JSON)
@Interceptors(ActivityExceptionInterceptor.class)
@IUserRoleInterceptor(requiredUserRole = { ActivityFeaturesEnum.LIST_ACTIVITY_REPORTS })
public Response listFishingTripsByQuery(@Context HttpServletRequest request, @HeaderParam("scopeName") String scopeName, @HeaderParam("roleName") String roleName, FishingActivityQuery fishingActivityQuery) throws ServiceException {
    log.info("Query Received to search Fishing Activity Reports. " + fishingActivityQuery);
    if (fishingActivityQuery == null) {
        return createErrorResponse("Query to find list is null.");
    }
    String username = request.getRemoteUser();
    List<Dataset> datasets = usmService.getDatasetsPerCategory(USMSpatial.USM_DATASET_CATEGORY, username, USMSpatial.APPLICATION_NAME, roleName, scopeName);
    log.info("Successful retrieved");
    FishingTripResponse fishingTripIdsForFilter = fishingTripService.filterFishingTrips(fishingActivityQuery);
    return createSuccessResponse(fishingTripIdsForFilter);
}
Also used : FishingTripResponse(eu.europa.ec.fisheries.uvms.activity.model.schemas.FishingTripResponse) Dataset(eu.europa.ec.fisheries.wsdl.user.types.Dataset) Path(javax.ws.rs.Path) Interceptors(javax.interceptor.Interceptors) POST(javax.ws.rs.POST) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces) IUserRoleInterceptor(eu.europa.ec.fisheries.uvms.activity.rest.IUserRoleInterceptor)

Example 2 with IUserRoleInterceptor

use of eu.europa.ec.fisheries.uvms.activity.rest.IUserRoleInterceptor in project UVMS-ActivityModule-APP by UnionVMS.

the class FACatchResource method getFACatchSummaryReport.

@POST
@Path("/summary")
@Consumes(value = { MediaType.APPLICATION_JSON })
@Produces(MediaType.APPLICATION_JSON)
@Interceptors(ActivityExceptionInterceptor.class)
@IUserRoleInterceptor(requiredUserRole = { ActivityFeaturesEnum.LIST_ACTIVITY_REPORTS })
public Response getFACatchSummaryReport(@Context HttpServletRequest request, @HeaderParam("scopeName") String scopeName, @HeaderParam("roleName") String roleName, FishingActivityQuery fishingActivityQuery) throws ServiceException {
    log.info("Query Received to getFACatchSummaryReport. " + fishingActivityQuery);
    if (fishingActivityQuery == null) {
        return createErrorResponse("Query to find list is null.");
    }
    FACatchSummaryReportResponse faCatchSummaryReportResponse = reportService.getFACatchSummaryReportResponse(fishingActivityQuery);
    log.info("Successfully processed");
    return createSuccessResponse(faCatchSummaryReportResponse);
}
Also used : FACatchSummaryReportResponse(eu.europa.ec.fisheries.uvms.activity.model.schemas.FACatchSummaryReportResponse) Path(javax.ws.rs.Path) Interceptors(javax.interceptor.Interceptors) POST(javax.ws.rs.POST) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces) IUserRoleInterceptor(eu.europa.ec.fisheries.uvms.activity.rest.IUserRoleInterceptor)

Example 3 with IUserRoleInterceptor

use of eu.europa.ec.fisheries.uvms.activity.rest.IUserRoleInterceptor in project UVMS-ActivityModule-APP by UnionVMS.

the class FishingActivityResource method listActivityReportsByQuery.

@POST
@Path("/list")
@Consumes(value = { MediaType.APPLICATION_JSON })
@Produces(MediaType.APPLICATION_JSON)
@Interceptors(ActivityExceptionInterceptor.class)
@IUserRoleInterceptor(requiredUserRole = { ActivityFeaturesEnum.LIST_ACTIVITY_REPORTS })
public Response listActivityReportsByQuery(@Context HttpServletRequest request, @HeaderParam("scopeName") String scopeName, @HeaderParam("roleName") String roleName, FishingActivityQuery fishingActivityQuery) throws ServiceException {
    log.info("Query Received to search Fishing Activity Reports. " + fishingActivityQuery);
    if (fishingActivityQuery == null) {
        return createErrorResponse("Query to find list is null.");
    }
    String username = request.getRemoteUser();
    List<Dataset> datasets = usmService.getDatasetsPerCategory(USMSpatial.USM_DATASET_CATEGORY, username, USMSpatial.APPLICATION_NAME, roleName, scopeName);
    log.info("Successful retrieved");
    FilterFishingActivityReportResultDTO resultDTO = activityService.getFishingActivityListByQuery(fishingActivityQuery, datasets);
    return createSuccessPaginatedResponse(resultDTO.getResultList(), resultDTO.getTotalCountOfRecords());
}
Also used : Dataset(eu.europa.ec.fisheries.wsdl.user.types.Dataset) FilterFishingActivityReportResultDTO(eu.europa.ec.fisheries.ers.service.dto.FilterFishingActivityReportResultDTO) Path(javax.ws.rs.Path) Interceptors(javax.interceptor.Interceptors) POST(javax.ws.rs.POST) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces) IUserRoleInterceptor(eu.europa.ec.fisheries.uvms.activity.rest.IUserRoleInterceptor)

Aggregations

IUserRoleInterceptor (eu.europa.ec.fisheries.uvms.activity.rest.IUserRoleInterceptor)3 Interceptors (javax.interceptor.Interceptors)3 Consumes (javax.ws.rs.Consumes)3 POST (javax.ws.rs.POST)3 Path (javax.ws.rs.Path)3 Produces (javax.ws.rs.Produces)3 Dataset (eu.europa.ec.fisheries.wsdl.user.types.Dataset)2 FilterFishingActivityReportResultDTO (eu.europa.ec.fisheries.ers.service.dto.FilterFishingActivityReportResultDTO)1 FACatchSummaryReportResponse (eu.europa.ec.fisheries.uvms.activity.model.schemas.FACatchSummaryReportResponse)1 FishingTripResponse (eu.europa.ec.fisheries.uvms.activity.model.schemas.FishingTripResponse)1