@Test public void loadCatchesExceptionWhenPatientDoesNotHavePatientClass() { doReturn(null).when(this.doc).getXObject(Patient.CLASS_REFERENCE); PatientData<Integer> result = this.component.load(this.patient); Assert.assertNull(result); }
@Override public PatientData<Integer> load(Patient patient) { try { XWikiDocument doc = patient.getXDocument(); BaseObject data = doc.getXObject(Patient.CLASS_REFERENCE); if (data == null) { return null; } Map<String, Integer> result = new LinkedHashMap<>(); for (String propertyName : getProperties()) { String value = data.getStringValue(propertyName); if (NumberUtils.isDigits(value)) { result.put(propertyName, Integer.valueOf(value)); } } return new DictionaryPatientData<>(DATA_NAME, result); } catch (Exception e) { this.logger.error(ERROR_MESSAGE_LOAD_FAILED, e.getMessage()); } return null; }
APGARController implements PatientDataController<Integer> { @Override public PatientData<Integer> load(Patient patient) { try { XWikiDocument doc = patient.getXDocument(); BaseObject data = doc.getXObject(Patient.CLASS_REFERENCE); if (data == null) { return null; } Map<String, Integer> result = new LinkedHashMap<>(); for (String propertyName : getProperties()) { String value = data.getStringValue(propertyName); if (NumberUtils.isDigits(value)) { result.put(propertyName, Integer.valueOf(value)); } } return new DictionaryPatientData<>(DATA_NAME, result); } catch (Exception e) { this.logger.error(ERROR_MESSAGE_LOAD_FAILED, e.getMessage()); } return null; } }
APGARController implements PatientDataController<Integer> { @Override public PatientData<Integer> load(Patient patient) { try { XWikiDocument doc = patient.getXDocument(); BaseObject data = doc.getXObject(Patient.CLASS_REFERENCE); if (data == null) { return null; } Map<String, Integer> result = new LinkedHashMap<>(); for (String propertyName : getProperties()) { String value = data.getStringValue(propertyName); if (NumberUtils.isDigits(value)) { result.put(propertyName, Integer.valueOf(value)); } } return new DictionaryPatientData<>(DATA_NAME, result); } catch (Exception e) { this.logger.error(ERROR_MESSAGE_LOAD_FAILED, e.getMessage()); } return null; }  }
APGARController implements PatientDataController<Integer> { @Override public PatientData<Integer> load(Patient patient) { try { XWikiDocument doc = patient.getXDocument(); BaseObject data = doc.getXObject(Patient.CLASS_REFERENCE); if (data == null) { return null; } Map<String, Integer> result = new LinkedHashMap<>(); for (String propertyName : getProperties()) { String value = data.getStringValue(propertyName); if (NumberUtils.isDigits(value)) { result.put(propertyName, Integer.valueOf(value)); } } return new DictionaryPatientData<>(DATA_NAME, result); } catch (Exception e) { this.logger.error(ERROR_MESSAGE_LOAD_FAILED, e.getMessage()); } return null; }  @Override PatientData<Integer> load(Patient patient); @Override void save(Patient patient); @Override void save(@Nonnull final Patient patient, @Nonnull final PatientWritePolicy policy); @Override void writeJSON(Patient patient, JSONObject json); @Override void writeJSON(Patient patient, JSONObject json, Collection<String> selectedFieldNames); @Override PatientData<Integer> readJSON(JSONObject json); @Override String getName(); }
APGARController implements PatientDataController<Integer> { @Override public PatientData<Integer> load(Patient patient) { try { XWikiDocument doc = patient.getXDocument(); BaseObject data = doc.getXObject(Patient.CLASS_REFERENCE); if (data == null) { return null; } Map<String, Integer> result = new LinkedHashMap<>(); for (String propertyName : getProperties()) { String value = data.getStringValue(propertyName); if (NumberUtils.isDigits(value)) { result.put(propertyName, Integer.valueOf(value)); } } return new DictionaryPatientData<>(DATA_NAME, result); } catch (Exception e) { this.logger.error(ERROR_MESSAGE_LOAD_FAILED, e.getMessage()); } return null; }  @Override PatientData<Integer> load(Patient patient); @Override void save(Patient patient); @Override void save(@Nonnull final Patient patient, @Nonnull final PatientWritePolicy policy); @Override void writeJSON(Patient patient, JSONObject json); @Override void writeJSON(Patient patient, JSONObject json, Collection<String> selectedFieldNames); @Override PatientData<Integer> readJSON(JSONObject json); @Override String getName();  }