/** * Disables {@code section} if it contains no enabled elements. * * @param section the patient record section */ private void disableSectionIfNoEnabledElements(@Nonnull final RecordSection section) { if (section.getEnabledElements().isEmpty()) { section.setEnabled(false); } }
/** * Disables {@code section} if it contains no enabled elements. * * @param section the patient record section */ private void disableSectionIfNoEnabledElements(@Nonnull final RecordSection section) { if (section.getEnabledElements().isEmpty()) { section.setEnabled(false); } }
@Override public List<String> getEnabledFieldNames() { final List<String> enabledFields = new LinkedList<>(); for (final RecordSection section : getEnabledSections()) { for (final RecordElement element : section.getEnabledElements()) { enabledFields.addAll(element.getDisplayedFields()); } } return Collections.unmodifiableList(enabledFields); }
@Override public List<String> getEnabledFieldNames() { List<String> result = new LinkedList<String>(); for (RecordSection section : getEnabledSections()) { for (RecordElement element : section.getEnabledElements()) { result.addAll(element.getDisplayedFields()); } } return Collections.unmodifiableList(result); }
@SuppressWarnings("deprecation") @Override public List<String> getEnabledNonIdentifiableFieldNames() { List<String> result = new LinkedList<>(); for (RecordSection section : getEnabledSections()) { for (RecordElement element : section.getEnabledElements()) { if (!element.containsPrivateIdentifiableInformation()) { result.addAll(element.getDisplayedFields()); } } } return Collections.unmodifiableList(result); }
@Override public List<String> getEnabledNonIdentifiableFieldNames() { List<String> result = new LinkedList<String>(); for (RecordSection section : getEnabledSections()) { for (RecordElement element : section.getEnabledElements()) { if (!element.containsPrivateIdentifiableInformation()) { result.addAll(element.getDisplayedFields()); } } } return Collections.unmodifiableList(result); }
@Override public RecordConfiguration process(RecordConfiguration config) { if (config == null) { return null; } final Patient patient = this.patients.get(this.dab.getCurrentDocumentReference()); if (patient == null) { return config; } for (final RecordSection section : config.getEnabledSections()) { // Filter elements by consents. final List<RecordElement> enabledElements = Collections.unmodifiableList(section.getEnabledElements()); final List<RecordElement> consentedElements = this.consentAuthorizer.filterForm(enabledElements, patient); disableNonConsentedElements(enabledElements, consentedElements); disableSectionIfNoEnabledElements(section); } return config; }
@Override public RecordConfiguration process(RecordConfiguration config) { if (config == null || this.dab.getCurrentDocumentReference() == null) { return config; } final Patient patient = this.patients.get(this.dab.getCurrentDocumentReference()); if (patient == null) { return config; } for (final RecordSection section : config.getEnabledSections()) { // Filter elements by consents. final List<RecordElement> enabledElements = Collections.unmodifiableList(section.getEnabledElements()); final List<RecordElement> consentedElements = this.consentAuthorizer.filterForm(enabledElements, patient); disableNonConsentedElements(enabledElements, consentedElements); disableSectionIfNoEnabledElements(section); } return config; }