/** * Given a set of {@code missingConsents missing consents}, returns the union of all {@link Consent#getFields() * fields}, which the provided set of {@code missingConsents} prevents from being used. Returns an empty set if no * fields are affected. * * @param missingConsents a set of not granted {@link Consent} consents. * @return {@code null} if mandatory consents are missing, an empty list of no fields are missing consents, or a * list of field names that are missing a required consent */ private Set<String> getNonConsentedFieldSet(@Nonnull Set<Consent> missingConsents) { Set<String> notConsentedFields = new HashSet<>(); for (Consent consent : missingConsents) { if (consent.affectsAllFields() || consent.isRequired()) { // if at least one of the consents affects all fields no point to examine other consents // since all fields are affected anyway return null; } if (!consent.affectsSomeFields()) { continue; } notConsentedFields.addAll(consent.getFields()); } return notConsentedFields; } }
/** * Given a set of {@code missingConsents missing consents}, returns the union of all {@link Consent#getFields() * fields}, which the provided set of {@code missingConsents} prevents from being used. Returns an empty set if no * fields are affected. * * @param missingConsents a set of not granted {@link Consent} consents. * @return {@code null} if mandatory consents are missing, an empty list of no fields are missing consents, or a * list of field names that are missing a required consent */ private Set<String> getNonConsentedFieldSet(@Nonnull Set<Consent> missingConsents) { Set<String> notConsentedFields = new HashSet<>(); for (Consent consent : missingConsents) { if (consent.affectsAllFields() || consent.isRequired()) { // if at least one of the consents affects all fields no point to examine other consents // since all fields are affected anyway return null; } if (!consent.affectsSomeFields()) { continue; } notConsentedFields.addAll(consent.getFields()); } return notConsentedFields; } }