Search in sources :

Example 1 with VesselTypeAssetQueryEnum

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;
}
Also used : VesselTypeAssetQueryEnum(eu.europa.ec.fisheries.ers.fa.utils.VesselTypeAssetQueryEnum) VesselIdentifierEntity(eu.europa.ec.fisheries.ers.fa.entities.VesselIdentifierEntity)

Example 2 with VesselTypeAssetQueryEnum

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;
}
Also used : VesselTypeAssetQueryEnum(eu.europa.ec.fisheries.ers.fa.utils.VesselTypeAssetQueryEnum)

Aggregations

VesselTypeAssetQueryEnum (eu.europa.ec.fisheries.ers.fa.utils.VesselTypeAssetQueryEnum)2 VesselIdentifierEntity (eu.europa.ec.fisheries.ers.fa.entities.VesselIdentifierEntity)1