use of eu.europa.ec.fisheries.wsdl.asset.types.AssetListQuery 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);
}
}
}
use of eu.europa.ec.fisheries.wsdl.asset.types.AssetListQuery 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;
}
use of eu.europa.ec.fisheries.wsdl.asset.types.AssetListQuery in project UVMS-Docker by UnionVMS.
the class AssetJMSIT method testGetAssetListByQuery.
@Test
public void testGetAssetListByQuery() throws Exception {
Asset asset = AssetTestHelper.createTestAsset();
AssetListQuery assetListQuery = AssetTestHelper.getBasicAssetQuery();
AssetListCriteriaPair assetListCriteriaPair = new AssetListCriteriaPair();
assetListCriteriaPair.setKey(ConfigSearchField.FLAG_STATE);
assetListCriteriaPair.setValue(asset.getCountryCode());
assetListQuery.getAssetSearchCriteria().getCriterias().add(assetListCriteriaPair);
List<Asset> assets = AssetJMSHelper.getAssetByAssetListQuery(assetListQuery);
setDecimalScaleAndNullNotes(assets);
assertTrue(assets.contains(asset));
}
use of eu.europa.ec.fisheries.wsdl.asset.types.AssetListQuery in project UVMS-Docker by UnionVMS.
the class AssetRestIT method getAssetListWithLikeSearchValue_ICCAT_AND_UVI_GFCM.
@Test
public void getAssetListWithLikeSearchValue_ICCAT_AND_UVI_GFCM() throws Exception {
Asset asset = AssetTestHelper.createDummyAsset(AssetIdType.GUID);
String theValue = UUID.randomUUID().toString();
asset.setIccat(theValue);
asset.setUvi(theValue);
asset.setGfcm(theValue);
asset = AssetTestHelper.createAsset(asset);
AssetListQuery assetListQuery = AssetTestHelper.getBasicAssetQuery();
AssetListCriteriaPair assetListCriteriaPair_ICCAT = new AssetListCriteriaPair();
AssetListCriteriaPair assetListCriteriaPair_UVI = new AssetListCriteriaPair();
AssetListCriteriaPair assetListCriteriaPair_GFCM = new AssetListCriteriaPair();
assetListCriteriaPair_ICCAT.setKey(ConfigSearchField.ICCAT);
assetListCriteriaPair_ICCAT.setValue(theValue);
assetListQuery.getAssetSearchCriteria().getCriterias().add(assetListCriteriaPair_ICCAT);
assetListCriteriaPair_UVI.setKey(ConfigSearchField.UVI);
assetListCriteriaPair_UVI.setValue(theValue);
assetListQuery.getAssetSearchCriteria().getCriterias().add(assetListCriteriaPair_UVI);
assetListCriteriaPair_GFCM.setKey(ConfigSearchField.GFCM);
assetListCriteriaPair_GFCM.setValue(theValue);
assetListQuery.getAssetSearchCriteria().getCriterias().add(assetListCriteriaPair_GFCM);
ListAssetResponse assetList = AssetTestHelper.assetListQuery(assetListQuery);
List<Asset> assets = assetList.getAsset();
assertTrue(assets.contains(asset));
}
use of eu.europa.ec.fisheries.wsdl.asset.types.AssetListQuery in project UVMS-Docker by UnionVMS.
the class AssetRestIT method getAssetListItemCountTest.
@Test
public void getAssetListItemCountTest() throws Exception {
AssetListQuery assetListQuery = AssetTestHelper.getBasicAssetQuery();
AssetListCriteriaPair assetListCriteriaPair = new AssetListCriteriaPair();
assetListCriteriaPair.setKey(ConfigSearchField.FLAG_STATE);
assetListCriteriaPair.setValue("SWE");
assetListQuery.getAssetSearchCriteria().getCriterias().add(assetListCriteriaPair);
Integer countBefore = AssetTestHelper.assetListQueryCount(assetListQuery);
// Add new asset
Asset asset = AssetTestHelper.createDummyAsset(AssetIdType.GUID);
asset.setCountryCode("SWE");
AssetTestHelper.createAsset(asset);
Integer countAfter = AssetTestHelper.assetListQueryCount(assetListQuery);
assertEquals(Integer.valueOf(countBefore + 1), countAfter);
}
Aggregations