Add Assets field to domain (#16871)

This commit is contained in:
Mohit Yadav 2024-07-01 22:26:56 +05:30 committed by GitHub
parent bf4a3f8baa
commit 079d93b9e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 0 deletions

View File

@ -16,7 +16,9 @@ package org.openmetadata.service.jdbi3;
import static org.openmetadata.common.utils.CommonUtil.listOrEmpty;
import static org.openmetadata.schema.type.Include.ALL;
import static org.openmetadata.service.Entity.DOMAIN;
import static org.openmetadata.service.Entity.FIELD_ASSETS;
import java.util.List;
import lombok.extern.slf4j.Slf4j;
import org.jdbi.v3.sqlobject.transaction.Transaction;
import org.openmetadata.schema.EntityInterface;
@ -48,6 +50,7 @@ public class DomainRepository extends EntityRepository<Domain> {
@Override
public void setFields(Domain entity, Fields fields) {
entity.withAssets(fields.contains(FIELD_ASSETS) ? getAssets(entity) : null);
entity.withParent(getParent(entity));
}
@ -91,6 +94,10 @@ public class DomainRepository extends EntityRepository<Domain> {
}
}
private List<EntityReference> getAssets(Domain entity) {
return findTo(entity.getId(), DOMAIN, Relationship.HAS, null);
}
public BulkOperationResult bulkAddAssets(String domainName, BulkAssets request) {
Domain domain = getByName(null, domainName, getFields("id"));
return bulkAssetsOperation(domain.getId(), DOMAIN, Relationship.HAS, request, true);

View File

@ -78,6 +78,10 @@
"$ref": "../../type/entityReferenceList.json",
"default" : null
},
"assets": {
"description": "Data assets collection that is part of this domain.",
"$ref" : "../../type/entityReferenceList.json"
},
"changeDescription": {
"description": "Change that lead to this version of the entity.",
"$ref": "../../type/entityHistory.json#/definitions/changeDescription"