Skip to content

Commit

Permalink
feat(entityVersioning): rename endpoint and update field name
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanHolstien committed Dec 18, 2024
1 parent 82274e7 commit 513ad54
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@
import com.linkedin.datahub.graphql.resolvers.embed.UpdateEmbedResolver;
import com.linkedin.datahub.graphql.resolvers.entity.EntityExistsResolver;
import com.linkedin.datahub.graphql.resolvers.entity.EntityPrivilegesResolver;
import com.linkedin.datahub.graphql.resolvers.entity.versioning.LinkVersionResolver;
import com.linkedin.datahub.graphql.resolvers.entity.versioning.UnlinkVersionResolver;
import com.linkedin.datahub.graphql.resolvers.entity.versioning.LinkAssetVersionResolver;
import com.linkedin.datahub.graphql.resolvers.entity.versioning.UnlinkAssetVersionResolver;
import com.linkedin.datahub.graphql.resolvers.form.BatchAssignFormResolver;
import com.linkedin.datahub.graphql.resolvers.form.BatchRemoveFormResolver;
import com.linkedin.datahub.graphql.resolvers.form.CreateDynamicFormAssignmentResolver;
Expand Down Expand Up @@ -1394,11 +1394,12 @@ private void configureMutationResolvers(final RuntimeWiring.Builder builder) {
if (featureFlags.isEntityVersioning()) {
typeWiring
.dataFetcher(
"linkVersion",
new LinkVersionResolver(this.entityVersioningService, this.featureFlags))
"linkAssetVersion",
new LinkAssetVersionResolver(this.entityVersioningService, this.featureFlags))
.dataFetcher(
"unlinkVersion",
new UnlinkVersionResolver(this.entityVersioningService, this.featureFlags));
"unlinkAssetVersion",
new UnlinkAssetVersionResolver(
this.entityVersioningService, this.featureFlags));
}
return typeWiring;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@
/**
* Currently only supports linking the latest version, but may be modified later to support inserts
*/
public class LinkVersionResolver implements DataFetcher<CompletableFuture<String>> {
public class LinkAssetVersionResolver implements DataFetcher<CompletableFuture<String>> {

private final EntityVersioningService entityVersioningService;
private final FeatureFlags featureFlags;

public LinkVersionResolver(
public LinkAssetVersionResolver(
EntityVersioningService entityVersioningService, FeatureFlags featureFlags) {
this.entityVersioningService = entityVersioningService;
this.featureFlags = featureFlags;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
import io.datahubproject.metadata.context.OperationContext;
import java.util.concurrent.CompletableFuture;

public class UnlinkVersionResolver implements DataFetcher<CompletableFuture<Boolean>> {
public class UnlinkAssetVersionResolver implements DataFetcher<CompletableFuture<Boolean>> {

private final EntityVersioningService entityVersioningService;
private final FeatureFlags featureFlags;

public UnlinkVersionResolver(
public UnlinkAssetVersionResolver(
EntityVersioningService entityVersioningService, FeatureFlags featureFlags) {
this.entityVersioningService = entityVersioningService;
this.featureFlags = featureFlags;
Expand Down
4 changes: 2 additions & 2 deletions datahub-graphql-core/src/main/resources/entity.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -952,12 +952,12 @@ type Mutation {
"""
Link the latest versioned entity to a Version Set
"""
linkVersion(input: LinkVersionInput!): String
linkAssetVersion(input: LinkVersionInput!): String

"""
Unlink a versioned entity from a Version Set
"""
unlinkVersion(input: UnlinkVersionInput!): Boolean
unlinkAssetVersion(input: UnlinkVersionInput!): Boolean
}

"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@ public class Constants {

// Versioning related
public static final String INITIAL_VERSION_SORT_ID = "AAAAAAAA";
public static final String VERSION_SORT_ID_FIELD_NAME = "versionSortId";

public static final String DISPLAY_PROPERTIES_ASPECT_NAME = "displayProperties";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import static com.linkedin.metadata.Constants.VERSION_SET_ENTITY_NAME;
import static com.linkedin.metadata.Constants.VERSION_SET_KEY_ASPECT_NAME;
import static com.linkedin.metadata.Constants.VERSION_SET_PROPERTIES_ASPECT_NAME;
import static com.linkedin.metadata.Constants.VERSION_SORT_ID_FIELD_NAME;

import com.datahub.util.RecordUtils;
import com.google.common.collect.ImmutableList;
Expand Down Expand Up @@ -243,7 +244,9 @@ public List<RollbackResult> unlinkVersion(
null,
2,
ImmutableList.of(
new SortCriterion().setField("sortId").setOrder(SortOrder.DESCENDING)));
new SortCriterion()
.setField(VERSION_SORT_ID_FIELD_NAME)
.setOrder(SortOrder.DESCENDING)));
String updatedLatestVersionUrn = null;

SearchEntityArray linkedEntities = linkedVersions.getEntities();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ record VersionProperties {
* What this looks like depends on the Version Scheme. For sort ids generated by DataHub we use an 8 character string representation.
*/
@Searchable = {
"queryByDefault": false
"queryByDefault": false,
"fieldName": "versionSortId"
}
sortId: string

Expand Down

0 comments on commit 513ad54

Please sign in to comment.