@Override public Set<Consent> getMissingConsentsForPatient(Patient patient) { return this.getConsentsForPatient(patient, false); }
@Override public boolean grantConsent(Patient patient, String consentId) { return this.manageConsent(patient, consentId, true); }
@Override public boolean isGranted() { return this.getStatus() == ConsentStatus.YES; }
@Override public boolean setPatientConsents(Patient patient, Iterable<String> consents) { try { List<Consent> existingConsents = this.selectFromSystem(consents); SaveablePatientConsentHolder holder = this.getPatientConsentHolder(patient); holder.setConsents(convertToIds(existingConsents)); holder.save(); return true; } catch (Exception ex) { this.logger.error("Could not update consents in patient record {}. {}", patient, ex.getMessage()); } return false; }
/** * Forwards the call to {@link ConsentAuthorizer}. * * @return same as {@link ConsentAuthorizer#consentsGloballyEnabled()} */ public boolean consentsGloballyEnabled() { return this.authorizer.consentsGloballyEnabled(); } }
private SaveablePatientConsentHolder getPatientConsentHolder(Patient patient) throws Exception { XWikiDocument patientDoc = patient.getXDocument(); return new SaveablePatientConsentHolder(getXWikiConsentHolder(patientDoc), patientDoc, this.contextProvider.get()); }
@Override public boolean isElementConsented(RecordElement element, Patient patient) { Set<Consent> missingConsents = this.consentManager.getMissingConsentsForPatient(patient); return this.isElementEnabled(element, this.getNonConsentedFieldSet(missingConsents)); }
@Override public boolean authorizeInteraction(Patient patient) { return (patient != null) && this.containsRequiredConsents(this.consentManager.getMissingConsentsForPatient(patient)); }
@Override public Set<Consent> getAllConsentsForPatient(String patientId) { return this.getAllConsentsForPatient(this.repository.get(patientId)); }
@Override public Set<Consent> getMissingConsentsForPatient(String patientId) { return this.getMissingConsentsForPatient(this.repository.get(patientId)); }
@Override public boolean hasConsent(String patientId, String consentId) { return this.hasConsent(this.repository.get(patientId), consentId); }
/** * Forwards the call to {@link ConsentAuthorizer}. * * @return same as {@link ConsentAuthorizer#consentsGloballyEnabled()} */ public boolean consentsGloballyEnabled() { return this.authorizer.consentsGloballyEnabled(); } }
private SaveablePatientConsentHolder getPatientConsentHolder(Patient patient) throws Exception { XWikiDocument patientDoc = patient.getXDocument(); return new SaveablePatientConsentHolder(getXWikiConsentHolder(patientDoc), patientDoc, this.contextProvider.get()); }
@Override public Set<Consent> getAllConsentsForPatient(Patient patient) { return this.getConsentsForPatient(patient, true); }
@Override public boolean grantConsent(Patient patient, String consentId) { return this.manageConsent(patient, consentId, true); }
@Override public boolean isGranted() { return this.getStatus() == ConsentStatus.YES; }
@Override public Set<Consent> getMissingConsentsForPatient(Patient patient) { return this.getConsentsForPatient(patient, false); }
@Override public boolean revokeConsent(Patient patient, String consentId) { return this.manageConsent(patient, consentId, false); }
@Override public Set<Consent> getAllConsentsForPatient(Patient patient) { return this.getConsentsForPatient(patient, true); }
@Override public boolean revokeConsent(Patient patient, String consentId) { return this.manageConsent(patient, consentId, false); }