@Override public List<RecordElement> filterForm(List<RecordElement> elements, Patient patient) { if (CollectionUtils.isEmpty(elements)) { return Collections.emptyList(); } if (!this.consentsGloballyEnabled() || patient == null) { return elements; } Set<Consent> missingConsents = this.consentManager.getMissingConsentsForPatient(patient); // If !containsRequiredConsents(missingConsents) is true, then one of the consents is mandatory, which means // that no sections should be displayed; missingConsents will only be null if patient is null. if (missingConsents == null || !containsRequiredConsents(missingConsents)) { return Collections.emptyList(); } Set<String> nonConsentedFields = this.getNonConsentedFieldSet(missingConsents); List<RecordElement> updatedElements = new LinkedList<>(); for (RecordElement element : elements) { if (this.isElementEnabled(element, nonConsentedFields)) { updatedElements.add(element); } } return updatedElements; }
@Override public List<RecordElement> filterForm(List<RecordElement> elements, Patient patient) { if (CollectionUtils.isEmpty(elements)) { return Collections.emptyList(); } if (!this.consentsGloballyEnabled() || patient == null) { return elements; } Set<Consent> missingConsents = this.consentManager.getMissingConsentsForPatient(patient); // If !containsRequiredConsents(missingConsents) is true, then one of the consents is mandatory, which means // that no sections should be displayed; missingConsents will only be null if patient is null. if (missingConsents == null || !containsRequiredConsents(missingConsents)) { return Collections.emptyList(); } Set<String> nonConsentedFields = this.getNonConsentedFieldSet(missingConsents); List<RecordElement> updatedElements = new LinkedList<>(); for (RecordElement element : elements) { if (this.isElementEnabled(element, nonConsentedFields)) { updatedElements.add(element); } } return updatedElements; }