-
Notifications
You must be signed in to change notification settings - Fork 3.3k
feat: Allow users to add multiple Applications to entities #15160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ani-malgari
merged 14 commits into
master
from
feature/cus-6090_allow-multiple-applications-on-entities
Nov 12, 2025
+1,039
−105
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
ec6e451
Able to add multiple apps, need to work on removal
70109d1
need tests
f6312d3
Added tests
88013a6
fix formatting
392617b
minor changes
941ebe6
updated schema in mocks
53c201a
Merge branch 'master' into feature/cus-6090_allow-multiple-applicatio…
ani-malgari 1ee6fbb
fixing cypress tests
02e6637
fix v1 UI
8d619c1
improved test coverage
1f9c0a6
allow application for backward compatibility
33cd334
prettier
663211b
fixed spotless java check
51d76d0
updated mappers to accommodate deprecated application
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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
85 changes: 85 additions & 0 deletions
85
...ava/com/linkedin/datahub/graphql/resolvers/application/BatchUnsetApplicationResolver.java
This file contains hidden or 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,85 @@ | ||
| package com.linkedin.datahub.graphql.resolvers.application; | ||
|
|
||
| import static com.linkedin.datahub.graphql.resolvers.ResolverUtils.bindArgument; | ||
| import static com.linkedin.datahub.graphql.resolvers.application.ApplicationAuthorizationUtils.verifyResourcesExistAndAuthorized; | ||
|
|
||
| import com.linkedin.common.urn.Urn; | ||
| import com.linkedin.common.urn.UrnUtils; | ||
| import com.linkedin.datahub.graphql.QueryContext; | ||
| import com.linkedin.datahub.graphql.concurrency.GraphQLConcurrencyUtils; | ||
| import com.linkedin.datahub.graphql.generated.BatchUnsetApplicationInput; | ||
| import com.linkedin.metadata.service.ApplicationService; | ||
| import graphql.schema.DataFetcher; | ||
| import graphql.schema.DataFetchingEnvironment; | ||
| import java.util.List; | ||
| import java.util.concurrent.CompletableFuture; | ||
| import java.util.stream.Collectors; | ||
| import javax.annotation.Nonnull; | ||
| import lombok.RequiredArgsConstructor; | ||
| import lombok.extern.slf4j.Slf4j; | ||
|
|
||
| @Slf4j | ||
| @RequiredArgsConstructor | ||
| public class BatchUnsetApplicationResolver implements DataFetcher<CompletableFuture<Boolean>> { | ||
|
|
||
| private final ApplicationService applicationService; | ||
|
|
||
| @Override | ||
| public CompletableFuture<Boolean> get(DataFetchingEnvironment environment) throws Exception { | ||
| final QueryContext context = environment.getContext(); | ||
| final BatchUnsetApplicationInput input = | ||
| bindArgument(environment.getArgument("input"), BatchUnsetApplicationInput.class); | ||
| final String applicationUrn = input.getApplicationUrn(); | ||
| final List<String> resources = input.getResourceUrns(); | ||
|
|
||
| return GraphQLConcurrencyUtils.supplyAsync( | ||
| () -> { | ||
| verifyResources(resources, context); | ||
| verifyApplication(applicationUrn, context); | ||
|
|
||
| try { | ||
| List<Urn> resourceUrns = | ||
| resources.stream().map(UrnUtils::getUrn).collect(Collectors.toList()); | ||
| batchUnsetApplication(applicationUrn, resourceUrns, context); | ||
| return true; | ||
| } catch (Exception e) { | ||
| log.error("Failed to perform update against input {}, {}", input, e.getMessage()); | ||
| throw new RuntimeException( | ||
| String.format("Failed to perform update against input %s", input), e); | ||
| } | ||
| }, | ||
| this.getClass().getSimpleName(), | ||
| "get"); | ||
| } | ||
|
|
||
| private void verifyResources(List<String> resources, QueryContext context) { | ||
| verifyResourcesExistAndAuthorized(resources, applicationService, context, "unset_application"); | ||
| } | ||
|
|
||
| private void verifyApplication(String applicationUrn, QueryContext context) { | ||
| if (!applicationService.verifyEntityExists( | ||
| context.getOperationContext(), UrnUtils.getUrn(applicationUrn))) { | ||
| throw new RuntimeException( | ||
| String.format( | ||
| "Failed to batch unset Application, Application urn %s does not exist", | ||
| applicationUrn)); | ||
| } | ||
| } | ||
|
|
||
| private void batchUnsetApplication( | ||
| @Nonnull String applicationUrn, List<Urn> resources, QueryContext context) { | ||
| try { | ||
| applicationService.batchUnsetApplication( | ||
| context.getOperationContext(), | ||
| UrnUtils.getUrn(applicationUrn), | ||
| resources, | ||
| UrnUtils.getUrn(context.getActorUrn())); | ||
| } catch (Exception e) { | ||
| throw new RuntimeException( | ||
| String.format( | ||
| "Failed to batch unset Application %s from resources with urns %s!", | ||
| applicationUrn, resources), | ||
| e); | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.