@Override public boolean authorizeInteraction(Patient patient) { return (patient != null) && this.containsRequiredConsents(this.consentManager.getMissingConsentsForPatient(patient)); }
@Override public boolean authorizeInteraction(Patient patient) { return (patient != null) && this.containsRequiredConsents(this.consentManager.getMissingConsentsForPatient(patient)); }
@Override public boolean authorizeInteraction(Set<String> grantedConsents) { Set<Consent> systemConsents = this.consentManager.getSystemConsents(); if (CollectionUtils.isEmpty(systemConsents)) { return true; } if (CollectionUtils.isEmpty(grantedConsents)) { return containsRequiredConsents(systemConsents); } Set<Consent> missingConsents = new HashSet<>(); for (Consent consent : systemConsents) { if (!grantedConsents.contains(consent.getId())) { missingConsents.add(consent); } } return containsRequiredConsents(missingConsents); }
@Override public boolean authorizeInteraction(Set<String> grantedConsents) { Set<Consent> systemConsents = this.consentManager.getSystemConsents(); if (CollectionUtils.isEmpty(systemConsents)) { return true; } if (CollectionUtils.isEmpty(grantedConsents)) { return containsRequiredConsents(systemConsents); } Set<Consent> missingConsents = new HashSet<>(); for (Consent consent : systemConsents) { if (!grantedConsents.contains(consent.getId())) { missingConsents.add(consent); } } return containsRequiredConsents(missingConsents); }
@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; }