@Test public void checkLoadParsingOfInterpretationKey() throws ComponentLookupException { addVariantFields(INTERPRETATION_KEY, new String[] { "pathogenic", "likely_pathogenic", "likely_benign", "benign", "variant_u_s", "investigation_n" }); PatientData<Map<String, String>> result = this.mocker.getComponentUnderTest().load(this.patient); Assert.assertNotNull(result); Assert.assertEquals("pathogenic", result.get(0).get(INTERPRETATION_KEY)); Assert.assertEquals("likely_pathogenic", result.get(1).get(INTERPRETATION_KEY)); Assert.assertEquals("likely_benign", result.get(2).get(INTERPRETATION_KEY)); Assert.assertEquals("benign", result.get(3).get(INTERPRETATION_KEY)); Assert.assertEquals("variant_u_s", result.get(4).get(INTERPRETATION_KEY)); Assert.assertEquals("investigation_n", result.get(5).get(INTERPRETATION_KEY)); }
@Override public PatientData<Map<String, String>> load(Patient patient) { try { XWikiDocument doc = patient.getXDocument(); List<BaseObject> variantXWikiObjects = doc.getXObjects(VARIANT_CLASS_REFERENCE); if (variantXWikiObjects == null || variantXWikiObjects.isEmpty()) { return null; } List<Map<String, String>> allVariants = new LinkedList<>(); for (BaseObject variantObject : variantXWikiObjects) { if (variantObject == null || variantObject.getFieldList().isEmpty()) { continue; } Map<String, String> singleVariant = new LinkedHashMap<>(); for (String property : getProperties()) { String value = getFieldValue(variantObject, property); if (value == null) { continue; } singleVariant.put(property, value); } allVariants.add(singleVariant); } if (allVariants.isEmpty()) { return null; } else { return new IndexedPatientData<>(getName(), allVariants); } } catch (Exception e) { this.logger.error(ERROR_MESSAGE_LOAD_FAILED, e.getMessage()); } return null; }
VariantListController extends AbstractComplexController<Map<String, String>> { @Override public PatientData<Map<String, String>> load(Patient patient) { try { XWikiDocument doc = patient.getXDocument(); List<BaseObject> variantXWikiObjects = doc.getXObjects(VARIANT_CLASS_REFERENCE); if (variantXWikiObjects == null || variantXWikiObjects.isEmpty()) { return null; } List<Map<String, String>> allVariants = new LinkedList<>(); for (BaseObject variantObject : variantXWikiObjects) { if (variantObject == null || variantObject.getFieldList().isEmpty()) { continue; } Map<String, String> singleVariant = new LinkedHashMap<>(); for (String property : getProperties()) { String value = getFieldValue(variantObject, property); if (value == null) { continue; } singleVariant.put(property, value); } allVariants.add(singleVariant); } if (allVariants.isEmpty()) { return null; } else { return new IndexedPatientData<>(getName(), allVariants); } } catch (Exception e) { this.logger.error(ERROR_MESSAGE_LOAD_FAILED, e.getMessage()); } return null; } }
VariantListController extends AbstractComplexController<Map<String, String>> { @Override public PatientData<Map<String, String>> load(Patient patient) { try { XWikiDocument doc = patient.getXDocument(); List<BaseObject> variantXWikiObjects = doc.getXObjects(VARIANT_CLASS_REFERENCE); if (variantXWikiObjects == null || variantXWikiObjects.isEmpty()) { return null; } List<Map<String, String>> allVariants = new LinkedList<>(); for (BaseObject variantObject : variantXWikiObjects) { if (variantObject == null || variantObject.getFieldList().isEmpty()) { continue; } Map<String, String> singleVariant = new LinkedHashMap<>(); for (String property : getProperties()) { String value = getFieldValue(variantObject, property); if (value == null) { continue; } singleVariant.put(property, value); } allVariants.add(singleVariant); } if (allVariants.isEmpty()) { return null; } else { return new IndexedPatientData<>(getName(), allVariants); } } catch (Exception e) { this.logger.error(ERROR_MESSAGE_LOAD_FAILED, e.getMessage()); } return null; }  }
VariantListController extends AbstractComplexController<Map<String, String>> { @Override public PatientData<Map<String, String>> load(Patient patient) { try { XWikiDocument doc = patient.getXDocument(); List<BaseObject> variantXWikiObjects = doc.getXObjects(VARIANT_CLASS_REFERENCE); if (variantXWikiObjects == null || variantXWikiObjects.isEmpty()) { return null; } List<Map<String, String>> allVariants = new LinkedList<>(); for (BaseObject variantObject : variantXWikiObjects) { if (variantObject == null || variantObject.getFieldList().isEmpty()) { continue; } Map<String, String> singleVariant = new LinkedHashMap<>(); for (String property : getProperties()) { String value = getFieldValue(variantObject, property); if (value == null) { continue; } singleVariant.put(property, value); } allVariants.add(singleVariant); } if (allVariants.isEmpty()) { return null; } else { return new IndexedPatientData<>(getName(), allVariants); } } catch (Exception e) { this.logger.error(ERROR_MESSAGE_LOAD_FAILED, e.getMessage()); } return null; }  @Override String getName(); @Override PatientData<Map<String, String>> load(Patient patient); @SuppressWarnings("checkstyle:CyclomaticComplexity") @Override void writeJSON(Patient patient, JSONObject json, Collection<String> selectedFieldNames); @Override PatientData<Map<String, String>> readJSON(JSONObject json); @Override void save(Patient patient); @Override void save(@Nonnull final Patient patient, @Nonnull final PatientWritePolicy policy); }
VariantListController extends AbstractComplexController<Map<String, String>> { @Override public PatientData<Map<String, String>> load(Patient patient) { try { XWikiDocument doc = patient.getXDocument(); List<BaseObject> variantXWikiObjects = doc.getXObjects(VARIANT_CLASS_REFERENCE); if (variantXWikiObjects == null || variantXWikiObjects.isEmpty()) { return null; } List<Map<String, String>> allVariants = new LinkedList<>(); for (BaseObject variantObject : variantXWikiObjects) { if (variantObject == null || variantObject.getFieldList().isEmpty()) { continue; } Map<String, String> singleVariant = new LinkedHashMap<>(); for (String property : getProperties()) { String value = getFieldValue(variantObject, property); if (value == null) { continue; } singleVariant.put(property, value); } allVariants.add(singleVariant); } if (allVariants.isEmpty()) { return null; } else { return new IndexedPatientData<>(getName(), allVariants); } } catch (Exception e) { this.logger.error(ERROR_MESSAGE_LOAD_FAILED, e.getMessage()); } return null; }  @Override String getName(); @Override PatientData<Map<String, String>> load(Patient patient); @SuppressWarnings("checkstyle:CyclomaticComplexity") @Override void writeJSON(Patient patient, JSONObject json, Collection<String> selectedFieldNames); @Override PatientData<Map<String, String>> readJSON(JSONObject json); @Override void save(Patient patient); @Override void save(@Nonnull final Patient patient, @Nonnull final PatientWritePolicy policy);  }