Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,6 @@ private void processUpdateDomain(AtlasEntity entity, AtlasVertex vertex) throws
}

if (!newParentDomainQualifiedName.equals(currentParentDomainQualifiedName) && entity.hasRelationshipAttribute(PARENT_DOMAIN_REL_TYPE)) {
if(storedDomain.getRelationshipAttribute(PARENT_DOMAIN_REL_TYPE) == null &&
StringUtils.isEmpty( (String) storedDomain.getAttribute(PARENT_DOMAIN_QN_ATTR))){
throw new AtlasBaseException(AtlasErrorCode.BAD_REQUEST, "Cannot move Super Domain inside another domain");
}

//Auth check
isAuthorizedToMove(DATA_DOMAIN_ENTITY_TYPE, currentParentDomainHeader, newParentDomainHeader);

Expand Down Expand Up @@ -202,6 +197,8 @@ private void processMoveSubDomainToAnotherDomain(AtlasEntity domain,

domainExists(domainName, targetDomainQualifiedName, domain.getGuid());

isParentDomainMovedToChild(targetDomainQualifiedName, currentDomainQualifiedName);

if(targetDomainQualifiedName.isEmpty()){
//Moving subDomain to make it Super Domain
targetDomainQualifiedName = "default";
Expand Down Expand Up @@ -424,6 +421,12 @@ public void processDelete(AtlasVertex vertex) throws AtlasBaseException {
throw new AtlasBaseException(AtlasErrorCode.OPERATION_NOT_SUPPORTED, "Domain cannot be deleted because some assets are linked to this domain");
}
}

private void isParentDomainMovedToChild(String targetDomainQualifiedName, String currentDomainQualifiedName) throws AtlasBaseException {
if(targetDomainQualifiedName.startsWith(currentDomainQualifiedName)){
throw new AtlasBaseException(AtlasErrorCode.OPERATION_NOT_SUPPORTED, "Cannot move a domain to its child domain");
}
}
}


Loading