@Test(expected = NullPointerException.class) public void extractIdMapping_NULL_DOCUMENTS_METADATA_RDD() { idMappingExtractor.extractIdMapping(null, "someIdType", pickOneDocumentMetadataFunction); }
public JavaPairRDD<String, String> extractIdMapping(JavaRDD<DocumentMetadata> documents, String idType, Function<Iterable<DocumentMetadata>, DocumentMetadata> pickSingle) { JavaPairRDD<String, String> externalIdToId = documents .filter(document -> document.getExternalIdentifiers() != null && document.getExternalIdentifiers().containsKey(idType)) .keyBy(document -> document.getExternalIdentifiers().get(idType).toString()) .groupByKey() .mapValues(pickSingle) .mapValues(document -> document.getId().toString()); return externalIdToId; }
IdentifierMappingExtractor implements Serializable { public JavaPairRDD<String, String> extractIdMapping(JavaRDD<DocumentMetadata> documents, String idType, Function<Iterable<DocumentMetadata>, DocumentMetadata> pickSingle) { JavaPairRDD<String, String> externalIdToId = documents .filter(document -> document.getExternalIdentifiers() != null && document.getExternalIdentifiers().containsKey(idType)) .keyBy(document -> document.getExternalIdentifiers().get(idType).toString()) .groupByKey() .mapValues(pickSingle) .mapValues(document -> document.getId().toString()); return externalIdToId; } }
IdentifierMappingExtractor implements Serializable { public JavaPairRDD<String, String> extractIdMapping(JavaRDD<DocumentMetadata> documents, String idType, Function<Iterable<DocumentMetadata>, DocumentMetadata> pickSingle) { JavaPairRDD<String, String> externalIdToId = documents .filter(document -> document.getExternalIdentifiers() != null && document.getExternalIdentifiers().containsKey(idType)) .keyBy(document -> document.getExternalIdentifiers().get(idType).toString()) .groupByKey() .mapValues(pickSingle) .mapValues(document -> document.getId().toString()); return externalIdToId; }  }
IdentifierMappingExtractor implements Serializable { public JavaPairRDD<String, String> extractIdMapping(JavaRDD<DocumentMetadata> documents, String idType, Function<Iterable<DocumentMetadata>, DocumentMetadata> pickSingle) { JavaPairRDD<String, String> externalIdToId = documents .filter(document -> document.getExternalIdentifiers() != null && document.getExternalIdentifiers().containsKey(idType)) .keyBy(document -> document.getExternalIdentifiers().get(idType).toString()) .groupByKey() .mapValues(pickSingle) .mapValues(document -> document.getId().toString()); return externalIdToId; }  JavaPairRDD<String, String> extractIdMapping(JavaRDD<DocumentMetadata> documents, String idType, Function<Iterable<DocumentMetadata>, DocumentMetadata> pickSingle); }
IdentifierMappingExtractor implements Serializable { public JavaPairRDD<String, String> extractIdMapping(JavaRDD<DocumentMetadata> documents, String idType, Function<Iterable<DocumentMetadata>, DocumentMetadata> pickSingle) { JavaPairRDD<String, String> externalIdToId = documents .filter(document -> document.getExternalIdentifiers() != null && document.getExternalIdentifiers().containsKey(idType)) .keyBy(document -> document.getExternalIdentifiers().get(idType).toString()) .groupByKey() .mapValues(pickSingle) .mapValues(document -> document.getId().toString()); return externalIdToId; }  JavaPairRDD<String, String> extractIdMapping(JavaRDD<DocumentMetadata> documents, String idType, Function<Iterable<DocumentMetadata>, DocumentMetadata> pickSingle);  }