@Override public boolean hasConsent(Patient patient, String consentId) { if (patient == null || !isValidConsentId(consentId)) { return false; } Set<Consent> missingPatientConsents = getMissingConsentsForPatient(patient); if (missingPatientConsents == null) { return false; } for (Consent consent : missingPatientConsents) { if (consent.getId().equals(consentId)) { return false; } } return true; }
@Override public boolean hasConsent(Patient patient, String consentId) { if (patient == null || !isValidConsentId(consentId)) { return false; } Set<Consent> missingPatientConsents = getMissingConsentsForPatient(patient); if (missingPatientConsents == null) { return false; } for (Consent consent : missingPatientConsents) { if (consent.getId().equals(consentId)) { return false; } } return true; }
/** * @param grant if true will grant the consent, otherwise will revoke * @return if operation was successful */ private boolean manageConsent(Patient patient, String consentId, boolean grant) { if (!this.isValidConsentId(consentId)) { this.logger.error("Invalid consent id ({}) was supplied", consentId); return false; } try { SaveablePatientConsentHolder consentHolder = this.getPatientConsentHolder(patient); List<String> currentConsents = consentHolder.getConsents(); if (grant) { if (!currentConsents.contains(consentId)) { currentConsents.add(consentId); } } else { currentConsents.remove(consentId); } consentHolder.setConsents(currentConsents); consentHolder.save(); return true; } catch (Exception ex) { this.logger.error("Could not update consent {} in patient record {}. {}", consentId, patient.getId(), ex.getMessage()); return false; } }
/** * @param grant if true will grant the consent, otherwise will revoke * @return if operation was successful */ private boolean manageConsent(Patient patient, String consentId, boolean grant) { if (!this.isValidConsentId(consentId)) { this.logger.error("Invalid consent id ({}) was supplied", consentId); return false; } try { SaveablePatientConsentHolder consentHolder = this.getPatientConsentHolder(patient); List<String> currentConsents = consentHolder.getConsents(); if (grant) { if (!currentConsents.contains(consentId)) { currentConsents.add(consentId); } } else { currentConsents.remove(consentId); } consentHolder.setConsents(currentConsents); consentHolder.save(); return true; } catch (Exception ex) { this.logger.error("Could not update consent {} in patient record {}. {}", consentId, patient.getId(), ex.getMessage()); return false; } }