-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(mcp-mutator): new mcp mutator plugin (#10904)
- Loading branch information
1 parent
a8b07c5
commit 1565fb0
Showing
25 changed files
with
786 additions
and
26 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
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
80 changes: 80 additions & 0 deletions
80
.../metadata-io-api/src/main/java/com/linkedin/metadata/entity/ebean/batch/ProposedItem.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,80 @@ | ||
package com.linkedin.metadata.entity.ebean.batch; | ||
|
||
import com.linkedin.common.AuditStamp; | ||
import com.linkedin.common.urn.Urn; | ||
import com.linkedin.data.template.RecordTemplate; | ||
import com.linkedin.events.metadata.ChangeType; | ||
import com.linkedin.metadata.aspect.batch.MCPItem; | ||
import com.linkedin.metadata.models.AspectSpec; | ||
import com.linkedin.metadata.models.EntitySpec; | ||
import com.linkedin.metadata.utils.GenericRecordUtils; | ||
import com.linkedin.mxe.MetadataChangeProposal; | ||
import com.linkedin.mxe.SystemMetadata; | ||
import javax.annotation.Nonnull; | ||
import javax.annotation.Nullable; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
/** Represents an unvalidated wrapped MCP */ | ||
@Slf4j | ||
@Getter | ||
@Builder(toBuilder = true) | ||
public class ProposedItem implements MCPItem { | ||
@Nonnull private final MetadataChangeProposal metadataChangeProposal; | ||
@Nonnull private final AuditStamp auditStamp; | ||
// derived | ||
@Nonnull private EntitySpec entitySpec; | ||
@Nullable private AspectSpec aspectSpec; | ||
|
||
@Nonnull | ||
@Override | ||
public String getAspectName() { | ||
if (metadataChangeProposal.getAspectName() != null) { | ||
return metadataChangeProposal.getAspectName(); | ||
} else { | ||
return MCPItem.super.getAspectName(); | ||
} | ||
} | ||
|
||
@Nullable | ||
public AspectSpec getAspectSpec() { | ||
if (aspectSpec != null) { | ||
return aspectSpec; | ||
} | ||
if (entitySpec.getAspectSpecMap().containsKey(getAspectName())) { | ||
return entitySpec.getAspectSpecMap().get(getAspectName()); | ||
} | ||
return null; | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public RecordTemplate getRecordTemplate() { | ||
if (getAspectSpec() != null) { | ||
return GenericRecordUtils.deserializeAspect( | ||
getMetadataChangeProposal().getAspect().getValue(), | ||
getMetadataChangeProposal().getAspect().getContentType(), | ||
getAspectSpec()); | ||
} | ||
return null; | ||
} | ||
|
||
@Nonnull | ||
@Override | ||
public Urn getUrn() { | ||
return metadataChangeProposal.getEntityUrn(); | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public SystemMetadata getSystemMetadata() { | ||
return metadataChangeProposal.getSystemMetadata(); | ||
} | ||
|
||
@Nonnull | ||
@Override | ||
public ChangeType getChangeType() { | ||
return metadataChangeProposal.getChangeType(); | ||
} | ||
} |
Oops, something went wrong.