Skip to content
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

Rtekal pl join UI er model relation #23

Merged
merged 3 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -309,9 +309,9 @@
import com.linkedin.datahub.graphql.types.datatype.DataTypeType;
import com.linkedin.datahub.graphql.types.domain.DomainType;
import com.linkedin.datahub.graphql.types.entitytype.EntityTypeType;
import com.linkedin.datahub.graphql.types.ermodelrelation.CreateERModelRelationshipResolver;
import com.linkedin.datahub.graphql.types.ermodelrelation.ERModelRelationshipType;
import com.linkedin.datahub.graphql.types.ermodelrelation.UpdateERModelRelationshipResolver;
import com.linkedin.datahub.graphql.types.ermodelrelationship.CreateERModelRelationshipResolver;
import com.linkedin.datahub.graphql.types.ermodelrelationship.ERModelRelationshipType;
import com.linkedin.datahub.graphql.types.ermodelrelationship.UpdateERModelRelationshipResolver;
import com.linkedin.datahub.graphql.types.form.FormType;
import com.linkedin.datahub.graphql.types.glossary.GlossaryNodeType;
import com.linkedin.datahub.graphql.types.glossary.GlossaryTermType;
Expand Down Expand Up @@ -468,7 +468,7 @@ public class GmsGraphQLEngine {
private final DataHubPolicyType dataHubPolicyType;
private final DataHubRoleType dataHubRoleType;
private final SchemaFieldType schemaFieldType;
private final ERModelRelationshipType ermodelrelationType;
private final ERModelRelationshipType erModelRelationshipType;
private final DataHubViewType dataHubViewType;
private final QueryType queryType;
private final DataProductType dataProductType;
Expand Down Expand Up @@ -580,7 +580,7 @@ public GmsGraphQLEngine(final GmsGraphQLEngineArgs args) {
this.dataHubPolicyType = new DataHubPolicyType(entityClient);
this.dataHubRoleType = new DataHubRoleType(entityClient);
this.schemaFieldType = new SchemaFieldType(entityClient, featureFlags);
this.ermodelrelationType = new ERModelRelationshipType(entityClient, featureFlags);
this.erModelRelationshipType = new ERModelRelationshipType(entityClient, featureFlags);
this.dataHubViewType = new DataHubViewType(entityClient);
this.queryType = new QueryType(entityClient);
this.dataProductType = new DataProductType(entityClient);
Expand Down Expand Up @@ -626,7 +626,7 @@ public GmsGraphQLEngine(final GmsGraphQLEngineArgs args) {
dataHubPolicyType,
dataHubRoleType,
schemaFieldType,
ermodelrelationType,
erModelRelationshipType,
dataHubViewType,
queryType,
dataProductType,
Expand Down Expand Up @@ -950,7 +950,7 @@ private void configureQueryResolvers(final RuntimeWiring.Builder builder) {
.dataFetcher("glossaryTerm", getResolver(glossaryTermType))
.dataFetcher("glossaryNode", getResolver(glossaryNodeType))
.dataFetcher("domain", getResolver((domainType)))
.dataFetcher("erModelRelationship", getResolver(ermodelrelationType))
.dataFetcher("erModelRelationship", getResolver(erModelRelationshipType))
.dataFetcher("dataPlatform", getResolver(dataPlatformType))
.dataFetcher("dataPlatformInstance", getResolver(dataPlatformInstanceType))
.dataFetcher("mlFeatureTable", getResolver(mlFeatureTableType))
Expand Down Expand Up @@ -2116,21 +2116,21 @@ private void configureERModelRelationshipResolvers(final RuntimeWiring.Builder b
new LoadableTypeResolver<>(
datasetType,
(env) -> {
final ERModelRelationshipProperties ermodelrelationProperties =
final ERModelRelationshipProperties erModelRelationshipProperties =
env.getSource();
return ermodelrelationProperties.getSource() != null
? ermodelrelationProperties.getSource().getUrn()
return erModelRelationshipProperties.getSource() != null
? erModelRelationshipProperties.getSource().getUrn()
: null;
}))
.dataFetcher(
"destination",
new LoadableTypeResolver<>(
datasetType,
(env) -> {
final ERModelRelationshipProperties ermodelrelationProperties =
final ERModelRelationshipProperties erModelRelationshipProperties =
env.getSource();
return ermodelrelationProperties.getDestination() != null
? ermodelrelationProperties.getDestination().getUrn()
return erModelRelationshipProperties.getDestination() != null
? erModelRelationshipProperties.getDestination().getUrn()
: null;
})))
.type(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.linkedin.datahub.graphql.types.ermodelrelation;
package com.linkedin.datahub.graphql.types.ermodelrelationship;

import static com.linkedin.datahub.graphql.resolvers.ResolverUtils.bindArgument;

Expand All @@ -8,11 +8,11 @@
import com.linkedin.common.urn.Urn;
import com.linkedin.datahub.graphql.QueryContext;
import com.linkedin.datahub.graphql.exception.AuthorizationException;
import com.linkedin.datahub.graphql.generated.ERModelRelationPropertiesInput;
import com.linkedin.datahub.graphql.generated.ERModelRelationship;
import com.linkedin.datahub.graphql.generated.ERModelRelationshipPropertiesInput;
import com.linkedin.datahub.graphql.generated.ERModelRelationshipUpdateInput;
import com.linkedin.datahub.graphql.types.ermodelrelation.mappers.ERModelRelationMapper;
import com.linkedin.datahub.graphql.types.ermodelrelation.mappers.ERModelRelationshipUpdateInputMapper;
import com.linkedin.datahub.graphql.types.ermodelrelationship.mappers.ERModelRelationMapper;
import com.linkedin.datahub.graphql.types.ermodelrelationship.mappers.ERModelRelationshipUpdateInputMapper;
import com.linkedin.entity.client.EntityClient;
import com.linkedin.metadata.service.ERModelRelationshipService;
import com.linkedin.mxe.MetadataChangeProposal;
Expand Down Expand Up @@ -40,10 +40,11 @@
final ERModelRelationshipUpdateInput input =
bindArgument(environment.getArgument("input"), ERModelRelationshipUpdateInput.class);

final ERModelRelationPropertiesInput ermodelrelationPropertiesInput = input.getProperties();
String ermodelrelationName = ermodelrelationPropertiesInput.getName();
String source = ermodelrelationPropertiesInput.getSource();
String destination = ermodelrelationPropertiesInput.getDestination();
final ERModelRelationshipPropertiesInput erModelRelationshipPropertiesInput =
input.getProperties();
String ermodelrelationName = erModelRelationshipPropertiesInput.getName();
String source = erModelRelationshipPropertiesInput.getSource();
String destination = erModelRelationshipPropertiesInput.getDestination();

String lowDataset = source;
String highDataset = destination;
Expand Down Expand Up @@ -95,7 +96,7 @@
throw new RuntimeException("Failed to create erModelRelationship entity", e);
}
return ERModelRelationMapper.map(
_erModelRelationshipService.getERModelRelationshipResponse(

Check warning on line 99 in datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/types/ermodelrelationship/CreateERModelRelationshipResolver.java

View workflow job for this annotation

GitHub Actions / qodana

Nullability and data flow problems

Argument `_erModelRelationshipService.getERModelRelationshipResponse( Urn.createFromString...` might be null
Urn.createFromString(inputUrn.toString()), authentication));
} catch (Exception e) {
log.error(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.linkedin.datahub.graphql.types.ermodelrelation;
package com.linkedin.datahub.graphql.types.ermodelrelationship;

import static com.linkedin.datahub.graphql.Constants.*;
import static com.linkedin.metadata.Constants.*;
Expand Down Expand Up @@ -26,7 +26,7 @@
import com.linkedin.datahub.graphql.resolvers.ResolverUtils;
import com.linkedin.datahub.graphql.types.BrowsableEntityType;
import com.linkedin.datahub.graphql.types.SearchableEntityType;
import com.linkedin.datahub.graphql.types.ermodelrelation.mappers.ERModelRelationMapper;
import com.linkedin.datahub.graphql.types.ermodelrelationship.mappers.ERModelRelationMapper;
import com.linkedin.datahub.graphql.types.mappers.AutoCompleteResultsMapper;
import com.linkedin.datahub.graphql.types.mappers.BrowsePathsMapper;
import com.linkedin.datahub.graphql.types.mappers.BrowseResultMapper;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.linkedin.datahub.graphql.types.ermodelrelation;
package com.linkedin.datahub.graphql.types.ermodelrelationship;

import static com.linkedin.datahub.graphql.resolvers.ResolverUtils.bindArgument;

Expand All @@ -7,7 +7,7 @@
import com.linkedin.datahub.graphql.QueryContext;
import com.linkedin.datahub.graphql.exception.AuthorizationException;
import com.linkedin.datahub.graphql.generated.ERModelRelationshipUpdateInput;
import com.linkedin.datahub.graphql.types.ermodelrelation.mappers.ERModelRelationshipUpdateInputMapper;
import com.linkedin.datahub.graphql.types.ermodelrelationship.mappers.ERModelRelationshipUpdateInputMapper;
import com.linkedin.entity.client.EntityClient;
import com.linkedin.mxe.MetadataChangeProposal;
import com.linkedin.r2.RemoteInvocationException;
Expand Down Expand Up @@ -48,7 +48,7 @@
_entityClient.batchIngestProposals(proposals, context.getAuthentication(), false);
} catch (RemoteInvocationException e) {
throw new RuntimeException(
String.format("Failed to update erModelRelationship entity"), e);

Check warning on line 51 in datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/types/ermodelrelationship/UpdateERModelRelationshipResolver.java

View workflow job for this annotation

GitHub Actions / qodana

Redundant call to 'String.format()'

Redundant call to `format()`
}
return true;
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.linkedin.datahub.graphql.types.ermodelrelation.mappers;
package com.linkedin.datahub.graphql.types.ermodelrelationship.mappers;

import static com.linkedin.metadata.Constants.*;

Expand Down Expand Up @@ -57,36 +57,36 @@
MappingHelper<ERModelRelationship> mappingHelper = new MappingHelper<>(aspectMap, result);
mappingHelper.mapToResult(ER_MODEL_RELATIONSHIP_KEY_ASPECT_NAME, this::mapERModelRelationKey);
mappingHelper.mapToResult(ER_MODEL_RELATIONSHIP_PROPERTIES_ASPECT_NAME, this::mapProperties);
if (aspectMap != null

Check warning on line 60 in datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/types/ermodelrelationship/mappers/ERModelRelationMapper.java

View workflow job for this annotation

GitHub Actions / qodana

Constant values

Condition `aspectMap != null` is always `true`
&& aspectMap.containsKey(EDITABLE_ER_MODEL_RELATIONSHIP_PROPERTIES_ASPECT_NAME)) {
mappingHelper.mapToResult(
EDITABLE_ER_MODEL_RELATIONSHIP_PROPERTIES_ASPECT_NAME, this::mapEditableProperties);
}
if (aspectMap != null && aspectMap.containsKey(INSTITUTIONAL_MEMORY_ASPECT_NAME)) {

Check warning on line 65 in datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/types/ermodelrelationship/mappers/ERModelRelationMapper.java

View workflow job for this annotation

GitHub Actions / qodana

Constant values

Condition `aspectMap != null` is always `true`
mappingHelper.mapToResult(
INSTITUTIONAL_MEMORY_ASPECT_NAME,
(ermodelrelation, dataMap) ->
ermodelrelation.setInstitutionalMemory(
InstitutionalMemoryMapper.map(new InstitutionalMemory(dataMap), entityUrn)));
}
if (aspectMap != null && aspectMap.containsKey(OWNERSHIP_ASPECT_NAME)) {

Check warning on line 72 in datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/types/ermodelrelationship/mappers/ERModelRelationMapper.java

View workflow job for this annotation

GitHub Actions / qodana

Constant values

Condition `aspectMap != null` is always `true`
mappingHelper.mapToResult(
OWNERSHIP_ASPECT_NAME,
(ermodelrelation, dataMap) ->
ermodelrelation.setOwnership(OwnershipMapper.map(new Ownership(dataMap), entityUrn)));
}
if (aspectMap != null && aspectMap.containsKey(STATUS_ASPECT_NAME)) {

Check warning on line 78 in datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/types/ermodelrelationship/mappers/ERModelRelationMapper.java

View workflow job for this annotation

GitHub Actions / qodana

Constant values

Condition `aspectMap != null` is always `true`
mappingHelper.mapToResult(
STATUS_ASPECT_NAME,
(ermodelrelation, dataMap) ->
ermodelrelation.setStatus(StatusMapper.map(new Status(dataMap))));
}
if (aspectMap != null && aspectMap.containsKey(GLOBAL_TAGS_ASPECT_NAME)) {

Check warning on line 84 in datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/types/ermodelrelationship/mappers/ERModelRelationMapper.java

View workflow job for this annotation

GitHub Actions / qodana

Constant values

Condition `aspectMap != null` is always `true`
mappingHelper.mapToResult(
GLOBAL_TAGS_ASPECT_NAME,
(ermodelrelation, dataMap) -> this.mapGlobalTags(ermodelrelation, dataMap, entityUrn));
}
if (aspectMap != null && aspectMap.containsKey(GLOSSARY_TERMS_ASPECT_NAME)) {

Check warning on line 89 in datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/types/ermodelrelationship/mappers/ERModelRelationMapper.java

View workflow job for this annotation

GitHub Actions / qodana

Constant values

Condition `aspectMap != null` is always `true`
mappingHelper.mapToResult(
GLOSSARY_TERMS_ASPECT_NAME,
(ermodelrelation, dataMap) ->
Expand Down Expand Up @@ -128,7 +128,7 @@
? ermodelrelationProperties.getCreated().getTime()
: 0)
.setRelationshipFieldMappings(
ermodelrelationProperties.hasRelationshipfieldMappings()
ermodelrelationProperties.hasRelationshipFieldMappings()
? this.mapERModelRelationFieldMappings(ermodelrelationProperties)
: null)
.build());
Expand Down Expand Up @@ -156,7 +156,7 @@
final List<RelationshipFieldMapping> relationshipFieldMappingList = new ArrayList<>();

ermodelrelationProperties
.getRelationshipfieldMappings()
.getRelationshipFieldMappings()
.forEach(
relationshipFieldMapping ->
relationshipFieldMappingList.add(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package com.linkedin.datahub.graphql.types.ermodelrelation.mappers;
package com.linkedin.datahub.graphql.types.ermodelrelationship.mappers;

import static com.linkedin.metadata.Constants.*;

import com.linkedin.common.AuditStamp;
import com.linkedin.common.urn.DatasetUrn;
import com.linkedin.common.urn.Urn;
import com.linkedin.data.template.SetMode;
import com.linkedin.datahub.graphql.generated.ERModelRelationEditablePropertiesUpdate;
import com.linkedin.datahub.graphql.generated.ERModelRelationPropertiesInput;
import com.linkedin.datahub.graphql.generated.ERModelRelationshipEditablePropertiesUpdate;
import com.linkedin.datahub.graphql.generated.ERModelRelationshipPropertiesInput;
import com.linkedin.datahub.graphql.generated.ERModelRelationshipUpdateInput;
import com.linkedin.datahub.graphql.generated.RelationshipFieldMappingInput;
import com.linkedin.datahub.graphql.types.common.mappers.util.UpdateMappingHelper;
Expand Down Expand Up @@ -56,7 +56,7 @@
}
if (input.getEditableProperties() != null) {
final EditableERModelRelationshipProperties editableERModelRelationProperties =
ermodelrelationEditablePropsSettings(input.getEditableProperties());
ermodelrelationshipEditablePropsSettings(input.getEditableProperties());
proposals.add(
updateMappingHelper.aspectToProposal(
editableERModelRelationProperties,
Expand All @@ -66,7 +66,7 @@
}

private ERModelRelationshipProperties createERModelRelationProperties(
ERModelRelationPropertiesInput inputProperties, AuditStamp auditstamp) {
ERModelRelationshipPropertiesInput inputProperties, AuditStamp auditstamp) {
com.linkedin.ermodelrelation.ERModelRelationshipProperties ermodelrelationProperties =
new com.linkedin.ermodelrelation.ERModelRelationshipProperties();
if (inputProperties.getName() != null) {
Expand All @@ -82,7 +82,7 @@
DatasetUrn.createFromString(inputProperties.getDestination()));
}
} catch (URISyntaxException e) {
e.printStackTrace();

Check warning on line 85 in datahub-graphql-core/src/main/java/com/linkedin/datahub/graphql/types/ermodelrelationship/mappers/ERModelRelationshipUpdateInputMapper.java

View workflow job for this annotation

GitHub Actions / qodana

Call to 'printStackTrace()'

Call to `printStackTrace()` should probably be replaced with more robust logging
}

if (inputProperties.getRelationshipFieldmappings() != null) {
Expand All @@ -91,7 +91,7 @@
ermodelrelationFieldMappingSettings(inputProperties.getRelationshipFieldmappings());
ermodelrelationProperties.setCardinality(
ermodelrelationCardinalitySettings(inputProperties.getRelationshipFieldmappings()));
ermodelrelationProperties.setRelationshipfieldMappings(relationshipFieldMappingsArray);
ermodelrelationProperties.setRelationshipFieldMappings(relationshipFieldMappingsArray);
}

if (inputProperties.getCreated() != null && inputProperties.getCreated()) {
Expand Down Expand Up @@ -174,8 +174,8 @@
return relationshipFieldMappingList;
}

private static EditableERModelRelationshipProperties ermodelrelationEditablePropsSettings(
ERModelRelationEditablePropertiesUpdate editPropsInput) {
private static EditableERModelRelationshipProperties ermodelrelationshipEditablePropsSettings(
ERModelRelationshipEditablePropertiesUpdate editPropsInput) {
final EditableERModelRelationshipProperties editableERModelRelationProperties =
new EditableERModelRelationshipProperties();
if (editPropsInput.getName() != null && editPropsInput.getName().trim().length() > 0) {
Expand Down
42 changes: 21 additions & 21 deletions datahub-graphql-core/src/main/resources/entity.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ type Query {
}

"""
An ERModelRelationship is a high-level abstraction that dictates what datasets fields are ermodelrelationed.
An ERModelRelationship is a high-level abstraction that dictates what datasets fields are erModelRelationshiped.
"""
type ERModelRelationship implements EntityWithRelationships & Entity {
"""
Expand Down Expand Up @@ -343,7 +343,7 @@ type ERModelRelationshipProperties {
destination: Dataset!

"""
The ermodelrelationFieldMappings
The relationFieldMappings
"""
relationshipFieldMappings: [RelationshipFieldMapping!]

Expand Down Expand Up @@ -4715,14 +4715,14 @@ input DatasetEditablePropertiesUpdate {
"""
Update to writable Dataset fields
"""
input ERModelRelationEditablePropertiesUpdate {
input ERModelRelationshipEditablePropertiesUpdate {
"""
Display name of the ERModelRelation
Display name of the ERModelRelationship
"""
name: String

"""
Writable description for ERModelRelation
Writable description for ERModelRelationship
"""
description: String!
}
Expand Down Expand Up @@ -4846,63 +4846,63 @@ input CreateTagInput {
}

"""
Input required to create/update a new ERModelRelation
Input required to create/update a new ERModelRelationship
"""
input ERModelRelationshipUpdateInput {
"""
Details about the ERModelRelation
Details about the ERModelRelationship
"""
properties: ERModelRelationPropertiesInput
properties: ERModelRelationshipPropertiesInput
"""
Update to editable properties
"""
editableProperties: ERModelRelationEditablePropertiesUpdate
editableProperties: ERModelRelationshipEditablePropertiesUpdate
}

"""
Details about the ERModelRelation
Details about the ERModelRelationship
"""
input ERModelRelationPropertiesInput {
input ERModelRelationshipPropertiesInput {
"""
Details about the ERModelRelation
Details about the ERModelRelationship
"""
name: String!
"""
Details about the ERModelRelation
Details about the ERModelRelationship
"""
source: String!
"""
Details about the ERModelRelation
Details about the ERModelRelationship
"""
destination: String!
"""
Details about the ERModelRelation
Details about the ERModelRelationship
"""
relationshipFieldmappings: [RelationshipFieldMappingInput!]
"""
optional flag about the ERModelRelation is getting create
optional flag about the ERModelRelationship is getting create
"""
created: Boolean
"""
optional field to prevent created time while the ERModelRelation is getting update
optional field to prevent created time while the ERModelRelationship is getting update
"""
createdAt: Long
"""
optional field to prevent create actor while the ERModelRelation is getting update
optional field to prevent create actor while the ERModelRelationship is getting update
"""
createdBy: String
}

"""
Details about the ERModelRelation
Details about the ERModelRelationship
"""
input RelationshipFieldMappingInput {
"""
Details about the ERModelRelation
Details about the ERModelRelationship
"""
sourceField: String
"""
Details about the ERModelRelation
Details about the ERModelRelationship
"""
destinationField: String
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ export const ERModelRelationshipPreviewCard = ({
name={name || ''}
urn={urn}
description={description || ''}
logoComponent={<img src={ermodelrelationshipIcon} alt="ERModelRelation" style={{ fontSize: '20px' }} />}
logoComponent={<img src={ermodelrelationshipIcon} alt="ERModelRelationship" style={{ fontSize: '20px' }} />}
tags={globalTags || undefined}
glossaryTerms={glossaryTerms || undefined}
owners={owners}
type="ERModelRelation"
type="ERModelRelationship"
typeIcon={entityRegistry.getIcon(EntityType.ErModelRelationship, 14, IconStyleType.ACCENT)}
titleSizePx={18}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
.preview-main-div{
display: flex;
justify-content: space-between;
margin-left: 12px;
}
.div-edit-img img {
height: 15px;
Expand Down
Loading
Loading