@Override @Transactional(readOnly = true) public VendorDTO getById(Long id) throws EntityRetrievalException { VendorDTO vendor = vendorDao.getById(id); List<CertificationBodyDTO> availableAcbs = acbManager.getAllForUser(); if (availableAcbs != null && availableAcbs.size() == 1) { // if someone is a member of multiple acbs, they will not see the transparency CertificationBodyDTO acb = availableAcbs.get(0); VendorACBMapDTO map = vendorDao.getTransparencyMapping(vendor.getId(), acb.getId()); if (map == null) { vendor.setTransparencyAttestation(Boolean.FALSE); } else { vendor.setTransparencyAttestation(map.getTransparencyAttestation()); } } return vendor; }
@Override @Transactional(readOnly = true) public List<VendorDTO> getAll() { List<VendorDTO> allVendors = vendorDao.findAll(); List<CertificationBodyDTO> availableAcbs = acbManager.getAllForUser(); if (availableAcbs != null && availableAcbs.size() == 1) { // if someone is a member of multiple acbs, they will not see the transparency CertificationBodyDTO acb = availableAcbs.get(0); for (VendorDTO vendor : allVendors) { VendorACBMapDTO map = vendorDao.getTransparencyMapping(vendor.getId(), acb.getId()); if (map == null) { vendor.setTransparencyAttestation(Boolean.FALSE); } else { vendor.setTransparencyAttestation(map.getTransparencyAttestation()); } } } return allVendors; }