@Test public void occurrenceAsExtensionTest() { String id = "1"; String somethingCore = "somethingCore"; String somethingExt = "somethingExt"; Map<String, String> coreMap = Collections.singletonMap(somethingCore, somethingCore); Map<String, String> extMap = new HashMap<>(2); extMap.put(DwcTerm.occurrenceID.qualifiedName(), id); extMap.put(somethingExt, somethingExt); Optional<ExtendedRecord> result = OccurrenceExtensionConverter.convert(coreMap, extMap); Assert.assertTrue(result.isPresent()); ExtendedRecord erResult = result.get(); Assert.assertEquals(id, erResult.getId()); Assert.assertEquals(somethingCore, erResult.getCoreTerms().get(somethingCore)); Assert.assertEquals(somethingExt, erResult.getCoreTerms().get(somethingExt)); }
public static Optional<ExtendedRecord> convert( Map<String, String> coreMap, Map<String, String> extMap) { String id = extMap.get(DwcTerm.occurrenceID.qualifiedName()); if (!Strings.isNullOrEmpty(id)) { ExtendedRecord extendedRecord = ExtendedRecord.newBuilder().setId(id).build(); extendedRecord.getCoreTerms().putAll(coreMap); extendedRecord.getCoreTerms().putAll(extMap); return Optional.of(extendedRecord); } return Optional.empty(); }
OccurrenceExtensionConverter { public static Optional<ExtendedRecord> convert( Map<String, String> coreMap, Map<String, String> extMap) { String id = extMap.get(DwcTerm.occurrenceID.qualifiedName()); if (!Strings.isNullOrEmpty(id)) { ExtendedRecord extendedRecord = ExtendedRecord.newBuilder().setId(id).build(); extendedRecord.getCoreTerms().putAll(coreMap); extendedRecord.getCoreTerms().putAll(extMap); return Optional.of(extendedRecord); } return Optional.empty(); } }
OccurrenceExtensionConverter { public static Optional<ExtendedRecord> convert( Map<String, String> coreMap, Map<String, String> extMap) { String id = extMap.get(DwcTerm.occurrenceID.qualifiedName()); if (!Strings.isNullOrEmpty(id)) { ExtendedRecord extendedRecord = ExtendedRecord.newBuilder().setId(id).build(); extendedRecord.getCoreTerms().putAll(coreMap); extendedRecord.getCoreTerms().putAll(extMap); return Optional.of(extendedRecord); } return Optional.empty(); }  }
OccurrenceExtensionConverter { public static Optional<ExtendedRecord> convert( Map<String, String> coreMap, Map<String, String> extMap) { String id = extMap.get(DwcTerm.occurrenceID.qualifiedName()); if (!Strings.isNullOrEmpty(id)) { ExtendedRecord extendedRecord = ExtendedRecord.newBuilder().setId(id).build(); extendedRecord.getCoreTerms().putAll(coreMap); extendedRecord.getCoreTerms().putAll(extMap); return Optional.of(extendedRecord); } return Optional.empty(); }  static Optional<ExtendedRecord> convert(
      Map<String, String> coreMap, Map<String, String> extMap); }
OccurrenceExtensionConverter { public static Optional<ExtendedRecord> convert( Map<String, String> coreMap, Map<String, String> extMap) { String id = extMap.get(DwcTerm.occurrenceID.qualifiedName()); if (!Strings.isNullOrEmpty(id)) { ExtendedRecord extendedRecord = ExtendedRecord.newBuilder().setId(id).build(); extendedRecord.getCoreTerms().putAll(coreMap); extendedRecord.getCoreTerms().putAll(extMap); return Optional.of(extendedRecord); } return Optional.empty(); }  static Optional<ExtendedRecord> convert(
      Map<String, String> coreMap, Map<String, String> extMap);  }