forked from datahub-project/datahub
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into fix/OBS-729
- Loading branch information
Showing
84 changed files
with
21,547 additions
and
1,104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
.../main/java/com/linkedin/datahub/graphql/types/common/mappers/LineageFlagsInputMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package com.linkedin.datahub.graphql.types.common.mappers; | ||
|
||
import com.linkedin.common.UrnArray; | ||
import com.linkedin.common.UrnArrayMap; | ||
import com.linkedin.common.urn.UrnUtils; | ||
import com.linkedin.datahub.graphql.QueryContext; | ||
import com.linkedin.datahub.graphql.generated.EntityTypeToPlatforms; | ||
import com.linkedin.datahub.graphql.generated.LineageFlags; | ||
import com.linkedin.datahub.graphql.types.entitytype.EntityTypeMapper; | ||
import com.linkedin.datahub.graphql.types.mappers.ModelMapper; | ||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.Optional; | ||
import java.util.stream.Collectors; | ||
import javax.annotation.Nonnull; | ||
import javax.annotation.Nullable; | ||
|
||
/** | ||
* Maps GraphQL SearchFlags to Pegasus | ||
* | ||
* <p>To be replaced by auto-generated mappers implementations | ||
*/ | ||
public class LineageFlagsInputMapper | ||
implements ModelMapper<LineageFlags, com.linkedin.metadata.query.LineageFlags> { | ||
|
||
public static final LineageFlagsInputMapper INSTANCE = new LineageFlagsInputMapper(); | ||
|
||
@Nonnull | ||
public static com.linkedin.metadata.query.LineageFlags map( | ||
QueryContext queryContext, @Nonnull final LineageFlags lineageFlags) { | ||
return INSTANCE.apply(queryContext, lineageFlags); | ||
} | ||
|
||
@Override | ||
public com.linkedin.metadata.query.LineageFlags apply( | ||
QueryContext context, @Nullable final LineageFlags lineageFlags) { | ||
com.linkedin.metadata.query.LineageFlags result = | ||
new com.linkedin.metadata.query.LineageFlags(); | ||
if (lineageFlags == null) { | ||
return result; | ||
} | ||
if (lineageFlags.getIgnoreAsHops() != null) { | ||
result.setIgnoreAsHops(mapIgnoreAsHops(lineageFlags.getIgnoreAsHops())); | ||
} | ||
if (lineageFlags.getEndTimeMillis() != null) { | ||
result.setEndTimeMillis(lineageFlags.getEndTimeMillis()); | ||
} | ||
if (lineageFlags.getStartTimeMillis() != null) { | ||
result.setStartTimeMillis(lineageFlags.getStartTimeMillis()); | ||
} | ||
if (lineageFlags.getEntitiesExploredPerHopLimit() != null) { | ||
result.setEntitiesExploredPerHopLimit(lineageFlags.getEntitiesExploredPerHopLimit()); | ||
} | ||
return result; | ||
} | ||
|
||
private static UrnArrayMap mapIgnoreAsHops(List<EntityTypeToPlatforms> ignoreAsHops) { | ||
UrnArrayMap result = new UrnArrayMap(); | ||
ignoreAsHops.forEach( | ||
ignoreAsHop -> | ||
result.put( | ||
EntityTypeMapper.getName(ignoreAsHop.getEntityType()), | ||
new UrnArray( | ||
Optional.ofNullable(ignoreAsHop.getPlatforms()) | ||
.orElse(Collections.emptyList()) | ||
.stream() | ||
.map(UrnUtils::getUrn) | ||
.collect(Collectors.toList())))); | ||
return result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.