@Test public void isElementConsentedConsentsAffectSomeFieldsElementNotConsented() { final UIExtension extension = mock(UIExtension.class); when(extension.getId()).thenReturn(FIELD_B_LABEL); final RecordElement element = mock(RecordElement.class); when(element.getExtension()).thenReturn(extension); final Set<Consent> missingConsents = new HashSet<>(); missingConsents.add(this.consentA); missingConsents.add(this.consentB); when(this.consentManager.getMissingConsentsForPatient(this.patient)).thenReturn(missingConsents); when(this.consentA.affectsAllFields()).thenReturn(false); when(this.consentB.affectsAllFields()).thenReturn(false); when(this.consentA.affectsSomeFields()).thenReturn(true); when(this.consentB.affectsSomeFields()).thenReturn(true); when(this.consentA.getFields()).thenReturn(Arrays.asList(FIELD_A_LABEL, FIELD_B_LABEL)); when(this.consentB.getFields()).thenReturn(Collections.singletonList(FIELD_C_LABEL)); final boolean isElementConsented = this.component.isElementConsented(element, this.patient); Assert.assertFalse(isElementConsented); }
@Override public boolean isElementConsented(RecordElement element, Patient patient) { Set<Consent> missingConsents = this.consentManager.getMissingConsentsForPatient(patient); return this.isElementEnabled(element, this.getNonConsentedFieldSet(missingConsents)); }
DefaultConsentAuthorizer implements ConsentAuthorizer { @Override public boolean isElementConsented(RecordElement element, Patient patient) { Set<Consent> missingConsents = this.consentManager.getMissingConsentsForPatient(patient); return this.isElementEnabled(element, this.getNonConsentedFieldSet(missingConsents)); } }
DefaultConsentAuthorizer implements ConsentAuthorizer { @Override public boolean isElementConsented(RecordElement element, Patient patient) { Set<Consent> missingConsents = this.consentManager.getMissingConsentsForPatient(patient); return this.isElementEnabled(element, this.getNonConsentedFieldSet(missingConsents)); }  }
DefaultConsentAuthorizer implements ConsentAuthorizer { @Override public boolean isElementConsented(RecordElement element, Patient patient) { Set<Consent> missingConsents = this.consentManager.getMissingConsentsForPatient(patient); return this.isElementEnabled(element, this.getNonConsentedFieldSet(missingConsents)); }  @Override boolean consentsGloballyEnabled(); @Override List<RecordElement> filterForm(List<RecordElement> elements, Patient patient); @Override boolean authorizeInteraction(Patient patient); @Override boolean authorizeInteraction(Set<String> grantedConsents); @Override boolean isElementConsented(RecordElement element, Patient patient); }
DefaultConsentAuthorizer implements ConsentAuthorizer { @Override public boolean isElementConsented(RecordElement element, Patient patient) { Set<Consent> missingConsents = this.consentManager.getMissingConsentsForPatient(patient); return this.isElementEnabled(element, this.getNonConsentedFieldSet(missingConsents)); }  @Override boolean consentsGloballyEnabled(); @Override List<RecordElement> filterForm(List<RecordElement> elements, Patient patient); @Override boolean authorizeInteraction(Patient patient); @Override boolean authorizeInteraction(Set<String> grantedConsents); @Override boolean isElementConsented(RecordElement element, Patient patient);  }