atlas git commit: ATLAS-2025: Validation of classification/type in basic search query
Repository: atlas Updated Branches: refs/heads/0.8-incubating fe69c849e -> b993f9227 ATLAS-2025: Validation of classification/type in basic search query Signed-off-by: Madhan Neethiraj (cherry picked from commit b714fe00656f529cec8e4b467322a41729f0ddc5) Project: http://git-wip-us.apache.org/repos/asf/atlas/repo Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/b993f922 Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/b993f922 Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/b993f922 Branch: refs/heads/0.8-incubating Commit: b993f92270a595775d319beabf1f753e1f296067 Parents: fe69c84 Author: apoorvnaik Authored: Sun Aug 13 00:53:38 2017 -0700 Committer: Madhan Neethiraj Committed: Sun Aug 13 01:14:17 2017 -0700 -- .../java/org/apache/atlas/AtlasErrorCode.java | 8 +++-- .../atlas/discovery/EntityDiscoveryService.java | 21 ++- .../apache/atlas/discovery/SearchContext.java | 38 ++-- .../apache/atlas/web/rest/DiscoveryREST.java| 6 +++- 4 files changed, 49 insertions(+), 24 deletions(-) -- http://git-wip-us.apache.org/repos/asf/atlas/blob/b993f922/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java -- diff --git a/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java b/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java index f267a33..aa8e3f4 100644 --- a/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java +++ b/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java @@ -36,7 +36,7 @@ public enum AtlasErrorCode { CONSTRAINT_MISSING_PARAMS(400, "ATLAS-400-00-007", "{0}.{1} : invalid constraint. missing parameter {2} in {3}. params={4}"), CONSTRAINT_NOT_EXIST(400, "ATLAS-400-00-008", "{0}.{1} : invalid constraint. {2} {3}.{4} does not exist"), CONSTRAINT_NOT_MATCHED(400, "ATLAS-400-00-009", "{0}.{1} : invalid constraint. Data type of {2} {3}.{4} should be {5}, but found {6}"), -UNKNOWN_TYPENAME(400, "ATLAS-400-00-00A", "{0}: Unknown typename"), +UNKNOWN_TYPENAME(400, "ATLAS-400-00-00A", "{0}: Unknown/invalid typename"), CONSTRAINT_NOT_SUPPORTED_ON_MAP_TYPE(400, "ATLAS-400-00-00B", "{0}.{1} : constraints not supported on map type {2}"), CANNOT_ADD_MANDATORY_ATTRIBUTE(400, "ATLAS-400-00-00C", "{0}.{1} : can not add mandatory attribute"), ATTRIBUTE_DELETION_NOT_SUPPORTED(400, "ATLAS-400-00-00D", "{0}.{1} : attribute delete not supported"), @@ -71,10 +71,12 @@ public enum AtlasErrorCode { BAD_REQUEST(400, "ATLAS-400-00-029", "{0}"), PARAMETER_PARSING_FAILED(400, "ATLAS-400-00-02A", "Parameter parsing failed at: {0}"), MISSING_MANDATORY_ATTRIBUTE(400, "ATLAS-400-00-02B", "Mandatory field {0}.{1} has empty/null value"), -INVALID_RELATIONSHIP_ATTRIBUTE(400, "ATLAS-400-00-02C", "Expected attribute {0} to be a relationship but found type {}"), -INVALID_RELATIONSHIP_TYPE(400, "ATLAS-400-00-02D", "Invalid entity type '{0}', guid '{1}' in relationship search"), + INVALID_RELATIONSHIP_ATTRIBUTE(400, "ATLAS-400-00-02C", "Expected attribute {0} to be a relationship but found type {}"), + INVALID_RELATIONSHIP_TYPE(400, "ATLAS-400-00-02D", "Invalid entity type '{0}', guid '{1}' in relationship search"), // All Not found enums go here +UNKNOWN_CLASSIFICATION(400, "ATLAS-400-00-046", "{0}: Unknown/invalid classification"), +INVALID_SEARCH_PARAMS(400, "ATLAS-400-00-047", "No search parameter was found. One of the following MUST be specified in the request; typeName, classification or queryText"), TYPE_NAME_NOT_FOUND(404, "ATLAS-404-00-001", "Given typename {0} was invalid"), TYPE_GUID_NOT_FOUND(404, "ATLAS-404-00-002", "Given type guid {0} was invalid"), EMPTY_RESULTS(404, "ATLAS-404-00-004", "No result found for {0}"), http://git-wip-us.apache.org/repos/asf/atlas/blob/b993f922/repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java -- diff --git a/repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java b/repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java index 6f467e5..d5062a7 100644 --- a/repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java +++ b/repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java @@ -438,18 +438,21 @@ public class EntityDiscoveryService implements AtlasDiscoveryService { resultAttributes.addAll(context.getEntityAttributes()); } -for (String resultAttribute : resultAttributes) { -AtlasAttribute attribute = context.getEntityType().getAttribute(resultAttribute); +AtlasEntityType entityType = context.getEntityType(); +if (ent
atlas git commit: ATLAS-2025: Validation of classification/type in basic search query
Repository: atlas Updated Branches: refs/heads/master cd49be50a -> b714fe006 ATLAS-2025: Validation of classification/type in basic search query Signed-off-by: Madhan Neethiraj Project: http://git-wip-us.apache.org/repos/asf/atlas/repo Commit: http://git-wip-us.apache.org/repos/asf/atlas/commit/b714fe00 Tree: http://git-wip-us.apache.org/repos/asf/atlas/tree/b714fe00 Diff: http://git-wip-us.apache.org/repos/asf/atlas/diff/b714fe00 Branch: refs/heads/master Commit: b714fe00656f529cec8e4b467322a41729f0ddc5 Parents: cd49be5 Author: apoorvnaik Authored: Sun Aug 13 00:53:38 2017 -0700 Committer: Madhan Neethiraj Committed: Sun Aug 13 00:53:38 2017 -0700 -- .../java/org/apache/atlas/AtlasErrorCode.java | 7 ++-- .../atlas/discovery/EntityDiscoveryService.java | 21 ++- .../apache/atlas/discovery/SearchContext.java | 38 ++-- .../apache/atlas/web/rest/DiscoveryREST.java| 6 +++- 4 files changed, 49 insertions(+), 23 deletions(-) -- http://git-wip-us.apache.org/repos/asf/atlas/blob/b714fe00/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java -- diff --git a/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java b/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java index 36fcc03..6fa1f60 100644 --- a/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java +++ b/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java @@ -36,7 +36,7 @@ public enum AtlasErrorCode { CONSTRAINT_MISSING_PARAMS(400, "ATLAS-400-00-007", "{0}.{1} : invalid constraint. missing parameter {2} in {3}. params={4}"), CONSTRAINT_NOT_EXIST(400, "ATLAS-400-00-008", "{0}.{1} : invalid constraint. {2} {3}.{4} does not exist"), CONSTRAINT_NOT_MATCHED(400, "ATLAS-400-00-009", "{0}.{1} : invalid constraint. Data type of {2} {3}.{4} should be {5}, but found {6}"), -UNKNOWN_TYPENAME(400, "ATLAS-400-00-00A", "{0}: Unknown typename"), +UNKNOWN_TYPENAME(400, "ATLAS-400-00-00A", "{0}: Unknown/invalid typename"), CONSTRAINT_NOT_SUPPORTED_ON_MAP_TYPE(400, "ATLAS-400-00-00B", "{0}.{1} : constraints not supported on map type {2}"), CANNOT_ADD_MANDATORY_ATTRIBUTE(400, "ATLAS-400-00-00C", "{0}.{1} : can not add mandatory attribute"), ATTRIBUTE_DELETION_NOT_SUPPORTED(400, "ATLAS-400-00-00D", "{0}.{1} : attribute delete not supported"), @@ -90,6 +90,8 @@ public enum AtlasErrorCode { RELATIONSHIPDEF_NOT_DEFINED(400, "ATLAS-400-00-043", "No relationshipDef defined between {0} and {1} on attribute: {2}"), RELATIONSHIPDEF_INVALID(400, "ATLAS-400-00-044", "Invalid relationshipDef: {0}"), RELATIONSHIP_INVALID_ENDTYPE(400, "ATLAS-400-00-045", "Invalid entity-type for relationship attribute â{0}â: entity specified (guid={1}) is of type â{2}â, but expected type is â{3}â"), +UNKNOWN_CLASSIFICATION(400, "ATLAS-400-00-046", "{0}: Unknown/invalid classification"), +INVALID_SEARCH_PARAMS(400, "ATLAS-400-00-047", "No search parameter was found. One of the following MUST be specified in the request; typeName, classification or queryText"), // All Not found enums go here TYPE_NAME_NOT_FOUND(404, "ATLAS-404-00-001", "Given typename {0} was invalid"), TYPE_GUID_NOT_FOUND(404, "ATLAS-404-00-002", "Given type guid {0} was invalid"), @@ -104,6 +106,7 @@ public enum AtlasErrorCode { RELATIONSHIP_GUID_NOT_FOUND(404, "ATLAS-404-00-00C", "Given relationship guid {0} is invalid/not found"), RELATIONSHIP_CRUD_INVALID_PARAMS(404, "ATLAS-404-00-00D", "Invalid relationship creation/updation parameters passed : {0}"), RELATIONSHIPDEF_END_TYPE_NAME_NOT_FOUND(404, "ATLAS-404-00-00E", "RelationshipDef {0} endDef typename {0} cannot be found"), + // All data conflict errors go here TYPE_ALREADY_EXISTS(409, "ATLAS-409-00-001", "Given type {0} already exists"), TYPE_HAS_REFERENCES(409, "ATLAS-409-00-002", "Given type {0} has references"), @@ -165,4 +168,4 @@ public enum AtlasErrorCode { public String getErrorCode() { return errorCode; } -} \ No newline at end of file +} http://git-wip-us.apache.org/repos/asf/atlas/blob/b714fe00/repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java -- diff --git a/repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java b/repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java index 66dd748..a7aaefe 100644 --- a/repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java +++ b/repository/src/main/java/org/apache/atlas/discovery/EntityDiscoveryService.java @@ -427,18 +427,21 @@ public class EntityDiscoveryService implements AtlasDiscoveryService { resultAttributes.addAll(context.