@Override public boolean isValidConsentId(String consentId) { Set<Consent> systemConsents = getSystemConsents(); for (Consent consent : systemConsents) { if (StringUtils.equals(consentId, consent.getId())) { return true; } } return false; }
@Override public boolean isValidConsentId(String consentId) { Set<Consent> systemConsents = getSystemConsents(); for (Consent consent : systemConsents) { if (StringUtils.equals(consentId, consent.getId())) { return true; } } return false; }
/** @return consents that exist in the system and correspond to the given ids */ private List<Consent> selectFromSystem(Iterable<String> ids) { List<Consent> existingConsents = new LinkedList<>(); for (String id : ids) { for (Consent consent : this.getSystemConsents()) { if (StringUtils.equals(consent.getId(), id)) { existingConsents.add(consent); break; } } } return existingConsents; }
/** * @return consents that exist in the system and correspond to the given ids */ private List<Consent> selectFromSystem(Iterable<String> ids) { List<Consent> existingConsents = new LinkedList<>(); for (String id : ids) { for (Consent consent : this.getSystemConsents()) { if (StringUtils.equals(consent.getId(), id)) { existingConsents.add(consent); break; } } } return existingConsents; }
private Set<Consent> getConsentsForPatient(Patient patient, boolean includeGranted) { if (patient == null) { return null; } // List of consent ids a patient has agreed to, read from the database Set<String> xwikiPatientConsents = readConsentIdsFromPatientDoc(patient); Set<Consent> returnedConsents = new LinkedHashSet<>(); // Using system consents to ignore consents set for the patient but no longer configured in the system // (it is faster to check contains() in a set, so iterating through the list and checking the set) Set<Consent> systemConsents = getSystemConsents(); for (Consent systemConsent : systemConsents) { if (xwikiPatientConsents.contains(systemConsent.getId())) { if (includeGranted) { Consent copy = systemConsent.copy(ConsentStatus.YES); returnedConsents.add(copy); } } else { Consent copy = systemConsent.copy(ConsentStatus.NO); returnedConsents.add(copy); } } return returnedConsents; }
private Set<Consent> getConsentsForPatient(Patient patient, boolean includeGranted) { if (patient == null) { return null; } // List of consent ids a patient has agreed to, read from the database Set<String> xwikiPatientConsents = readConsentIdsFromPatientDoc(patient); Set<Consent> returnedConsents = new LinkedHashSet<>(); // Using system consents to ignore consents set for the patient but no longer configured in the system // (it is faster to check contains() in a set, so iterating through the list and checking the set) Set<Consent> systemConsents = getSystemConsents(); for (Consent systemConsent : systemConsents) { if (xwikiPatientConsents.contains(systemConsent.getId())) { if (includeGranted) { Consent copy = systemConsent.copy(ConsentStatus.YES); returnedConsents.add(copy); } } else { Consent copy = systemConsent.copy(ConsentStatus.NO); returnedConsents.add(copy); } } return returnedConsents; }