@Test public void grscicollMapperTest() { Institution institution = Institution.newBuilder() .setCode("I1") .setKey("cb0098db-6ff6-4a5d-ad29-51348d114e41") .build(); InstitutionMatch institutionMatch = InstitutionMatch.newBuilder() .setInstitution(institution) .setMatchType(MatchType.EXACT.name()) .build(); Collection collection = Collection.newBuilder() .setKey("5c692584-d517-48e8-93a8-a916ba131d9b") .setCode("C1") .build(); CollectionMatch collectionMatch = CollectionMatch.newBuilder() .setCollection(collection) .setMatchType(MatchType.FUZZY.name()) .build(); GrscicollRecord record = GrscicollRecord.newBuilder() .setId("1") .setInstitutionMatch(institutionMatch) .setCollectionMatch(collectionMatch) .build(); OccurrenceHdfsRecord hdfsRecord = toOccurrenceHdfsRecord(record); Assert.assertEquals(institution.getKey(), hdfsRecord.getInstitutionkey()); Assert.assertEquals(collection.getKey(), hdfsRecord.getCollectionkey()); }
private static BiConsumer<OccurrenceHdfsRecord, SpecificRecordBase> grscicollMapper() { return (hr, sr) -> { GrscicollRecord gr = (GrscicollRecord) sr; if (gr.getInstitutionMatch() != null) { Institution institution = gr.getInstitutionMatch().getInstitution(); if (institution != null) { hr.setInstitutionkey(institution.getKey()); } } if (gr.getCollectionMatch() != null) { Collection collection = gr.getCollectionMatch().getCollection(); if (collection != null) { hr.setCollectionkey(collection.getKey()); } } }; }
OccurrenceHdfsRecordConverter { private static BiConsumer<OccurrenceHdfsRecord, SpecificRecordBase> grscicollMapper() { return (hr, sr) -> { GrscicollRecord gr = (GrscicollRecord) sr; if (gr.getInstitutionMatch() != null) { Institution institution = gr.getInstitutionMatch().getInstitution(); if (institution != null) { hr.setInstitutionkey(institution.getKey()); } } if (gr.getCollectionMatch() != null) { Collection collection = gr.getCollectionMatch().getCollection(); if (collection != null) { hr.setCollectionkey(collection.getKey()); } } }; } }
OccurrenceHdfsRecordConverter { private static BiConsumer<OccurrenceHdfsRecord, SpecificRecordBase> grscicollMapper() { return (hr, sr) -> { GrscicollRecord gr = (GrscicollRecord) sr; if (gr.getInstitutionMatch() != null) { Institution institution = gr.getInstitutionMatch().getInstitution(); if (institution != null) { hr.setInstitutionkey(institution.getKey()); } } if (gr.getCollectionMatch() != null) { Collection collection = gr.getCollectionMatch().getCollection(); if (collection != null) { hr.setCollectionkey(collection.getKey()); } } }; }  }
OccurrenceHdfsRecordConverter { private static BiConsumer<OccurrenceHdfsRecord, SpecificRecordBase> grscicollMapper() { return (hr, sr) -> { GrscicollRecord gr = (GrscicollRecord) sr; if (gr.getInstitutionMatch() != null) { Institution institution = gr.getInstitutionMatch().getInstitution(); if (institution != null) { hr.setInstitutionkey(institution.getKey()); } } if (gr.getCollectionMatch() != null) { Collection collection = gr.getCollectionMatch().getCollection(); if (collection != null) { hr.setCollectionkey(collection.getKey()); } } }; }  static OccurrenceHdfsRecord toOccurrenceHdfsRecord(SpecificRecordBase... records); }
OccurrenceHdfsRecordConverter { private static BiConsumer<OccurrenceHdfsRecord, SpecificRecordBase> grscicollMapper() { return (hr, sr) -> { GrscicollRecord gr = (GrscicollRecord) sr; if (gr.getInstitutionMatch() != null) { Institution institution = gr.getInstitutionMatch().getInstitution(); if (institution != null) { hr.setInstitutionkey(institution.getKey()); } } if (gr.getCollectionMatch() != null) { Collection collection = gr.getCollectionMatch().getCollection(); if (collection != null) { hr.setCollectionkey(collection.getKey()); } } }; }  static OccurrenceHdfsRecord toOccurrenceHdfsRecord(SpecificRecordBase... records);  }