Search in sources :

Example 1 with GetLogListByQueryResponse

use of eu.europa.ec.fisheries.schema.exchange.source.v1.GetLogListByQueryResponse in project UVMS-ExchangeModule-APP by UnionVMS.

the class ExchangeLogServiceBean method getExchangeLogList.

@Override
public GetLogListByQueryResponse getExchangeLogList(ExchangeListQuery query) throws ExchangeLogException {
    GetLogListByQueryResponse response = new GetLogListByQueryResponse();
    try {
        ListResponseDto exchangeLogList = exchangeLogModel.getExchangeLogListByQuery(query);
        response.setCurrentPage(exchangeLogList.getCurrentPage());
        response.setTotalNumberOfPages(exchangeLogList.getTotalNumberOfPages());
        response.getExchangeLog().addAll(exchangeLogList.getExchangeLogList());
        return response;
    } catch (ExchangeModelException e) {
        throw new ExchangeLogException("Couldn't get exchange log list.");
    }
}
Also used : GetLogListByQueryResponse(eu.europa.ec.fisheries.schema.exchange.source.v1.GetLogListByQueryResponse) ExchangeLogException(eu.europa.ec.fisheries.uvms.exchange.service.exception.ExchangeLogException) ExchangeModelException(eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelException) ListResponseDto(eu.europa.ec.fisheries.uvms.exchange.model.dto.ListResponseDto)

Example 2 with GetLogListByQueryResponse

use of eu.europa.ec.fisheries.schema.exchange.source.v1.GetLogListByQueryResponse in project UVMS-ExchangeModule-APP by UnionVMS.

the class ExchangeLogRestResource method getLogListByCriteria.

/**
 * @responseMessage 200 [Success]
 * @responseMessage 500 [Error]
 *
 * @summary Get a list of all exchangeLogs by search criterias
 */
@POST
@Consumes(value = { MediaType.APPLICATION_JSON })
@Produces(value = { MediaType.APPLICATION_JSON })
@Path("/list")
@RequiresFeature(UnionVMSFeature.viewExchange)
public ResponseDto getLogListByCriteria(final ExchangeListQuery query) {
    log.info("Get list invoked in rest layer:{}", query);
    try {
        // TODO query in swagger
        GetLogListByQueryResponse response = serviceLayer.getExchangeLogList(query);
        ListQueryResponse exchangeLogList = ExchangeLogMapper.mapToQueryResponse(response);
        return new ResponseDto(exchangeLogList, RestResponseCode.OK);
    } catch (Exception ex) {
        log.error("[ Error when geting log list. {} ] {} ", query, ex.getMessage());
        return ErrorHandler.getFault(ex);
    }
}
Also used : GetLogListByQueryResponse(eu.europa.ec.fisheries.schema.exchange.source.v1.GetLogListByQueryResponse) ResponseDto(eu.europa.ec.fisheries.uvms.exchange.rest.dto.ResponseDto) ListQueryResponse(eu.europa.ec.fisheries.uvms.exchange.rest.dto.exchange.ListQueryResponse) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Consumes(javax.ws.rs.Consumes) Produces(javax.ws.rs.Produces) RequiresFeature(eu.europa.ec.fisheries.uvms.rest.security.RequiresFeature)

Aggregations

GetLogListByQueryResponse (eu.europa.ec.fisheries.schema.exchange.source.v1.GetLogListByQueryResponse)2 ListResponseDto (eu.europa.ec.fisheries.uvms.exchange.model.dto.ListResponseDto)1 ExchangeModelException (eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelException)1 ResponseDto (eu.europa.ec.fisheries.uvms.exchange.rest.dto.ResponseDto)1 ListQueryResponse (eu.europa.ec.fisheries.uvms.exchange.rest.dto.exchange.ListQueryResponse)1 ExchangeLogException (eu.europa.ec.fisheries.uvms.exchange.service.exception.ExchangeLogException)1 RequiresFeature (eu.europa.ec.fisheries.uvms.rest.security.RequiresFeature)1 Consumes (javax.ws.rs.Consumes)1 POST (javax.ws.rs.POST)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1