private Patient getLocalPatient() { if (this.isLocal()) { return PATIENT_REPOSITORY.get(this.patientId); } else { return null; } }
@Override public Set<Consent> getAllConsentsForPatient(String patientId) { return this.getAllConsentsForPatient(this.repository.get(patientId)); }
/** * Locks the patient record. * * @param patientID The id of the patient to be locked * @return A {@link HttpStatus} indicating the status of the request. */ public int lockPatient(String patientID) { Patient patient = this.pr.get(patientID); return patient == null ? HttpStatus.SC_BAD_REQUEST : this.lockPatient(patient); }
@Override public boolean hasConsent(String patientId, String consentId) { return this.hasConsent(this.repository.get(patientId), consentId); }
/** * Finds a patient by `patientId`, and calls {@link ConsentAuthorizer#filterForm(List, Patient)}. * * @param elements of a patient form to be filtered * @param patientId of a patient whose data will be displayed through the `elements` * @return same as {@link ConsentAuthorizer#filterForm(List, Patient)} */ public List<RecordElement> filterEnabled(List<RecordElement> elements, String patientId) { Patient patient = this.repository.get(patientId); return this.authorizer.filterForm(elements, patient); }
@Override public Set<Consent> getAllConsentsForPatient(String patientId) { return this.getAllConsentsForPatient(this.repository.get(patientId)); }
@Override public boolean hasConsent(String patientId, String consentId) { return this.hasConsent(this.repository.get(patientId), consentId); }
/** * Locks the patient record. * * @param patientID The id of the patient to be locked * @return A {@link HttpStatus} indicating the status of the request. */ public int lockPatient(String patientID) { Patient patient = this.pr.get(patientID); return patient == null ? HttpStatus.SC_BAD_REQUEST : this.lockPatient(patient); }
@Override public boolean hasConsent(String patientId, String consentId) { return this.hasConsent(this.repository.get(patientId), consentId); }
/** * Finds a patient by `patientId`, and calls {@link ConsentAuthorizer#filterForm(List, Patient)}. * * @param elements of a patient form to be filtered * @param patientId of a patient whose data will be displayed through the `elements` * @return same as {@link ConsentAuthorizer#filterForm(List, Patient)} */ public List<RecordElement> filterEnabled(List<RecordElement> elements, String patientId) { Patient patient = this.repository.get(patientId); return this.authorizer.filterForm(elements, patient); }
@Override public Set<Consent> getMissingConsentsForPatient(String patientId) { return this.getMissingConsentsForPatient(this.repository.get(patientId)); }
@Override public List<Patient> getMembers() { List<String> memberIds = this.getMembersIds(); List<Patient> members = new ArrayList<>(memberIds.size()); for (String memberId : memberIds) { Patient patient = PhenotipsFamily.patientRepository.get(memberId); members.add(patient); } return members; }
/** * Finds a patient by `patientId`, and calls {@link ConsentAuthorizer#filterForm(List, Patient)}. * @param elements of a patient form to be filtered * @param patientId of a patient whose data will be displayed through the `elements` * @return same as {@link ConsentAuthorizer#filterForm(List, Patient)} */ public List<RecordElement> filterEnabled(List<RecordElement> elements, String patientId) { Patient patient = this.repository.get(patientId); return this.authorizer.filterForm(elements, patient); }
@Override public Set<Consent> getMissingConsentsForPatient(String patientId) { return this.getMissingConsentsForPatient(this.repository.get(patientId)); }
/** * Unlocks the patient record. * * @param patientID The id of the patient to be unlocked * @return A {@link HttpStatus} indicating the status of the request. */ public int unlockPatient(String patientID) { Patient patient = this.pr.get(patientID); return patient == null ? HttpStatus.SC_BAD_REQUEST : this.unlockPatient(patient); }
@Override public Patient get(DocumentReference reference) { Patient patient = this.internalService.get(reference); return checkAccess(patient, this.userManager.getCurrentUser()); }
private static Patient getPatient(String patientId) { PatientRepository patientRepository = null; try { ComponentManager ccm = ComponentManagerRegistry.getContextComponentManager(); patientRepository = ccm.getInstance(PatientRepository.class); } catch (ComponentLookupException e) { return null; } return patientRepository.get(patientId); } }
@Override public Patient get(String id) { Patient patient = this.internalService.get(id); return checkAccess(patient, this.userManager.getCurrentUser()); }
private Patient resolvePatient(String serializedReference) { try { PatientRepository resolver = ComponentManagerRegistry.getContextComponentManager().getInstance(PatientRepository.class); return resolver.get(serializedReference); } catch (ComponentLookupException ex) { // This really shouldn't happen... } return null; } }
@Override public Patient get(String id) { Patient patient = this.internalService.get(id); return checkAccess(patient, this.userManager.getCurrentUser()); }