private void updatePatientsFromJson(Pedigree pedigree, User updatingUser) { String idKey = "id"; try { List<JSONObject> patientsJson = this.pedigreeConverter.convert(pedigree); for (JSONObject singlePatient : patientsJson) { if (singlePatient.has(idKey)) { Patient patient = this.patientRepository.get(singlePatient.getString(idKey)); if (!this.authorizationService.hasAccess( updatingUser, Right.EDIT, patient.getDocumentReference())) { // skip patients the current user does not have edit rights for continue; } patient.updateFromJSON(singlePatient); } } } catch (Exception ex) { throw new PTInternalErrorException(); } }
private void updatePatientsFromJson(Pedigree pedigree, User updatingUser) { String idKey = "id"; try { List<JSONObject> patientsJson = this.pedigreeConverter.convert(pedigree); for (JSONObject singlePatient : patientsJson) { if (singlePatient.has(idKey)) { Patient patient = this.patientRepository.get(singlePatient.getString(idKey)); if (!this.authorizationService.hasAccess(updatingUser, Right.EDIT, patient.getDocument())) { // skip patients the current user does not have edit rights for continue; } patient.updateFromJSON(singlePatient); } } } catch (Exception ex) { throw new PTInternalErrorException(); } }