use of eu.europa.ec.fisheries.uvms.activity.model.schemas.SingleValueTypeFilter in project UVMS-ActivityModule-APP by UnionVMS.
the class FishingActivityRequestMapper method extractFiltersAsMap.
/**
* Some search Filters expect only single value. Others support multiple values for search.
* This method sorts Filter list and separates filters with single values and return the map with its value.
* @param filterTypes
* @return Map<SearchFilter,String> Map of SearchFilter and its value
* @throws ServiceException
*/
private static Map<SearchFilter, String> extractFiltersAsMap(List<SingleValueTypeFilter> filterTypes) throws ServiceException {
Set<SearchFilter> filtersWithMultipleValues = FilterMap.getFiltersWhichSupportMultipleValues();
Map<SearchFilter, String> searchMap = new EnumMap<>(SearchFilter.class);
for (SingleValueTypeFilter filterType : filterTypes) {
SearchFilter filter = filterType.getKey();
if (filtersWithMultipleValues.contains(filter)) {
throw new ServiceException("Filter provided with Single Value. Application Expects values as List for the Filter :" + filter);
}
searchMap.put(filterType.getKey(), filterType.getValue());
}
return searchMap;
}
Aggregations