Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions intg/src/main/java/org/apache/atlas/AtlasErrorCode.java
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ public enum AtlasErrorCode {
BLANK_VALUE_ATTRIBUTE(400, "ATLAS-400-00-105", "Value Attribute can't be empty!"),
INVALID_RELATIONSHIP_LABEL(400, "ATLAS-400-00-106", "Invalid relationship label {0}. The referenced entity type {1} could not be resolved from the type registry."),
NON_INDEXABLE_BM_DELETE_NOT_ALLOWED(400, "ATLAS-400-00-107", "Deletion not allowed for non-indexable Business Metadata ''{0}'' without force=true. Non-indexable attributes cannot be validated efficiently for references; use force=true to skip validation and delete (warning: orphaned references may remain)."),
CLASSIFICATIONDEF_SUBTYPES_NOT_ALLOWED(400, "ATLAS-400-00-107", "ClassificationDef {0}: subTypes is a derived field and cannot be specified during create/update. To establish a parent-child relationship, set superTypes on the child classification instead."),

UNAUTHORIZED_ACCESS(403, "ATLAS-403-00-001", "{0} is not authorized to perform {1}"),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,7 @@ public AtlasTypesDef createTypesDef(AtlasTypesDef typesDef) throws AtlasBaseExce
}

AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit();
validateClassificationDefsHaveNoSubTypes(typesDef);
tryTypeCreation(typesDef, ttr);

AtlasTypesDef ret = addToGraphStore(typesDef, ttr);
Expand Down Expand Up @@ -460,7 +461,7 @@ public AtlasTypesDef updateTypesDef(AtlasTypesDef typesDef) throws AtlasBaseExce
}

AtlasTransientTypeRegistry ttr = lockTypeRegistryAndReleasePostCommit();

validateClassificationDefsHaveNoSubTypes(typesDef);
// Translate any NOT FOUND errors to BAD REQUEST
try {
ttr.updateTypes(typesDef);
Expand Down Expand Up @@ -493,6 +494,17 @@ public AtlasTypesDef updateTypesDef(AtlasTypesDef typesDef) throws AtlasBaseExce
return ret;
}

private void validateClassificationDefsHaveNoSubTypes(AtlasTypesDef typesDef) throws AtlasBaseException {
if (CollectionUtils.isNotEmpty(typesDef.getClassificationDefs())) {
for (AtlasClassificationDef classificationDef : typesDef.getClassificationDefs()) {
if (CollectionUtils.isNotEmpty(classificationDef.getSubTypes())) {
LOG.info("ClassificationDef {}: subTypes is a derived field and cannot be specified during create/update. To establish a parent-child relationship, set superTypes on the child instead.", classificationDef.getName());
throw new AtlasBaseException(AtlasErrorCode.CLASSIFICATIONDEF_SUBTYPES_NOT_ALLOWED, classificationDef.getName());
}
}
}
}

@Override
@GraphTransaction
public AtlasTypesDef createUpdateTypesDef(AtlasTypesDef typesDef) throws AtlasBaseException {
Expand Down
Binary file modified repository/src/test/resources/tag-prop-2.zip
Binary file not shown.