@Test public void readWithEmptyDataDoesNothing() throws ComponentLookupException { final JSONObject json = new JSONObject(); json.put(CONTROLLER_NAME, new JSONArray()); final PatientData<Pair<String, String>> result = this.component.readJSON(json); Assert.assertNull(result); }
@Override public PatientData<Pair<String, String>> readJSON(@Nullable final JSONObject json) { if (json == null || !json.has(IDENTIFIERS_STRING)) { return null; } List<Pair<String, String>> identifiers = toIdentifiers(json.optJSONArray(IDENTIFIERS_STRING)); if (identifiers == null || identifiers.isEmpty()) { return null; } return new IndexedPatientData<>(CONTROLLER_NAME, identifiers); }
LabeledExternalIdentifiersController implements PatientDataController<Pair<String, String>> { @Override public PatientData<Pair<String, String>> readJSON(@Nullable final JSONObject json) { if (json == null || !json.has(IDENTIFIERS_STRING)) { return null; } List<Pair<String, String>> identifiers = toIdentifiers(json.optJSONArray(IDENTIFIERS_STRING)); if (identifiers == null || identifiers.isEmpty()) { return null; } return new IndexedPatientData<>(CONTROLLER_NAME, identifiers); } }
LabeledExternalIdentifiersController implements PatientDataController<Pair<String, String>> { @Override public PatientData<Pair<String, String>> readJSON(@Nullable final JSONObject json) { if (json == null || !json.has(IDENTIFIERS_STRING)) { return null; } List<Pair<String, String>> identifiers = toIdentifiers(json.optJSONArray(IDENTIFIERS_STRING)); if (identifiers == null || identifiers.isEmpty()) { return null; } return new IndexedPatientData<>(CONTROLLER_NAME, identifiers); }  }
LabeledExternalIdentifiersController implements PatientDataController<Pair<String, String>> { @Override public PatientData<Pair<String, String>> readJSON(@Nullable final JSONObject json) { if (json == null || !json.has(IDENTIFIERS_STRING)) { return null; } List<Pair<String, String>> identifiers = toIdentifiers(json.optJSONArray(IDENTIFIERS_STRING)); if (identifiers == null || identifiers.isEmpty()) { return null; } return new IndexedPatientData<>(CONTROLLER_NAME, identifiers); }  @Override String getName(); @Override PatientData<Pair<String, String>> load(final Patient patient); @Override void writeJSON(@Nonnull final Patient patient, @Nonnull final JSONObject json,
        @Nullable final Collection<String> selectedFieldNames); @Override void writeJSON(@Nonnull final Patient patient, @Nonnull final JSONObject json); @Override PatientData<Pair<String, String>> readJSON(@Nullable final JSONObject json); @Override void save(@Nonnull final Patient patient); @Override void save(@Nonnull final Patient patient, @Nonnull final PatientWritePolicy policy); }
LabeledExternalIdentifiersController implements PatientDataController<Pair<String, String>> { @Override public PatientData<Pair<String, String>> readJSON(@Nullable final JSONObject json) { if (json == null || !json.has(IDENTIFIERS_STRING)) { return null; } List<Pair<String, String>> identifiers = toIdentifiers(json.optJSONArray(IDENTIFIERS_STRING)); if (identifiers == null || identifiers.isEmpty()) { return null; } return new IndexedPatientData<>(CONTROLLER_NAME, identifiers); }  @Override String getName(); @Override PatientData<Pair<String, String>> load(final Patient patient); @Override void writeJSON(@Nonnull final Patient patient, @Nonnull final JSONObject json,
        @Nullable final Collection<String> selectedFieldNames); @Override void writeJSON(@Nonnull final Patient patient, @Nonnull final JSONObject json); @Override PatientData<Pair<String, String>> readJSON(@Nullable final JSONObject json); @Override void save(@Nonnull final Patient patient); @Override void save(@Nonnull final Patient patient, @Nonnull final PatientWritePolicy policy);  }