forked from datahub-project/datahub
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'datahub-project:master' into master
- Loading branch information
Showing
78 changed files
with
2,869 additions
and
406 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
62 changes: 62 additions & 0 deletions
62
entity-registry/src/main/java/com/linkedin/metadata/aspect/EnvelopedSystemAspect.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,62 @@ | ||
package com.linkedin.metadata.aspect; | ||
|
||
import com.linkedin.common.urn.Urn; | ||
import com.linkedin.data.template.RecordTemplate; | ||
import com.linkedin.entity.EnvelopedAspect; | ||
import com.linkedin.metadata.models.AspectSpec; | ||
import com.linkedin.metadata.models.EntitySpec; | ||
import com.linkedin.mxe.SystemMetadata; | ||
import java.sql.Timestamp; | ||
import java.time.Instant; | ||
import javax.annotation.Nonnull; | ||
import javax.annotation.Nullable; | ||
import lombok.Getter; | ||
|
||
/** Delegate to restli class */ | ||
public class EnvelopedSystemAspect implements SystemAspect { | ||
|
||
public static SystemAspect of( | ||
@Nonnull Urn urn, @Nonnull EnvelopedAspect envelopedAspect, @Nonnull EntitySpec entitySpec) { | ||
return new EnvelopedSystemAspect(urn, envelopedAspect, entitySpec); | ||
} | ||
|
||
@Getter @Nonnull private final Urn urn; | ||
@Nonnull private final EnvelopedAspect envelopedAspect; | ||
@Getter @Nonnull private final EntitySpec entitySpec; | ||
@Getter @Nonnull private final AspectSpec aspectSpec; | ||
|
||
public EnvelopedSystemAspect( | ||
@Nonnull Urn urn, @Nonnull EnvelopedAspect envelopedAspect, @Nonnull EntitySpec entitySpec) { | ||
this.urn = urn; | ||
this.envelopedAspect = envelopedAspect; | ||
this.entitySpec = entitySpec; | ||
this.aspectSpec = this.entitySpec.getAspectSpec(envelopedAspect.getName()); | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public RecordTemplate getRecordTemplate() { | ||
return envelopedAspect.getValue(); | ||
} | ||
|
||
@Nullable | ||
@Override | ||
public SystemMetadata getSystemMetadata() { | ||
return envelopedAspect.getSystemMetadata(); | ||
} | ||
|
||
@Override | ||
public long getVersion() { | ||
return envelopedAspect.getVersion(); | ||
} | ||
|
||
@Override | ||
public Timestamp getCreatedOn() { | ||
return Timestamp.from(Instant.ofEpochMilli(envelopedAspect.getCreated().getTime())); | ||
} | ||
|
||
@Override | ||
public String getCreatedBy() { | ||
return envelopedAspect.getCreated().getActor().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
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
Oops, something went wrong.