mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-07-26 19:00:02 +00:00
Add Assets field to domain (#16871)
This commit is contained in:
parent
bf4a3f8baa
commit
079d93b9e5
@ -16,7 +16,9 @@ package org.openmetadata.service.jdbi3;
|
|||||||
import static org.openmetadata.common.utils.CommonUtil.listOrEmpty;
|
import static org.openmetadata.common.utils.CommonUtil.listOrEmpty;
|
||||||
import static org.openmetadata.schema.type.Include.ALL;
|
import static org.openmetadata.schema.type.Include.ALL;
|
||||||
import static org.openmetadata.service.Entity.DOMAIN;
|
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 lombok.extern.slf4j.Slf4j;
|
||||||
import org.jdbi.v3.sqlobject.transaction.Transaction;
|
import org.jdbi.v3.sqlobject.transaction.Transaction;
|
||||||
import org.openmetadata.schema.EntityInterface;
|
import org.openmetadata.schema.EntityInterface;
|
||||||
@ -48,6 +50,7 @@ public class DomainRepository extends EntityRepository<Domain> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setFields(Domain entity, Fields fields) {
|
public void setFields(Domain entity, Fields fields) {
|
||||||
|
entity.withAssets(fields.contains(FIELD_ASSETS) ? getAssets(entity) : null);
|
||||||
entity.withParent(getParent(entity));
|
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) {
|
public BulkOperationResult bulkAddAssets(String domainName, BulkAssets request) {
|
||||||
Domain domain = getByName(null, domainName, getFields("id"));
|
Domain domain = getByName(null, domainName, getFields("id"));
|
||||||
return bulkAssetsOperation(domain.getId(), DOMAIN, Relationship.HAS, request, true);
|
return bulkAssetsOperation(domain.getId(), DOMAIN, Relationship.HAS, request, true);
|
||||||
|
@ -78,6 +78,10 @@
|
|||||||
"$ref": "../../type/entityReferenceList.json",
|
"$ref": "../../type/entityReferenceList.json",
|
||||||
"default" : null
|
"default" : null
|
||||||
},
|
},
|
||||||
|
"assets": {
|
||||||
|
"description": "Data assets collection that is part of this domain.",
|
||||||
|
"$ref" : "../../type/entityReferenceList.json"
|
||||||
|
},
|
||||||
"changeDescription": {
|
"changeDescription": {
|
||||||
"description": "Change that lead to this version of the entity.",
|
"description": "Change that lead to this version of the entity.",
|
||||||
"$ref": "../../type/entityHistory.json#/definitions/changeDescription"
|
"$ref": "../../type/entityHistory.json#/definitions/changeDescription"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user