mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-09-02 13:43:22 +00:00
Set Certification Field Dynamically (#18874)
This commit is contained in:
parent
dbd9311a2c
commit
e2789da9dc
@ -16,11 +16,10 @@ import org.flowable.engine.delegate.JavaDelegate;
|
|||||||
import org.openmetadata.schema.EntityInterface;
|
import org.openmetadata.schema.EntityInterface;
|
||||||
import org.openmetadata.schema.type.AssetCertification;
|
import org.openmetadata.schema.type.AssetCertification;
|
||||||
import org.openmetadata.schema.type.Include;
|
import org.openmetadata.schema.type.Include;
|
||||||
|
import org.openmetadata.schema.type.TagLabel;
|
||||||
import org.openmetadata.service.Entity;
|
import org.openmetadata.service.Entity;
|
||||||
import org.openmetadata.service.jdbi3.EntityRepository;
|
import org.openmetadata.service.jdbi3.EntityRepository;
|
||||||
import org.openmetadata.service.resources.feeds.MessageParser;
|
import org.openmetadata.service.resources.feeds.MessageParser;
|
||||||
import org.openmetadata.service.resources.tags.TagLabelUtil;
|
|
||||||
import org.openmetadata.service.util.EntityUtil;
|
|
||||||
import org.openmetadata.service.util.JsonUtils;
|
import org.openmetadata.service.util.JsonUtils;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@ -76,7 +75,12 @@ public class SetEntityCertificationImpl implements JavaDelegate {
|
|||||||
|
|
||||||
AssetCertification assetCertification =
|
AssetCertification assetCertification =
|
||||||
new AssetCertification()
|
new AssetCertification()
|
||||||
.withTagLabel(EntityUtil.toTagLabel(TagLabelUtil.getTag(certification)));
|
.withTagLabel(
|
||||||
|
new TagLabel()
|
||||||
|
.withTagFQN(certification)
|
||||||
|
.withSource(TagLabel.TagSource.CLASSIFICATION)
|
||||||
|
.withLabelType(TagLabel.LabelType.AUTOMATED)
|
||||||
|
.withState(TagLabel.State.CONFIRMED));
|
||||||
entity.setCertification(assetCertification);
|
entity.setCertification(assetCertification);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -917,6 +917,7 @@ public abstract class EntityRepository<T extends EntityInterface> {
|
|||||||
public final T setFieldsInternal(T entity, Fields fields) {
|
public final T setFieldsInternal(T entity, Fields fields) {
|
||||||
entity.setOwners(fields.contains(FIELD_OWNERS) ? getOwners(entity) : entity.getOwners());
|
entity.setOwners(fields.contains(FIELD_OWNERS) ? getOwners(entity) : entity.getOwners());
|
||||||
entity.setTags(fields.contains(FIELD_TAGS) ? getTags(entity) : entity.getTags());
|
entity.setTags(fields.contains(FIELD_TAGS) ? getTags(entity) : entity.getTags());
|
||||||
|
entity.setCertification(fields.contains(FIELD_TAGS) ? getCertification(entity) : null);
|
||||||
entity.setExtension(
|
entity.setExtension(
|
||||||
fields.contains(FIELD_EXTENSION) ? getExtension(entity) : entity.getExtension());
|
fields.contains(FIELD_EXTENSION) ? getExtension(entity) : entity.getExtension());
|
||||||
// Always return domains of entity
|
// Always return domains of entity
|
||||||
@ -1715,6 +1716,22 @@ public abstract class EntityRepository<T extends EntityInterface> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected AssetCertification getCertification(T entity) {
|
||||||
|
return !supportsCertification ? null : getCertification(entity.getCertification());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected AssetCertification getCertification(AssetCertification certification) {
|
||||||
|
if (certification == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
String certificationTagFqn = certification.getTagLabel().getTagFQN();
|
||||||
|
TagLabel certificationTagLabel =
|
||||||
|
EntityUtil.toTagLabel(TagLabelUtil.getTag(certificationTagFqn));
|
||||||
|
certification.setTagLabel(certificationTagLabel);
|
||||||
|
return certification;
|
||||||
|
}
|
||||||
|
|
||||||
protected List<TagLabel> getTags(T entity) {
|
protected List<TagLabel> getTags(T entity) {
|
||||||
return !supportsTags ? null : getTags(entity.getFullyQualifiedName());
|
return !supportsTags ? null : getTags(entity.getFullyQualifiedName());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user