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.
fix(ui/graphql) Handle groups in institutionalMemory aspect (datahub-…
- Loading branch information
1 parent
56a5dca
commit 41f7fc9
Showing
11 changed files
with
111 additions
and
19 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
25 changes: 25 additions & 0 deletions
25
...core/src/main/java/com/linkedin/datahub/graphql/resolvers/type/ResolvedActorResolver.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,25 @@ | ||
package com.linkedin.datahub.graphql.resolvers.type; | ||
|
||
import com.linkedin.datahub.graphql.generated.CorpGroup; | ||
import com.linkedin.datahub.graphql.generated.CorpUser; | ||
import graphql.TypeResolutionEnvironment; | ||
import graphql.schema.GraphQLObjectType; | ||
import graphql.schema.TypeResolver; | ||
|
||
public class ResolvedActorResolver implements TypeResolver { | ||
|
||
public static final String CORP_USER = "CorpUser"; | ||
public static final String CORP_GROUP = "CorpGroup"; | ||
|
||
@Override | ||
public GraphQLObjectType getType(TypeResolutionEnvironment env) { | ||
if (env.getObject() instanceof CorpUser) { | ||
return env.getSchema().getObjectType(CORP_USER); | ||
} else if (env.getObject() instanceof CorpGroup) { | ||
return env.getSchema().getObjectType(CORP_GROUP); | ||
} else { | ||
throw new RuntimeException( | ||
"Unrecognized object type provided to type resolver, Type:" + env.getObject().toString()); | ||
} | ||
} | ||
} |
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
31 changes: 31 additions & 0 deletions
31
.../src/main/java/com/linkedin/datahub/graphql/types/common/mappers/ResolvedActorMapper.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,31 @@ | ||
package com.linkedin.datahub.graphql.types.common.mappers; | ||
|
||
import com.linkedin.common.urn.Urn; | ||
import com.linkedin.datahub.graphql.generated.CorpGroup; | ||
import com.linkedin.datahub.graphql.generated.CorpUser; | ||
import com.linkedin.datahub.graphql.generated.EntityType; | ||
import com.linkedin.datahub.graphql.generated.ResolvedActor; | ||
import com.linkedin.metadata.Constants; | ||
import javax.annotation.Nonnull; | ||
|
||
public class ResolvedActorMapper { | ||
|
||
public static final ResolvedActorMapper INSTANCE = new ResolvedActorMapper(); | ||
|
||
public static ResolvedActor map(@Nonnull final Urn actorUrn) { | ||
return INSTANCE.apply(actorUrn); | ||
} | ||
|
||
public ResolvedActor apply(@Nonnull final Urn actorUrn) { | ||
if (actorUrn.getEntityType().equals(Constants.CORP_GROUP_ENTITY_NAME)) { | ||
CorpGroup partialGroup = new CorpGroup(); | ||
partialGroup.setUrn(actorUrn.toString()); | ||
partialGroup.setType(EntityType.CORP_GROUP); | ||
return partialGroup; | ||
} | ||
CorpUser partialUser = new CorpUser(); | ||
partialUser.setUrn(actorUrn.toString()); | ||
partialUser.setType(EntityType.CORP_USER); | ||
return (ResolvedActor) partialUser; | ||
} | ||
} |
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
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