use of eu.europa.ec.fisheries.ers.fa.utils.VesselTypeAssetQueryEnum in project UVMS-ActivityModule-APP by UnionVMS.
the class AssetModuleServiceBean method createAssetListQuery.
private AssetListQuery createAssetListQuery(Collection<VesselIdentifierEntity> vesselIdentifiers) {
AssetListQuery assetListQuery = new AssetListQuery();
// Set asset list criteria
AssetListCriteria assetListCriteria = new AssetListCriteria();
for (VesselIdentifierEntity identifier : vesselIdentifiers) {
VesselTypeAssetQueryEnum queryEnum = VesselTypeAssetQueryEnum.getVesselTypeAssetQueryEnum(identifier.getVesselIdentifierSchemeId());
if (queryEnum != null && queryEnum.getConfigSearchField() != null && StringUtils.isNotEmpty(identifier.getVesselIdentifierId())) {
AssetListCriteriaPair criteriaPair = new AssetListCriteriaPair();
criteriaPair.setKey(queryEnum.getConfigSearchField());
criteriaPair.setValue(identifier.getVesselIdentifierId());
assetListCriteria.getCriterias().add(criteriaPair);
} else {
log.warn("For Identifier : '" + identifier.getVesselIdentifierSchemeId() + "' it was not found the counterpart in the VesselTypeAssetQueryEnum.");
}
}
// DO not know why
assetListCriteria.setIsDynamic(false);
assetListQuery.setAssetSearchCriteria(assetListCriteria);
// Set asset pagination
AssetListPagination pagination = new AssetListPagination();
pagination.setPage(1);
pagination.setListSize(1000);
assetListQuery.setPagination(pagination);
return assetListQuery;
}
use of eu.europa.ec.fisheries.ers.fa.utils.VesselTypeAssetQueryEnum in project UVMS-ActivityModule-APP by UnionVMS.
the class AssetModuleServiceBean method createAssetListQuery.
private AssetListQuery createAssetListQuery(String vesselToSearchFor) {
AssetListQuery assetListQuery = new AssetListQuery();
AssetListCriteria assetListCriteria = new AssetListCriteria();
for (VesselTypeAssetQueryEnum queryEnum : VesselTypeAssetQueryEnum.values()) {
// if it fails to parse it than it will throw!
if (!queryEnum.equals(VesselTypeAssetQueryEnum.UVI) && queryEnum.getConfigSearchField() != null) {
AssetListCriteriaPair criteriaPair = new AssetListCriteriaPair();
criteriaPair.setKey(queryEnum.getConfigSearchField());
criteriaPair.setValue(vesselToSearchFor);
assetListCriteria.getCriterias().add(criteriaPair);
}
}
// DO not know why
assetListCriteria.setIsDynamic(false);
assetListQuery.setAssetSearchCriteria(assetListCriteria);
// Set asset pagination
AssetListPagination pagination = new AssetListPagination();
pagination.setPage(1);
pagination.setListSize(1000);
assetListQuery.setPagination(pagination);
return assetListQuery;
}
Aggregations