Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
atlas
Commits
ffcdbb17
Commit
ffcdbb17
authored
8 years ago
by
apoorvnaik
Committed by
Madhan Neethiraj
8 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-1346: Search API to return empty list/container object instead of exception
Signed-off-by:
Madhan Neethiraj
<
madhan@apache.org
>
parent
cae6522d
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
15 additions
and
28 deletions
+15
-28
AtlasErrorCode.java
intg/src/main/java/org/apache/atlas/AtlasErrorCode.java
+1
-1
release-log.txt
release-log.txt
+1
-0
GraphTransactionInterceptor.java
...in/java/org/apache/atlas/GraphTransactionInterceptor.java
+8
-3
AtlasTypeDefGraphStore.java
.../atlas/repository/store/graph/AtlasTypeDefGraphStore.java
+3
-15
AtlasClassificationDefStoreV1.java
...ository/store/graph/v1/AtlasClassificationDefStoreV1.java
+0
-4
TypesResource.java
...in/java/org/apache/atlas/web/resources/TypesResource.java
+2
-3
TypesREST.java
...pp/src/main/java/org/apache/atlas/web/rest/TypesREST.java
+0
-2
No files found.
intg/src/main/java/org/apache/atlas/AtlasErrorCode.java
View file @
ffcdbb17
...
...
@@ -24,7 +24,7 @@ import javax.ws.rs.core.Response;
import
java.text.MessageFormat
;
import
java.util.Arrays
;
public
enum
AtlasErrorCode
{
NO_SEARCH_RESULTS
(
204
,
"ATLAS2041E"
,
"Given search filter did not yield any results"
),
NO_SEARCH_RESULTS
(
204
,
"ATLAS2041E"
,
"Given search filter
{0}
did not yield any results"
),
// All Bad request enums go here
UNKNOWN_TYPE
(
400
,
"ATLAS4001E"
,
"Unknown type {0} for {1}.{2}"
),
...
...
This diff is collapsed.
Click to expand it.
release-log.txt
View file @
ffcdbb17
...
...
@@ -9,6 +9,7 @@ ATLAS-1060 Add composite indexes for exact match performance improvements for al
ATLAS-1127 Modify creation and modification timestamps to Date instead of Long(sumasai)
ALL CHANGES:
ATLAS-1346 Search API to return empty list/container object instead of exception (apoorvnaik via mneethiraj)
ATLAS-1428 Create of entityDef type fails with type already exists exception (sarath.kum4r@gmail.com via mneethiraj)
ATLAS-1421 Regression : HTML is displayed for deleted entities in search-result and entity-details pages (Kalyanikashikar via mneethiraj)
ATLAS-1417 HIveHook: synchronous execution fails to notify (sumasai via mneethiraj)
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/GraphTransactionInterceptor.java
View file @
ffcdbb17
...
...
@@ -80,9 +80,14 @@ public class GraphTransactionInterceptor implements MethodInterceptor {
}
boolean
logException
(
Throwable
t
)
{
return
!(
t
instanceof
NotFoundException
)
&&
((
t
instanceof
AtlasBaseException
)
&&
((
AtlasBaseException
)
t
).
getAtlasErrorCode
().
getHttpCode
()
!=
Response
.
Status
.
NOT_FOUND
);
if
(
t
instanceof
AtlasBaseException
)
{
Response
.
Status
httpCode
=
((
AtlasBaseException
)
t
).
getAtlasErrorCode
().
getHttpCode
();
return
httpCode
!=
Response
.
Status
.
NOT_FOUND
&&
httpCode
!=
Response
.
Status
.
NO_CONTENT
;
}
else
if
(
t
instanceof
NotFoundException
)
{
return
false
;
}
else
{
return
true
;
}
}
public
static
abstract
class
PostTransactionHook
{
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/AtlasTypeDefGraphStore.java
View file @
ffcdbb17
...
...
@@ -208,9 +208,6 @@ public abstract class AtlasTypeDefGraphStore implements AtlasTypeDefStore, Activ
@GraphTransaction
public
AtlasEnumDefs
searchEnumDefs
(
SearchFilter
filter
)
throws
AtlasBaseException
{
AtlasEnumDefs
search
=
getEnumDefStore
(
typeRegistry
).
search
(
filter
);
if
(
search
==
null
||
search
.
getTotalCount
()
==
0
)
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
NO_SEARCH_RESULTS
);
}
return
search
;
}
...
...
@@ -323,9 +320,7 @@ public abstract class AtlasTypeDefGraphStore implements AtlasTypeDefStore, Activ
@GraphTransaction
public
AtlasStructDefs
searchStructDefs
(
SearchFilter
filter
)
throws
AtlasBaseException
{
AtlasStructDefs
search
=
getStructDefStore
(
typeRegistry
).
search
(
filter
);
if
(
search
==
null
||
search
.
getTotalCount
()
==
0
)
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
NO_SEARCH_RESULTS
);
}
return
search
;
}
...
...
@@ -442,9 +437,7 @@ public abstract class AtlasTypeDefGraphStore implements AtlasTypeDefStore, Activ
@GraphTransaction
public
AtlasClassificationDefs
searchClassificationDefs
(
SearchFilter
filter
)
throws
AtlasBaseException
{
AtlasClassificationDefs
search
=
getClassificationDefStore
(
typeRegistry
).
search
(
filter
);
if
(
search
==
null
||
search
.
getTotalCount
()
==
0
)
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
NO_SEARCH_RESULTS
);
}
return
search
;
}
...
...
@@ -557,9 +550,7 @@ public abstract class AtlasTypeDefGraphStore implements AtlasTypeDefStore, Activ
@GraphTransaction
public
AtlasEntityDefs
searchEntityDefs
(
SearchFilter
filter
)
throws
AtlasBaseException
{
AtlasEntityDefs
search
=
getEntityDefStore
(
typeRegistry
).
search
(
filter
);
if
(
search
==
null
||
search
.
getTotalCount
()
==
0
)
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
NO_SEARCH_RESULTS
);
}
return
search
;
}
...
...
@@ -917,9 +908,6 @@ public abstract class AtlasTypeDefGraphStore implements AtlasTypeDefStore, Activ
LOG
.
error
(
"Failed to retrieve the EntityDefs"
,
ex
);
}
if
(
typesDef
.
isEmpty
())
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
NO_SEARCH_RESULTS
);
}
return
typesDef
;
}
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasClassificationDefStoreV1.java
View file @
ffcdbb17
...
...
@@ -347,7 +347,6 @@ public class AtlasClassificationDefStoreV1 extends AtlasAbstractDefStoreV1 imple
}
}
if
(
CollectionUtils
.
isNotEmpty
(
classificationDefs
))
{
CollectionUtils
.
filter
(
classificationDefs
,
FilterUtil
.
getPredicateFromSearchFilter
(
filter
));
AtlasClassificationDefs
ret
=
new
AtlasClassificationDefs
(
classificationDefs
);
...
...
@@ -356,9 +355,6 @@ public class AtlasClassificationDefStoreV1 extends AtlasAbstractDefStoreV1 imple
LOG
.
debug
(
"<== AtlasClassificationDefStoreV1.search({}): {}"
,
filter
,
ret
);
}
return
ret
;
}
else
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
NO_SEARCH_RESULTS
);
}
}
private
void
updateVertexPreCreate
(
AtlasClassificationDef
classificationDef
,
...
...
This diff is collapsed.
Click to expand it.
webapp/src/main/java/org/apache/atlas/web/resources/TypesResource.java
View file @
ffcdbb17
...
...
@@ -265,9 +265,8 @@ public class TypesResource {
return
Response
.
ok
(
response
).
build
();
}
catch
(
AtlasBaseException
e
)
{
LOG
.
error
(
"Given search filter did not yield any results"
);
throw
new
WebApplicationException
(
Servlets
.
getErrorResponse
(
new
Exception
(
"Given search filter did not yield any results "
),
Response
.
Status
.
BAD_REQUEST
));
LOG
.
warn
(
"TypesREST exception: {} {}"
,
e
.
getClass
().
getSimpleName
(),
e
.
getMessage
());
throw
new
WebApplicationException
(
Servlets
.
getErrorResponse
(
e
,
e
.
getAtlasErrorCode
().
getHttpCode
()));
}
catch
(
Throwable
e
)
{
LOG
.
error
(
"Unable to get types list"
,
e
);
throw
new
WebApplicationException
(
Servlets
.
getErrorResponse
(
e
,
Response
.
Status
.
INTERNAL_SERVER_ERROR
));
...
...
This diff is collapsed.
Click to expand it.
webapp/src/main/java/org/apache/atlas/web/rest/TypesREST.java
View file @
ffcdbb17
...
...
@@ -34,8 +34,6 @@ import org.apache.atlas.store.AtlasTypeDefStore;
import
org.apache.atlas.type.AtlasTypeUtil
;
import
org.apache.atlas.web.util.Servlets
;
import
org.apache.http.annotation.Experimental
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
javax.inject.Singleton
;
import
javax.servlet.http.HttpServletRequest
;
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment