class FilterServiceImpl implements FilterService, Constants {

    public List<Map<String, Object>> getPolicies(String assetGroup,
            String domain) throws ServiceException {
        List<Map<String, Object>> policyDetList = new ArrayList<>();

        String ttypes = complianceRepository.getTargetTypeForAG(assetGroup,
                domain);

        List<Map<String, Object>> policyIdsFromDb;
      try{
        policyIdsFromDb= repository
                .getPoliciesFromDB(ttypes);
      }catch(DataException e){
          throw new ServiceException(e);
      }
        noDataFoundCheck(emptyAssetCount, policyIdsFromDb);

        policyIdsFromDb.parallelStream().forEach(policy -> {
            Map<String, Object> policyMap = new HashMap<>();
            String policyId = policy.get(Constants.POLICYID).toString();
            String policyName = policy.get(POLICY_DISPLAY_NAME).toString();
            policyMap.put(NAME, policyName);
            policyMap.put(ID, policyId);
            synchronized (policyDetList) {
                policyDetList.add(policyMap);
            }
        });
        if(policyDetList.isEmpty()){
            throw new ServiceException(NO_DATA_FOUND);
        }
        return policyDetList;
    }

}