Skip to content

Commit

Permalink
fix(java) Update DataProductMapper to always return a name (datahub-p…
Browse files Browse the repository at this point in the history
  • Loading branch information
chriscollins3456 authored Sep 13, 2023
1 parent 785ab77 commit e9b4727
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ public DataProduct apply(@Nonnull final EntityResponse entityResponse) {

EnvelopedAspectMap aspectMap = entityResponse.getAspects();
MappingHelper<DataProduct> mappingHelper = new MappingHelper<>(aspectMap, result);
mappingHelper.mapToResult(DATA_PRODUCT_PROPERTIES_ASPECT_NAME, this::mapDataProductProperties);
mappingHelper.mapToResult(DATA_PRODUCT_PROPERTIES_ASPECT_NAME, (dataProduct, dataMap) ->
mapDataProductProperties(dataProduct, dataMap, entityUrn));
mappingHelper.mapToResult(GLOBAL_TAGS_ASPECT_NAME, (dataProduct, dataMap) ->
dataProduct.setTags(GlobalTagsMapper.map(new GlobalTags(dataMap), entityUrn)));
mappingHelper.mapToResult(GLOSSARY_TERMS_ASPECT_NAME, (dataProduct, dataMap) ->
Expand All @@ -65,11 +66,12 @@ public DataProduct apply(@Nonnull final EntityResponse entityResponse) {
return result;
}

private void mapDataProductProperties(@Nonnull DataProduct dataProduct, @Nonnull DataMap dataMap) {
private void mapDataProductProperties(@Nonnull DataProduct dataProduct, @Nonnull DataMap dataMap, @Nonnull Urn urn) {
DataProductProperties dataProductProperties = new DataProductProperties(dataMap);
com.linkedin.datahub.graphql.generated.DataProductProperties properties = new com.linkedin.datahub.graphql.generated.DataProductProperties();

properties.setName(dataProductProperties.getName());
final String name = dataProductProperties.hasName() ? dataProductProperties.getName() : urn.getId();
properties.setName(name);
properties.setDescription(dataProductProperties.getDescription());
if (dataProductProperties.hasExternalUrl()) {
properties.setExternalUrl(dataProductProperties.getExternalUrl().toString());
Expand Down

0 comments on commit e9b4727

Please sign in to comment.