Search in sources :

Example 1 with AssetListCriteria

use of eu.europa.ec.fisheries.wsdl.asset.types.AssetListCriteria in project UVMS-ActivityModule-APP by UnionVMS.

the class FishingTripServiceBean method getMdrCodesEnrichWithAssetsModuleDataIfNeeded.

// To process MDR code list and compare with  database:vesselTransportMeansDao and then enrich with asset module
private void getMdrCodesEnrichWithAssetsModuleDataIfNeeded(VesselDetailsDTO vesselDetailsDTO) {
    final String ACRONYM = "FLUX_VESSEL_ID_TYPE";
    final String filter = "*";
    final List<String> columnsList = new ArrayList<String>();
    Integer nrOfResults = 9999999;
    if (vesselDetailsDTO != null) {
        List<String> codeList = null;
        try {
            codeList = mdrModuleService.getAcronymFromMdr(ACRONYM, filter, columnsList, nrOfResults, "code").get("code");
            Set<AssetIdentifierDto> vesselIdentifiers = vesselDetailsDTO.getVesselIdentifiers();
            List<AssetListCriteriaPair> assetListCriteriaPairs = BaseMapper.mapMdrCodeListToAssetListCriteriaPairList(vesselIdentifiers, codeList);
            log.info("Asset Criteria Pair List size is :" + assetListCriteriaPairs.size());
            log.info("Got code list of size from mdr:" + codeList.size());
            if (null != assetListCriteriaPairs && !CollectionUtils.isEmpty(assetListCriteriaPairs)) {
                AssetListCriteria criteria = new AssetListCriteria();
                // need to set this
                criteria.setIsDynamic(false);
                criteria.getCriterias().addAll(assetListCriteriaPairs);
                AssetListQuery query = new AssetListQuery();
                AssetListPagination assetListPagination = new AssetListPagination();
                // need to set this
                assetListPagination.setPage(1);
                // need to set this
                assetListPagination.setListSize(1000);
                query.setPagination(assetListPagination);
                query.setAssetSearchCriteria(criteria);
                List<Asset> assetList = assetModuleService.getAssetListResponse(query);
                if (null != assetList && !CollectionUtils.isEmpty(assetList)) {
                    vesselDetailsDTO.enrichIdentifiers(assetList.get(0));
                }
            }
        } catch (ServiceException e) {
            log.error("Error while trying to send message to Assets module.", e);
        }
    }
}
Also used : AssetIdentifierDto(eu.europa.ec.fisheries.ers.service.dto.AssetIdentifierDto) AssetListCriteriaPair(eu.europa.ec.fisheries.wsdl.asset.types.AssetListCriteriaPair) ArrayList(java.util.ArrayList) AssetListQuery(eu.europa.ec.fisheries.wsdl.asset.types.AssetListQuery) AssetListPagination(eu.europa.ec.fisheries.wsdl.asset.types.AssetListPagination) BigInteger(java.math.BigInteger) ServiceException(eu.europa.ec.fisheries.uvms.commons.service.exception.ServiceException) Asset(eu.europa.ec.fisheries.wsdl.asset.types.Asset) AssetListCriteria(eu.europa.ec.fisheries.wsdl.asset.types.AssetListCriteria)

Example 2 with AssetListCriteria

use of eu.europa.ec.fisheries.wsdl.asset.types.AssetListCriteria in project UVMS-Docker by UnionVMS.

the class AssetTestHelper method getBasicAssetQuery.

public static AssetListQuery getBasicAssetQuery() {
    AssetListQuery assetListQuery = new AssetListQuery();
    AssetListPagination assetListPagination = new AssetListPagination();
    assetListPagination.setListSize(1000);
    assetListPagination.setPage(1);
    assetListQuery.setPagination(assetListPagination);
    AssetListCriteria assetListCriteria = new AssetListCriteria();
    assetListCriteria.setIsDynamic(true);
    assetListQuery.setAssetSearchCriteria(assetListCriteria);
    return assetListQuery;
}
Also used : AssetListQuery(eu.europa.ec.fisheries.wsdl.asset.types.AssetListQuery) AssetListPagination(eu.europa.ec.fisheries.wsdl.asset.types.AssetListPagination) AssetListCriteria(eu.europa.ec.fisheries.wsdl.asset.types.AssetListCriteria)

Example 3 with AssetListCriteria

use of eu.europa.ec.fisheries.wsdl.asset.types.AssetListCriteria in project UVMS-ActivityModule-APP by UnionVMS.

the class FishingTripServiceBean method enrichWithAssetsModuleDataIfNeeded.

// need confirmation for removal of this method
private void enrichWithAssetsModuleDataIfNeeded(VesselDetailsDTO vesselDetailsDTO) {
    if (vesselDetailsDTO != null && vesselDetailsDTO.hasEmptyIdentifierValues()) {
        try {
            Set<AssetIdentifierDto> vesselIdentifiers = vesselDetailsDTO.getVesselIdentifiers();
            List<AssetListCriteriaPair> assetListCriteriaPairs = BaseMapper.mapToAssetListCriteriaPairList(vesselIdentifiers);
            AssetListCriteria criteria = new AssetListCriteria();
            criteria.getCriterias().addAll(assetListCriteriaPairs);
            AssetListQuery query = new AssetListQuery();
            query.setAssetSearchCriteria(criteria);
            List<Asset> assetList = assetModuleService.getAssetListResponse(query);
            vesselDetailsDTO.enrichIdentifiers(assetList.get(0));
        } catch (ServiceException e) {
            log.error("Error while trying to send message to Assets module.", e);
        }
    }
}
Also used : AssetIdentifierDto(eu.europa.ec.fisheries.ers.service.dto.AssetIdentifierDto) AssetListCriteriaPair(eu.europa.ec.fisheries.wsdl.asset.types.AssetListCriteriaPair) ServiceException(eu.europa.ec.fisheries.uvms.commons.service.exception.ServiceException) AssetListQuery(eu.europa.ec.fisheries.wsdl.asset.types.AssetListQuery) Asset(eu.europa.ec.fisheries.wsdl.asset.types.Asset) AssetListCriteria(eu.europa.ec.fisheries.wsdl.asset.types.AssetListCriteria)

Aggregations

AssetListCriteria (eu.europa.ec.fisheries.wsdl.asset.types.AssetListCriteria)3 AssetListQuery (eu.europa.ec.fisheries.wsdl.asset.types.AssetListQuery)3 AssetIdentifierDto (eu.europa.ec.fisheries.ers.service.dto.AssetIdentifierDto)2 ServiceException (eu.europa.ec.fisheries.uvms.commons.service.exception.ServiceException)2 Asset (eu.europa.ec.fisheries.wsdl.asset.types.Asset)2 AssetListCriteriaPair (eu.europa.ec.fisheries.wsdl.asset.types.AssetListCriteriaPair)2 AssetListPagination (eu.europa.ec.fisheries.wsdl.asset.types.AssetListPagination)2 BigInteger (java.math.BigInteger)1 ArrayList (java.util.ArrayList)1