/** {@inheritDoc} */ public void applyFederationFilter(final Collection list, final Class objectType) { final Set<Long> manageableShopIds = shopFederationStrategy.getAccessibleShopIdsByCurrentManager(); final Iterator<CarrierDTO> carriersIt = list.iterator(); while (carriersIt.hasNext()) { final CarrierDTO carrier = carriersIt.next(); try { final Map<ShopDTO, Boolean> shops = carrierService.getAssignedCarrierShops(carrier.getCarrierId()); boolean manageable = false; for (final ShopDTO shop : shops.keySet()) { if (manageableShopIds.contains(shop.getShopId())) { manageable = true; break; } } if (!manageable) { carriersIt.remove(); } } catch (Exception exp) { carriersIt.remove(); } } }
/** {@inheritDoc} */ public boolean isManageable(final Object object, final Class objectType) { final Set<Long> manageableShopIds = shopFederationStrategy.getAccessibleShopIdsByCurrentManager(); try { final Map<ShopDTO, Boolean> shops = carrierService.getAssignedCarrierShops((Long) object); for (final ShopDTO shop : shops.keySet()) { if (manageableShopIds.contains(shop.getShopId())) { return true; } } } catch (Exception exp) { // nothing } return false; }