@Override public void writeJSON(Patient patient, JSONObject json, Collection<String> selectedFieldNames) { // this controller is only activated if a deprecated field is explicitly requested if (selectedFieldNames == null) { return; } DateFormat dateFormat = new SimpleDateFormat(this.configurationManager.getActiveConfiguration().getISODateFormat()); PatientData<PhenoTipsDate> datesData = patient.getData(DATA_NAME); boolean noData = (datesData == null || !datesData.isNamed()); for (String propertyName : this.getPatientDocumentProperties()) { // only a subset of fields was explicitly requested, and this field is not included if (!selectedFieldNames.contains(getControllingFieldName(propertyName))) { continue; } PhenoTipsDate data = noData ? null : datesData.get(propertyName); json.put(getJSONFieldName(propertyName), ((data == null || !data.isSet()) ? "" : dateFormat.format(data.toEarliestPossibleISODate()))); } }
@Override public void writeJSON(Patient patient, JSONObject json, Collection<String> selectedFieldNames) { // this controller is only activated if a deprecated field is explicitly requested if (selectedFieldNames == null) { return; } DateFormat dateFormat = new SimpleDateFormat(this.configurationManager.getActiveConfiguration().getISODateFormat()); PatientData<PhenoTipsDate> datesData = patient.getData(DATA_NAME); boolean noData = (datesData == null || !datesData.isNamed()); for (String propertyName : this.getPatientDocumentProperties()) { // only a subset of fields was explicitly requested, and this field is not included if (!selectedFieldNames.contains(getControllingFieldName(propertyName))) { continue; } PhenoTipsDate data = noData ? null : datesData.get(propertyName); json.put(getJSONFieldName(propertyName), ((data == null || !data.isSet()) ? "" : dateFormat.format(data.toEarliestPossibleISODate()))); } }