diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DomainRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DomainRepository.java index 842fe423c56..fe9d98d994e 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DomainRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/DomainRepository.java @@ -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 { @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 { } } + private List 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); diff --git a/openmetadata-spec/src/main/resources/json/schema/entity/domains/domain.json b/openmetadata-spec/src/main/resources/json/schema/entity/domains/domain.json index fbd4398060d..b2d447a43f1 100644 --- a/openmetadata-spec/src/main/resources/json/schema/entity/domains/domain.json +++ b/openmetadata-spec/src/main/resources/json/schema/entity/domains/domain.json @@ -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"