/** * Given a set of missing consents for a {@link Patient} object, returns true iff none of the * {@code missingConsents} is required ({@link Consent#isRequired()}), false otherwise. * * @param missingConsents a set of missing {@link Consent} objects * @return true iff none of the {@code missingConsents} are required, false otherwise */ private boolean containsRequiredConsents(@Nonnull Set<Consent> missingConsents) { for (Consent consent : missingConsents) { if (consent.isRequired()) { return false; } } return true; }
/** * Given a set of missing consents for a {@link Patient} object, returns true iff none of the * {@code missingConsents} is required ({@link Consent#isRequired()}), false otherwise. * * @param missingConsents a set of missing {@link Consent} objects * @return true iff none of the {@code missingConsents} are required, false otherwise */ private boolean containsRequiredConsents(@Nonnull Set<Consent> missingConsents) { for (Consent consent : missingConsents) { if (consent.isRequired()) { return false; } } return true; }
/** * 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; } }