@Test public void interactionListener2Test() throws IOException, StudyImporterException { final List<Map<String, String>> links = new ArrayList<Map<String, String>>(); JsonNode config = new ObjectMapper().readTree("{ \"dcterms:bibliographicCitation\":\"some citation\", \"url\":\"https: DatasetImpl dataset = new DatasetImpl(null, URI.create("http: dataset.setConfig(config); final TableInteractionListenerProxy listener = new TableInteractionListenerProxy(dataset, new InteractionListener() { @Override public void newLink(Map<String, String> link) throws StudyImporterException { links.add(link); } }); listener.newLink(new HashMap<String, String>() { { put(DatasetImporterForTSV.REFERENCE_CITATION, "some ref"); } }); assertThat(links.size(), is(1)); assertThat(links.get(0).get(DatasetImporterForTSV.STUDY_SOURCE_CITATION), startsWith("some citation. Accessed at <https: assertThat(links.get(0).get(DatasetImporterForTSV.REFERENCE_CITATION), startsWith("some ref")); }
@Override public void newLink(final Map<String, String> link) throws StudyImporterException { final Map<String, String> enrichedProperties = new TreeMap<String, String>() { { putAll(link); put(DatasetImporterForTSV.STUDY_SOURCE_CITATION, dataSourceCitation); final String referenceCitation = StringUtils.isBlank(link.get(DatasetImporterForTSV.REFERENCE_CITATION)) ? DatasetImporterForMetaTable.generateReferenceCitation(link) : link.get(DatasetImporterForTSV.REFERENCE_CITATION); put(DatasetImporterForTSV.REFERENCE_ID, dataSourceCitation + referenceCitation); put(DatasetImporterForTSV.REFERENCE_CITATION, StringUtils.isBlank(referenceCitation) ? dataSourceCitation : referenceCitation); } }; interactionListener.newLink(enrichedProperties); }
TableInteractionListenerProxy implements InteractionListener { @Override public void newLink(final Map<String, String> link) throws StudyImporterException { final Map<String, String> enrichedProperties = new TreeMap<String, String>() { { putAll(link); put(DatasetImporterForTSV.STUDY_SOURCE_CITATION, dataSourceCitation); final String referenceCitation = StringUtils.isBlank(link.get(DatasetImporterForTSV.REFERENCE_CITATION)) ? DatasetImporterForMetaTable.generateReferenceCitation(link) : link.get(DatasetImporterForTSV.REFERENCE_CITATION); put(DatasetImporterForTSV.REFERENCE_ID, dataSourceCitation + referenceCitation); put(DatasetImporterForTSV.REFERENCE_CITATION, StringUtils.isBlank(referenceCitation) ? dataSourceCitation : referenceCitation); } }; interactionListener.newLink(enrichedProperties); } }
TableInteractionListenerProxy implements InteractionListener { @Override public void newLink(final Map<String, String> link) throws StudyImporterException { final Map<String, String> enrichedProperties = new TreeMap<String, String>() { { putAll(link); put(DatasetImporterForTSV.STUDY_SOURCE_CITATION, dataSourceCitation); final String referenceCitation = StringUtils.isBlank(link.get(DatasetImporterForTSV.REFERENCE_CITATION)) ? DatasetImporterForMetaTable.generateReferenceCitation(link) : link.get(DatasetImporterForTSV.REFERENCE_CITATION); put(DatasetImporterForTSV.REFERENCE_ID, dataSourceCitation + referenceCitation); put(DatasetImporterForTSV.REFERENCE_CITATION, StringUtils.isBlank(referenceCitation) ? dataSourceCitation : referenceCitation); } }; interactionListener.newLink(enrichedProperties); } TableInteractionListenerProxy(Dataset dataset, InteractionListener interactionListener); }
TableInteractionListenerProxy implements InteractionListener { @Override public void newLink(final Map<String, String> link) throws StudyImporterException { final Map<String, String> enrichedProperties = new TreeMap<String, String>() { { putAll(link); put(DatasetImporterForTSV.STUDY_SOURCE_CITATION, dataSourceCitation); final String referenceCitation = StringUtils.isBlank(link.get(DatasetImporterForTSV.REFERENCE_CITATION)) ? DatasetImporterForMetaTable.generateReferenceCitation(link) : link.get(DatasetImporterForTSV.REFERENCE_CITATION); put(DatasetImporterForTSV.REFERENCE_ID, dataSourceCitation + referenceCitation); put(DatasetImporterForTSV.REFERENCE_CITATION, StringUtils.isBlank(referenceCitation) ? dataSourceCitation : referenceCitation); } }; interactionListener.newLink(enrichedProperties); } TableInteractionListenerProxy(Dataset dataset, InteractionListener interactionListener); @Override void newLink(final Map<String, String> link); }
TableInteractionListenerProxy implements InteractionListener { @Override public void newLink(final Map<String, String> link) throws StudyImporterException { final Map<String, String> enrichedProperties = new TreeMap<String, String>() { { putAll(link); put(DatasetImporterForTSV.STUDY_SOURCE_CITATION, dataSourceCitation); final String referenceCitation = StringUtils.isBlank(link.get(DatasetImporterForTSV.REFERENCE_CITATION)) ? DatasetImporterForMetaTable.generateReferenceCitation(link) : link.get(DatasetImporterForTSV.REFERENCE_CITATION); put(DatasetImporterForTSV.REFERENCE_ID, dataSourceCitation + referenceCitation); put(DatasetImporterForTSV.REFERENCE_CITATION, StringUtils.isBlank(referenceCitation) ? dataSourceCitation : referenceCitation); } }; interactionListener.newLink(enrichedProperties); } TableInteractionListenerProxy(Dataset dataset, InteractionListener interactionListener); @Override void newLink(final Map<String, String> link);  }