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
8535e88c
Commit
8535e88c
authored
Jan 10, 2018
by
Madhan Neethiraj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-2351: fixed V1 REST APIs to retain the format for date type attributes as in earlier versions
parent
9f0866c8
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
119 additions
and
103 deletions
+119
-103
AtlasBaseClient.java
...ommon/src/main/java/org/apache/atlas/AtlasBaseClient.java
+3
-5
AtlasJson.java
intg/src/main/java/org/apache/atlas/utils/AtlasJson.java
+33
-21
AdminResource.java
...in/java/org/apache/atlas/web/resources/AdminResource.java
+10
-8
EntityResource.java
...n/java/org/apache/atlas/web/resources/EntityResource.java
+53
-46
TypesResource.java
...in/java/org/apache/atlas/web/resources/TypesResource.java
+20
-23
No files found.
client/common/src/main/java/org/apache/atlas/AtlasBaseClient.java
View file @
8535e88c
...
@@ -348,9 +348,7 @@ public abstract class AtlasBaseClient {
...
@@ -348,9 +348,7 @@ public abstract class AtlasBaseClient {
clientResponse
=
requestBuilder
.
method
(
api
.
getMethod
(),
ClientResponse
.
class
,
requestObject
);
clientResponse
=
requestBuilder
.
method
(
api
.
getMethod
(),
ClientResponse
.
class
,
requestObject
);
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
info
(
"HTTP Status : {}"
,
clientResponse
.
getStatus
());
LOG
.
debug
(
"API {} returned status {}"
,
resource
.
getURI
(),
clientResponse
.
getStatus
());
}
if
(
clientResponse
.
getStatus
()
==
api
.
getExpectedStatus
().
getStatusCode
())
{
if
(
clientResponse
.
getStatus
()
==
api
.
getExpectedStatus
().
getStatusCode
())
{
if
(
responseType
==
null
)
{
if
(
responseType
==
null
)
{
...
@@ -361,7 +359,7 @@ public abstract class AtlasBaseClient {
...
@@ -361,7 +359,7 @@ public abstract class AtlasBaseClient {
String
stringEntity
=
clientResponse
.
getEntity
(
String
.
class
);
String
stringEntity
=
clientResponse
.
getEntity
(
String
.
class
);
try
{
try
{
JsonNode
jsonObject
=
AtlasJson
.
parseToV1JsonNode
(
stringEntity
);
JsonNode
jsonObject
=
AtlasJson
.
parseToV1JsonNode
(
stringEntity
);
LOG
.
debug
(
"Response =
{}"
,
jsonObject
);
LOG
.
info
(
"Response :
{}"
,
jsonObject
);
LOG
.
info
(
"------------------------------------------------------"
);
LOG
.
info
(
"------------------------------------------------------"
);
return
(
T
)
jsonObject
;
return
(
T
)
jsonObject
;
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
...
@@ -369,7 +367,7 @@ public abstract class AtlasBaseClient {
...
@@ -369,7 +367,7 @@ public abstract class AtlasBaseClient {
}
}
}
else
{
}
else
{
T
entity
=
clientResponse
.
getEntity
(
responseType
);
T
entity
=
clientResponse
.
getEntity
(
responseType
);
LOG
.
debug
(
"Response =
{}"
,
entity
);
LOG
.
info
(
"Response :
{}"
,
entity
);
LOG
.
info
(
"------------------------------------------------------"
);
LOG
.
info
(
"------------------------------------------------------"
);
return
entity
;
return
entity
;
}
}
...
...
intg/src/main/java/org/apache/atlas/utils/AtlasJson.java
View file @
8535e88c
...
@@ -97,14 +97,18 @@ public class AtlasJson {
...
@@ -97,14 +97,18 @@ public class AtlasJson {
}
}
public
static
<
T
>
T
fromJson
(
String
jsonStr
,
Class
<
T
>
type
)
{
public
static
<
T
>
T
fromJson
(
String
jsonStr
,
Class
<
T
>
type
)
{
T
ret
;
T
ret
=
null
;
try
{
ret
=
mapper
.
readValue
(
jsonStr
,
type
);
}
catch
(
IOException
e
){
LOG
.
error
(
"AtlasType.fromJson()"
,
e
);
ret
=
null
;
if
(
jsonStr
!=
null
)
{
try
{
ret
=
mapper
.
readValue
(
jsonStr
,
type
);
}
catch
(
IOException
e
)
{
LOG
.
error
(
"AtlasType.fromJson()"
,
e
);
ret
=
null
;
}
}
}
return
ret
;
return
ret
;
}
}
...
@@ -121,30 +125,38 @@ public class AtlasJson {
...
@@ -121,30 +125,38 @@ public class AtlasJson {
}
}
public
static
<
T
>
T
fromV1Json
(
String
jsonStr
,
Class
<
T
>
type
)
{
public
static
<
T
>
T
fromV1Json
(
String
jsonStr
,
Class
<
T
>
type
)
{
T
ret
;
T
ret
=
null
;
try
{
ret
=
mapperV1
.
readValue
(
jsonStr
,
type
);
if
(
ret
instanceof
Struct
)
{
if
(
jsonStr
!=
null
)
{
((
Struct
)
ret
).
normalize
();
try
{
}
ret
=
mapperV1
.
readValue
(
jsonStr
,
type
);
}
catch
(
IOException
e
){
LOG
.
error
(
"AtlasType.fromV1Json()"
,
e
);
ret
=
null
;
if
(
ret
instanceof
Struct
)
{
((
Struct
)
ret
).
normalize
();
}
}
catch
(
IOException
e
)
{
LOG
.
error
(
"AtlasType.fromV1Json()"
,
e
);
ret
=
null
;
}
}
}
return
ret
;
return
ret
;
}
}
public
static
<
T
>
T
fromV1Json
(
String
jsonStr
,
TypeReference
<
T
>
type
)
{
public
static
<
T
>
T
fromV1Json
(
String
jsonStr
,
TypeReference
<
T
>
type
)
{
T
ret
;
T
ret
=
null
;
try
{
ret
=
mapperV1
.
readValue
(
jsonStr
,
type
);
}
catch
(
IOException
e
){
LOG
.
error
(
"AtlasType.toV1Json()"
,
e
);
ret
=
null
;
if
(
jsonStr
!=
null
)
{
try
{
ret
=
mapperV1
.
readValue
(
jsonStr
,
type
);
}
catch
(
IOException
e
)
{
LOG
.
error
(
"AtlasType.toV1Json()"
,
e
);
ret
=
null
;
}
}
}
return
ret
;
return
ret
;
}
}
...
...
webapp/src/main/java/org/apache/atlas/web/resources/AdminResource.java
View file @
8535e88c
...
@@ -18,7 +18,6 @@
...
@@ -18,7 +18,6 @@
package
org
.
apache
.
atlas
.
web
.
resources
;
package
org
.
apache
.
atlas
.
web
.
resources
;
import
com.fasterxml.jackson.databind.node.ObjectNode
;
import
com.sun.jersey.multipart.FormDataParam
;
import
com.sun.jersey.multipart.FormDataParam
;
import
org.apache.atlas.ApplicationProperties
;
import
org.apache.atlas.ApplicationProperties
;
import
org.apache.atlas.AtlasClient
;
import
org.apache.atlas.AtlasClient
;
...
@@ -75,7 +74,10 @@ import javax.ws.rs.core.Response;
...
@@ -75,7 +74,10 @@ import javax.ws.rs.core.Response;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.util.Collection
;
import
java.util.Collection
;
import
java.util.Collections
;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.Set
;
import
java.util.concurrent.locks.ReentrantLock
;
import
java.util.concurrent.locks.ReentrantLock
;
...
@@ -186,7 +188,7 @@ public class AdminResource {
...
@@ -186,7 +188,7 @@ public class AdminResource {
try
{
try
{
PropertiesConfiguration
configProperties
=
new
PropertiesConfiguration
(
"atlas-buildinfo.properties"
);
PropertiesConfiguration
configProperties
=
new
PropertiesConfiguration
(
"atlas-buildinfo.properties"
);
ObjectNode
response
=
AtlasJson
.
createV1ObjectNode
();
Map
<
String
,
Object
>
response
=
new
HashMap
<
String
,
Object
>
();
response
.
put
(
"Version"
,
configProperties
.
getString
(
"build.version"
,
"UNKNOWN"
));
response
.
put
(
"Version"
,
configProperties
.
getString
(
"build.version"
,
"UNKNOWN"
));
response
.
put
(
"Name"
,
configProperties
.
getString
(
"project.name"
,
"apache-atlas"
));
response
.
put
(
"Name"
,
configProperties
.
getString
(
"project.name"
,
"apache-atlas"
));
response
.
put
(
"Description"
,
configProperties
.
getString
(
"project.description"
,
response
.
put
(
"Description"
,
configProperties
.
getString
(
"project.description"
,
...
@@ -194,7 +196,7 @@ public class AdminResource {
...
@@ -194,7 +196,7 @@ public class AdminResource {
// todo: add hadoop version?
// todo: add hadoop version?
// response.put("Hadoop", VersionInfo.getVersion() + "-r" + VersionInfo.getRevision());
// response.put("Hadoop", VersionInfo.getVersion() + "-r" + VersionInfo.getRevision());
version
=
Response
.
ok
(
response
).
build
();
version
=
Response
.
ok
(
AtlasJson
.
toV1Json
(
response
)
).
build
();
}
catch
(
ConfigurationException
e
)
{
}
catch
(
ConfigurationException
e
)
{
throw
new
WebApplicationException
(
Servlets
.
getErrorResponse
(
e
,
Response
.
Status
.
INTERNAL_SERVER_ERROR
));
throw
new
WebApplicationException
(
Servlets
.
getErrorResponse
(
e
,
Response
.
Status
.
INTERNAL_SERVER_ERROR
));
}
}
...
@@ -215,8 +217,8 @@ public class AdminResource {
...
@@ -215,8 +217,8 @@ public class AdminResource {
LOG
.
debug
(
"==> AdminResource.getStatus()"
);
LOG
.
debug
(
"==> AdminResource.getStatus()"
);
}
}
ObjectNode
responseData
=
AtlasJson
.
createV1ObjectNode
(
AtlasClient
.
STATUS
,
serviceState
.
getState
().
toString
());
Map
<
String
,
Object
>
responseData
=
Collections
.
singletonMap
(
AtlasClient
.
STATUS
,
serviceState
.
getState
().
toString
());
Response
response
=
Response
.
ok
(
responseData
).
build
();
Response
response
=
Response
.
ok
(
AtlasJson
.
toV1Json
(
responseData
)
).
build
();
if
(
LOG
.
isDebugEnabled
())
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"<== AdminResource.getStatus()"
);
LOG
.
debug
(
"<== AdminResource.getStatus()"
);
...
@@ -253,7 +255,7 @@ public class AdminResource {
...
@@ -253,7 +255,7 @@ public class AdminResource {
AtlasActionTypes
.
CREATE
,
userName
,
groups
,
httpServletRequest
);
AtlasActionTypes
.
CREATE
,
userName
,
groups
,
httpServletRequest
);
}
}
ObjectNode
responseData
=
AtlasJson
.
createV1ObjectNode
();
Map
<
String
,
Object
>
responseData
=
new
HashMap
<>
();
responseData
.
put
(
isCSRF_ENABLED
,
AtlasCSRFPreventionFilter
.
isCSRF_ENABLED
);
responseData
.
put
(
isCSRF_ENABLED
,
AtlasCSRFPreventionFilter
.
isCSRF_ENABLED
);
responseData
.
put
(
BROWSER_USER_AGENT_PARAM
,
AtlasCSRFPreventionFilter
.
BROWSER_USER_AGENTS_DEFAULT
);
responseData
.
put
(
BROWSER_USER_AGENT_PARAM
,
AtlasCSRFPreventionFilter
.
BROWSER_USER_AGENTS_DEFAULT
);
...
@@ -263,9 +265,9 @@ public class AdminResource {
...
@@ -263,9 +265,9 @@ public class AdminResource {
responseData
.
put
(
isEntityCreateAllowed
,
isEntityCreateAccessAllowed
);
responseData
.
put
(
isEntityCreateAllowed
,
isEntityCreateAccessAllowed
);
responseData
.
put
(
editableEntityTypes
,
getEditableEntityTypes
(
atlasProperties
));
responseData
.
put
(
editableEntityTypes
,
getEditableEntityTypes
(
atlasProperties
));
responseData
.
put
(
"userName"
,
userName
);
responseData
.
put
(
"userName"
,
userName
);
responseData
.
put
(
"groups"
,
AtlasJson
.
createV1ArrayNode
(
groups
)
);
responseData
.
put
(
"groups"
,
groups
);
response
=
Response
.
ok
(
responseData
).
build
();
response
=
Response
.
ok
(
AtlasJson
.
toV1Json
(
responseData
)
).
build
();
if
(
LOG
.
isDebugEnabled
())
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"<== AdminResource.getUserProfile()"
);
LOG
.
debug
(
"<== AdminResource.getUserProfile()"
);
...
...
webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java
View file @
8535e88c
...
@@ -19,7 +19,6 @@
...
@@ -19,7 +19,6 @@
package
org
.
apache
.
atlas
.
web
.
resources
;
package
org
.
apache
.
atlas
.
web
.
resources
;
import
com.fasterxml.jackson.databind.node.ArrayNode
;
import
com.fasterxml.jackson.databind.node.ArrayNode
;
import
com.fasterxml.jackson.databind.node.ObjectNode
;
import
com.google.common.annotations.VisibleForTesting
;
import
com.google.common.annotations.VisibleForTesting
;
import
com.google.common.base.Preconditions
;
import
com.google.common.base.Preconditions
;
import
org.apache.atlas.AtlasClient
;
import
org.apache.atlas.AtlasClient
;
...
@@ -149,7 +148,7 @@ public class EntityResource {
...
@@ -149,7 +148,7 @@ public class EntityResource {
jsonStrings
=
new
String
[
jsonEntities
.
size
()];
jsonStrings
=
new
String
[
jsonEntities
.
size
()];
for
(
int
i
=
0
;
i
<
jsonEntities
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
jsonEntities
.
size
();
i
++)
{
jsonStrings
[
i
]
=
jsonEntities
.
get
(
i
).
textValue
(
);
jsonStrings
[
i
]
=
AtlasJson
.
toV1Json
(
jsonEntities
.
get
(
i
)
);
}
}
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
jsonStrings
=
new
String
[
1
];
jsonStrings
=
new
String
[
1
];
...
@@ -172,8 +171,8 @@ public class EntityResource {
...
@@ -172,8 +171,8 @@ public class EntityResource {
final
CreateUpdateEntitiesResult
result
=
restAdapters
.
toCreateUpdateEntitiesResult
(
mutationResponse
);
final
CreateUpdateEntitiesResult
result
=
restAdapters
.
toCreateUpdateEntitiesResult
(
mutationResponse
);
ObjectNode
response
=
getResponse
(
result
);
String
response
=
getResponse
(
result
);
URI
locationURI
=
getLocationURI
(
guids
);
URI
locationURI
=
getLocationURI
(
guids
);
return
Response
.
created
(
locationURI
).
entity
(
response
).
build
();
return
Response
.
created
(
locationURI
).
entity
(
response
).
build
();
...
@@ -215,28 +214,32 @@ public class EntityResource {
...
@@ -215,28 +214,32 @@ public class EntityResource {
return
locationURI
;
return
locationURI
;
}
}
private
ObjectNode
getResponse
(
EntityResult
entityResult
)
throws
AtlasBaseException
,
AtlasException
{
private
String
getResponse
(
EntityResult
entityResult
)
throws
AtlasBaseException
,
AtlasException
{
CreateUpdateEntitiesResult
result
=
new
CreateUpdateEntitiesResult
();
CreateUpdateEntitiesResult
result
=
new
CreateUpdateEntitiesResult
();
result
.
setEntityResult
(
entityResult
);
result
.
setEntityResult
(
entityResult
);
return
getResponse
(
result
);
return
getResponse
(
result
);
}
}
private
ObjectNode
getResponse
(
CreateUpdateEntitiesResult
result
)
throws
AtlasBaseException
,
AtlasException
{
private
String
getResponse
(
CreateUpdateEntitiesResult
result
)
throws
AtlasBaseException
,
AtlasException
{
ObjectNode
response
=
AtlasJson
.
createV1ObjectNode
();
Map
<
String
,
Object
>
response
=
new
HashMap
<>();
EntityResult
entityResult
=
result
.
getEntityResult
();
EntityResult
entityResult
=
result
.
getEntityResult
();
GuidMapping
mapping
=
result
.
getGuidMapping
();
GuidMapping
mapping
=
result
.
getGuidMapping
();
response
.
putPOJO
(
AtlasClient
.
REQUEST_ID
,
Servlets
.
getRequestId
());
response
.
put
(
AtlasClient
.
REQUEST_ID
,
Servlets
.
getRequestId
());
if
(
entityResult
!=
null
)
{
if
(
entityResult
!=
null
)
{
response
.
putPOJO
(
AtlasClient
.
ENTITIES
,
entityResult
.
getEntities
());
response
.
put
(
AtlasClient
.
ENTITIES
,
entityResult
.
getEntities
());
String
sampleEntityId
=
getSample
(
result
.
getEntityResult
());
String
sampleEntityId
=
getSample
(
result
.
getEntityResult
());
if
(
sampleEntityId
!=
null
)
{
if
(
sampleEntityId
!=
null
)
{
response
.
put
POJO
(
AtlasClient
.
DEFINITION
,
getEntity
(
sampleEntityId
));
response
.
put
(
AtlasClient
.
DEFINITION
,
getEntity
(
sampleEntityId
));
}
}
}
}
if
(
mapping
!=
null
)
{
if
(
mapping
!=
null
)
{
response
.
put
POJO
(
AtlasClient
.
GUID_ASSIGNMENTS
,
mapping
);
response
.
put
(
AtlasClient
.
GUID_ASSIGNMENTS
,
mapping
);
}
}
return
response
;
return
AtlasJson
.
toV1Json
(
response
)
;
}
}
/**
/**
...
@@ -284,7 +287,7 @@ public class EntityResource {
...
@@ -284,7 +287,7 @@ public class EntityResource {
LOG
.
debug
(
"Updated entities: {}"
,
result
.
getEntityResult
());
LOG
.
debug
(
"Updated entities: {}"
,
result
.
getEntityResult
());
}
}
ObjectNode
response
=
getResponse
(
result
);
String
response
=
getResponse
(
result
);
return
Response
.
ok
(
response
).
build
();
return
Response
.
ok
(
response
).
build
();
}
catch
(
AtlasBaseException
e
)
{
}
catch
(
AtlasBaseException
e
)
{
LOG
.
error
(
"Unable to persist entity instance entityDef={}"
,
entityJson
,
e
);
LOG
.
error
(
"Unable to persist entity instance entityDef={}"
,
entityJson
,
e
);
...
@@ -386,7 +389,7 @@ public class EntityResource {
...
@@ -386,7 +389,7 @@ public class EntityResource {
LOG
.
debug
(
"Updated entities: {}"
,
result
.
getEntityResult
());
LOG
.
debug
(
"Updated entities: {}"
,
result
.
getEntityResult
());
}
}
ObjectNode
response
=
getResponse
(
result
);
String
response
=
getResponse
(
result
);
return
Response
.
ok
(
response
).
build
();
return
Response
.
ok
(
response
).
build
();
}
catch
(
AtlasBaseException
e
)
{
}
catch
(
AtlasBaseException
e
)
{
LOG
.
error
(
"Unable to partially update entity {} {}:{}.{}"
,
entityJson
,
entityType
,
attribute
,
value
,
e
);
LOG
.
error
(
"Unable to partially update entity {} {}:{}.{}"
,
entityJson
,
entityType
,
attribute
,
value
,
e
);
...
@@ -475,7 +478,7 @@ public class EntityResource {
...
@@ -475,7 +478,7 @@ public class EntityResource {
LOG
.
debug
(
"Updated entities: {}"
,
result
.
getEntityResult
());
LOG
.
debug
(
"Updated entities: {}"
,
result
.
getEntityResult
());
}
}
ObjectNode
response
=
getResponse
(
result
);
String
response
=
getResponse
(
result
);
return
Response
.
ok
(
response
).
build
();
return
Response
.
ok
(
response
).
build
();
}
catch
(
AtlasBaseException
e
)
{
}
catch
(
AtlasBaseException
e
)
{
LOG
.
error
(
"Unable to update entity by GUID {} {} "
,
guid
,
entityJson
,
e
);
LOG
.
error
(
"Unable to update entity by GUID {} {} "
,
guid
,
entityJson
,
e
);
...
@@ -520,7 +523,7 @@ public class EntityResource {
...
@@ -520,7 +523,7 @@ public class EntityResource {
LOG
.
debug
(
"Updated entities: {}"
,
result
.
getEntityResult
());
LOG
.
debug
(
"Updated entities: {}"
,
result
.
getEntityResult
());
}
}
ObjectNode
response
=
getResponse
(
result
);
String
response
=
getResponse
(
result
);
return
Response
.
ok
(
response
).
build
();
return
Response
.
ok
(
response
).
build
();
}
catch
(
AtlasBaseException
e
)
{
}
catch
(
AtlasBaseException
e
)
{
LOG
.
error
(
"Unable to add property {} to entity id {} {} "
,
property
,
guid
,
value
,
e
);
LOG
.
error
(
"Unable to add property {} to entity id {} {} "
,
property
,
guid
,
value
,
e
);
...
@@ -590,7 +593,7 @@ public class EntityResource {
...
@@ -590,7 +593,7 @@ public class EntityResource {
LOG
.
debug
(
"Deleted entity result: {}"
,
entityResult
);
LOG
.
debug
(
"Deleted entity result: {}"
,
entityResult
);
}
}
ObjectNode
response
=
getResponse
(
entityResult
);
String
response
=
getResponse
(
entityResult
);
return
Response
.
ok
(
response
).
build
();
return
Response
.
ok
(
response
).
build
();
}
catch
(
AtlasBaseException
e
)
{
}
catch
(
AtlasBaseException
e
)
{
LOG
.
error
(
"Unable to delete entities {} {} {} {} "
,
guids
,
entityType
,
attribute
,
value
,
e
);
LOG
.
error
(
"Unable to delete entities {} {} {} {} "
,
guids
,
entityType
,
attribute
,
value
,
e
);
...
@@ -640,18 +643,20 @@ public class EntityResource {
...
@@ -640,18 +643,20 @@ public class EntityResource {
Referenceable
entity
=
getEntity
(
guid
);
Referenceable
entity
=
getEntity
(
guid
);
ObjectNode
response
=
AtlasJson
.
createV1ObjectNode
(
AtlasClient
.
REQUEST_ID
,
Servlets
.
getRequestId
());
Map
<
String
,
Object
>
response
=
new
HashMap
<>();
response
.
put
(
AtlasClient
.
REQUEST_ID
,
Servlets
.
getRequestId
());
Response
.
Status
status
=
Response
.
Status
.
NOT_FOUND
;
Response
.
Status
status
=
Response
.
Status
.
NOT_FOUND
;
if
(
entity
!=
null
)
{
if
(
entity
!=
null
)
{
response
.
put
POJO
(
AtlasClient
.
DEFINITION
,
entity
);
response
.
put
(
AtlasClient
.
DEFINITION
,
entity
);
status
=
Response
.
Status
.
OK
;
status
=
Response
.
Status
.
OK
;
}
else
{
}
else
{
response
.
put
(
AtlasClient
.
ERROR
,
response
.
put
(
AtlasClient
.
ERROR
,
Servlets
.
escapeJsonString
(
String
.
format
(
"An entity with GUID={%s} does not exist"
,
guid
)));
Servlets
.
escapeJsonString
(
String
.
format
(
"An entity with GUID={%s} does not exist"
,
guid
)));
}
}
return
Response
.
status
(
status
).
entity
(
response
).
build
();
return
Response
.
status
(
status
).
entity
(
AtlasJson
.
toV1Json
(
response
)
).
build
();
}
catch
(
IllegalArgumentException
e
)
{
}
catch
(
IllegalArgumentException
e
)
{
LOG
.
error
(
"Bad GUID={} "
,
guid
,
e
);
LOG
.
error
(
"Bad GUID={} "
,
guid
,
e
);
throw
new
WebApplicationException
(
Servlets
.
getErrorResponse
(
e
,
Response
.
Status
.
BAD_REQUEST
));
throw
new
WebApplicationException
(
Servlets
.
getErrorResponse
(
e
,
Response
.
Status
.
BAD_REQUEST
));
...
@@ -688,13 +693,13 @@ public class EntityResource {
...
@@ -688,13 +693,13 @@ public class EntityResource {
List
<
String
>
entityGUIDS
=
entitiesStore
.
getEntityGUIDS
(
entityType
);
List
<
String
>
entityGUIDS
=
entitiesStore
.
getEntityGUIDS
(
entityType
);
ObjectNode
response
=
AtlasJson
.
createV1ObjectNode
();
Map
<
String
,
Object
>
response
=
new
HashMap
<>
();
response
.
put
(
AtlasClient
.
REQUEST_ID
,
Servlets
.
getRequestId
());
response
.
put
(
AtlasClient
.
REQUEST_ID
,
Servlets
.
getRequestId
());
response
.
put
(
AtlasClient
.
TYPENAME
,
entityType
);
response
.
put
(
AtlasClient
.
TYPENAME
,
entityType
);
response
.
put
POJO
(
AtlasClient
.
RESULTS
,
entityGUIDS
);
response
.
put
(
AtlasClient
.
RESULTS
,
entityGUIDS
);
response
.
put
(
AtlasClient
.
COUNT
,
entityGUIDS
.
size
());
response
.
put
(
AtlasClient
.
COUNT
,
entityGUIDS
.
size
());
return
Response
.
ok
(
response
).
build
();
return
Response
.
ok
(
AtlasJson
.
toV1Json
(
response
)
).
build
();
}
catch
(
NullPointerException
e
)
{
}
catch
(
NullPointerException
e
)
{
LOG
.
error
(
"Entity type cannot be null"
,
e
);
LOG
.
error
(
"Entity type cannot be null"
,
e
);
throw
new
WebApplicationException
(
Servlets
.
getErrorResponse
(
e
,
Response
.
Status
.
BAD_REQUEST
));
throw
new
WebApplicationException
(
Servlets
.
getErrorResponse
(
e
,
Response
.
Status
.
BAD_REQUEST
));
...
@@ -780,19 +785,20 @@ public class EntityResource {
...
@@ -780,19 +785,20 @@ public class EntityResource {
entity
=
restAdapters
.
getReferenceable
(
entityInfo
);
entity
=
restAdapters
.
getReferenceable
(
entityInfo
);
}
}
ObjectNode
response
=
AtlasJson
.
createV1ObjectNode
(
AtlasClient
.
REQUEST_ID
,
Servlets
.
getRequestId
());
Map
<
String
,
Object
>
response
=
new
HashMap
<>();
response
.
put
(
AtlasClient
.
REQUEST_ID
,
Servlets
.
getRequestId
());
Response
.
Status
status
=
Response
.
Status
.
NOT_FOUND
;
Response
.
Status
status
=
Response
.
Status
.
NOT_FOUND
;
if
(
entity
!=
null
)
{
if
(
entity
!=
null
)
{
response
.
put
POJO
(
AtlasClient
.
DEFINITION
,
entity
);
response
.
put
(
AtlasClient
.
DEFINITION
,
entity
);
status
=
Response
.
Status
.
OK
;
status
=
Response
.
Status
.
OK
;
}
else
{
}
else
{
response
.
put
(
AtlasClient
.
ERROR
,
Servlets
.
escapeJsonString
(
String
.
format
(
"An entity with type={%s}, "
+
response
.
put
(
AtlasClient
.
ERROR
,
Servlets
.
escapeJsonString
(
String
.
format
(
"An entity with type={%s}, "
+
"qualifiedName={%s} does not exist"
,
entityType
,
value
)));
"qualifiedName={%s} does not exist"
,
entityType
,
value
)));
}
}
return
Response
.
status
(
status
).
entity
(
response
).
build
();
return
Response
.
status
(
status
).
entity
(
AtlasJson
.
toV1Json
(
response
)).
build
();
}
catch
(
AtlasBaseException
e
)
{
}
catch
(
AtlasBaseException
e
)
{
LOG
.
error
(
"Unable to get instance definition for type={}, qualifiedName={}"
,
entityType
,
value
,
e
);
LOG
.
error
(
"Unable to get instance definition for type={}, qualifiedName={}"
,
entityType
,
value
,
e
);
throw
toWebApplicationException
(
e
);
throw
toWebApplicationException
(
e
);
...
@@ -842,12 +848,12 @@ public class EntityResource {
...
@@ -842,12 +848,12 @@ public class EntityResource {
traitNames
.
add
(
classification
.
getTypeName
());
traitNames
.
add
(
classification
.
getTypeName
());
}
}
ObjectNode
response
=
AtlasJson
.
createV1ObjectNode
();
Map
<
String
,
Object
>
response
=
new
HashMap
<>
();
response
.
put
(
AtlasClient
.
REQUEST_ID
,
Servlets
.
getRequestId
());
response
.
put
(
AtlasClient
.
REQUEST_ID
,
Servlets
.
getRequestId
());
response
.
put
POJO
(
AtlasClient
.
RESULTS
,
traitNames
);
response
.
put
(
AtlasClient
.
RESULTS
,
traitNames
);
response
.
put
(
AtlasClient
.
COUNT
,
traitNames
.
size
());
response
.
put
(
AtlasClient
.
COUNT
,
traitNames
.
size
());
return
Response
.
ok
(
response
).
build
();
return
Response
.
ok
(
AtlasJson
.
toV1Json
(
response
)
).
build
();
}
catch
(
AtlasBaseException
e
)
{
}
catch
(
AtlasBaseException
e
)
{
LOG
.
error
(
"Unable to get trait definition for entity {}"
,
guid
,
e
);
LOG
.
error
(
"Unable to get trait definition for entity {}"
,
guid
,
e
);
throw
toWebApplicationException
(
e
);
throw
toWebApplicationException
(
e
);
...
@@ -893,18 +899,18 @@ public class EntityResource {
...
@@ -893,18 +899,18 @@ public class EntityResource {
final
List
<
AtlasClassification
>
classifications
=
entitiesStore
.
getClassifications
(
guid
);
final
List
<
AtlasClassification
>
classifications
=
entitiesStore
.
getClassifications
(
guid
);
ArrayNode
traits
=
AtlasJson
.
createV1ArrayNode
(
);
List
<
Struct
>
traits
=
new
ArrayList
<>(
classifications
.
size
()
);
for
(
AtlasClassification
classification
:
classifications
)
{
for
(
AtlasClassification
classification
:
classifications
)
{
Struct
trait
=
restAdapters
.
getTrait
(
classification
);
Struct
trait
=
restAdapters
.
getTrait
(
classification
);
traits
.
add
POJO
(
trait
);
traits
.
add
(
trait
);
}
}
ObjectNode
response
=
AtlasJson
.
createV1ObjectNode
();
Map
<
String
,
Object
>
response
=
new
HashMap
<>
();
response
.
put
(
AtlasClient
.
REQUEST_ID
,
Servlets
.
getRequestId
());
response
.
put
(
AtlasClient
.
REQUEST_ID
,
Servlets
.
getRequestId
());
response
.
put
(
AtlasClient
.
RESULTS
,
traits
);
response
.
put
(
AtlasClient
.
RESULTS
,
traits
);
response
.
put
(
AtlasClient
.
COUNT
,
traits
.
size
());
response
.
put
(
AtlasClient
.
COUNT
,
traits
.
size
());
return
Response
.
ok
(
response
).
build
();
return
Response
.
ok
(
AtlasJson
.
toV1Json
(
response
)
).
build
();
}
catch
(
AtlasBaseException
e
)
{
}
catch
(
AtlasBaseException
e
)
{
LOG
.
error
(
"Unable to get trait definition for entity {}"
,
guid
,
e
);
LOG
.
error
(
"Unable to get trait definition for entity {}"
,
guid
,
e
);
throw
toWebApplicationException
(
e
);
throw
toWebApplicationException
(
e
);
...
@@ -955,11 +961,11 @@ public class EntityResource {
...
@@ -955,11 +961,11 @@ public class EntityResource {
Struct
traitDefinition
=
restAdapters
.
getTrait
(
classification
);
Struct
traitDefinition
=
restAdapters
.
getTrait
(
classification
);
ObjectNode
response
=
AtlasJson
.
createV1ObjectNode
();
Map
<
String
,
Object
>
response
=
new
HashMap
<>
();
response
.
put
(
AtlasClient
.
REQUEST_ID
,
Servlets
.
getRequestId
());
response
.
put
(
AtlasClient
.
REQUEST_ID
,
Servlets
.
getRequestId
());
response
.
put
POJO
(
AtlasClient
.
RESULTS
,
traitDefinition
);
response
.
put
(
AtlasClient
.
RESULTS
,
traitDefinition
);
return
Response
.
ok
(
response
).
build
();
return
Response
.
ok
(
AtlasJson
.
toV1Json
(
response
)
).
build
();
}
catch
(
AtlasBaseException
e
)
{
}
catch
(
AtlasBaseException
e
)
{
LOG
.
error
(
"Unable to get trait definition for entity {} and trait {}"
,
guid
,
traitName
,
e
);
LOG
.
error
(
"Unable to get trait definition for entity {} and trait {}"
,
guid
,
traitName
,
e
);
...
@@ -1019,9 +1025,10 @@ public class EntityResource {
...
@@ -1019,9 +1025,10 @@ public class EntityResource {
add
(
guid
);
add
(
guid
);
}});
}});
ObjectNode
response
=
AtlasJson
.
createV1ObjectNode
(
AtlasClient
.
REQUEST_ID
,
Servlets
.
getRequestId
());
Map
<
String
,
Object
>
response
=
new
HashMap
<>();
response
.
put
(
AtlasClient
.
REQUEST_ID
,
Servlets
.
getRequestId
());
return
Response
.
created
(
locationURI
).
entity
(
response
).
build
();
return
Response
.
created
(
locationURI
).
entity
(
AtlasJson
.
toV1Json
(
response
)
).
build
();
}
catch
(
AtlasBaseException
e
)
{
}
catch
(
AtlasBaseException
e
)
{
LOG
.
error
(
"Unable to add trait for entity={} traitDef={}"
,
guid
,
traitDefinition
,
e
);
LOG
.
error
(
"Unable to add trait for entity={} traitDef={}"
,
guid
,
traitDefinition
,
e
);
throw
toWebApplicationException
(
e
);
throw
toWebApplicationException
(
e
);
...
@@ -1072,11 +1079,11 @@ public class EntityResource {
...
@@ -1072,11 +1079,11 @@ public class EntityResource {
entitiesStore
.
deleteClassifications
(
guid
,
new
ArrayList
<
String
>()
{{
add
(
traitName
);
}});
entitiesStore
.
deleteClassifications
(
guid
,
new
ArrayList
<
String
>()
{{
add
(
traitName
);
}});
ObjectNode
response
=
AtlasJson
.
createV1ObjectNode
();
Map
<
String
,
Object
>
response
=
new
HashMap
<>
();
response
.
put
(
AtlasClient
.
REQUEST_ID
,
Servlets
.
getRequestId
());
response
.
put
(
AtlasClient
.
REQUEST_ID
,
Servlets
.
getRequestId
());
response
.
put
(
TRAIT_NAME
,
traitName
);
response
.
put
(
TRAIT_NAME
,
traitName
);
return
Response
.
ok
(
response
).
build
();
return
Response
.
ok
(
AtlasJson
.
toV1Json
(
response
)
).
build
();
}
catch
(
AtlasBaseException
e
)
{
}
catch
(
AtlasBaseException
e
)
{
LOG
.
error
(
"Unable to delete trait name={} for entity={}"
,
traitName
,
guid
,
e
);
LOG
.
error
(
"Unable to delete trait name={} for entity={}"
,
traitName
,
guid
,
e
);
throw
toWebApplicationException
(
e
);
throw
toWebApplicationException
(
e
);
...
@@ -1130,10 +1137,10 @@ public class EntityResource {
...
@@ -1130,10 +1137,10 @@ public class EntityResource {
List
<
EntityAuditEvent
>
events
=
entityAuditRepository
.
listEvents
(
guid
,
startKey
,
count
);
List
<
EntityAuditEvent
>
events
=
entityAuditRepository
.
listEvents
(
guid
,
startKey
,
count
);
ObjectNode
response
=
AtlasJson
.
createV1ObjectNode
();
Map
<
String
,
Object
>
response
=
new
HashMap
<>
();
response
.
put
(
AtlasClient
.
REQUEST_ID
,
Servlets
.
getRequestId
());
response
.
put
(
AtlasClient
.
REQUEST_ID
,
Servlets
.
getRequestId
());
response
.
put
POJO
(
AtlasClient
.
EVENTS
,
events
);
response
.
put
(
AtlasClient
.
EVENTS
,
events
);
return
Response
.
ok
(
response
).
build
();
return
Response
.
ok
(
AtlasJson
.
toV1Json
(
response
)
).
build
();
}
catch
(
IllegalArgumentException
e
)
{
}
catch
(
IllegalArgumentException
e
)
{
LOG
.
error
(
"Unable to get audit events for entity guid={} startKey={}"
,
guid
,
startKey
,
e
);
LOG
.
error
(
"Unable to get audit events for entity guid={} startKey={}"
,
guid
,
startKey
,
e
);
throw
new
WebApplicationException
(
Servlets
.
getErrorResponse
(
e
,
Response
.
Status
.
BAD_REQUEST
));
throw
new
WebApplicationException
(
Servlets
.
getErrorResponse
(
e
,
Response
.
Status
.
BAD_REQUEST
));
...
...
webapp/src/main/java/org/apache/atlas/web/resources/TypesResource.java
View file @
8535e88c
...
@@ -18,8 +18,6 @@
...
@@ -18,8 +18,6 @@
package
org
.
apache
.
atlas
.
web
.
resources
;
package
org
.
apache
.
atlas
.
web
.
resources
;
import
com.fasterxml.jackson.databind.node.ArrayNode
;
import
com.fasterxml.jackson.databind.node.ObjectNode
;
import
com.sun.jersey.api.client.ClientResponse
;
import
com.sun.jersey.api.client.ClientResponse
;
import
com.sun.jersey.api.core.ResourceContext
;
import
com.sun.jersey.api.core.ResourceContext
;
import
org.apache.atlas.AtlasClient
;
import
org.apache.atlas.AtlasClient
;
...
@@ -52,7 +50,11 @@ import javax.ws.rs.WebApplicationException;
...
@@ -52,7 +50,11 @@ import javax.ws.rs.WebApplicationException;
import
javax.ws.rs.core.Context
;
import
javax.ws.rs.core.Context
;
import
javax.ws.rs.core.MediaType
;
import
javax.ws.rs.core.MediaType
;
import
javax.ws.rs.core.Response
;
import
javax.ws.rs.core.Response
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
/**
/**
* This class provides RESTful API for Types.
* This class provides RESTful API for Types.
...
@@ -101,8 +103,6 @@ public class TypesResource {
...
@@ -101,8 +103,6 @@ public class TypesResource {
perf
=
AtlasPerfTracer
.
getPerfTracer
(
PERF_LOG
,
"TypesResource.submit()"
);
perf
=
AtlasPerfTracer
.
getPerfTracer
(
PERF_LOG
,
"TypesResource.submit()"
);
}
}
ArrayNode
typesResponse
=
AtlasJson
.
createV1ArrayNode
();
try
{
try
{
final
String
typeDefinition
=
Servlets
.
getRequestPayload
(
request
);
final
String
typeDefinition
=
Servlets
.
getRequestPayload
(
request
);
...
@@ -113,17 +113,16 @@ public class TypesResource {
...
@@ -113,17 +113,16 @@ public class TypesResource {
AtlasTypesDef
createTypesDef
=
TypeConverterUtil
.
toAtlasTypesDef
(
typeDefinition
,
typeRegistry
);
AtlasTypesDef
createTypesDef
=
TypeConverterUtil
.
toAtlasTypesDef
(
typeDefinition
,
typeRegistry
);
AtlasTypesDef
createdTypesDef
=
typesREST
.
createAtlasTypeDefs
(
createTypesDef
);
AtlasTypesDef
createdTypesDef
=
typesREST
.
createAtlasTypeDefs
(
createTypesDef
);
List
<
String
>
typeNames
=
TypeConverterUtil
.
getTypeNames
(
createdTypesDef
);
List
<
String
>
typeNames
=
TypeConverterUtil
.
getTypeNames
(
createdTypesDef
);
List
<
Map
<
String
,
Object
>>
typesResponse
=
new
ArrayList
<>(
typeNames
.
size
());
for
(
int
i
=
0
;
i
<
typeNames
.
size
();
i
++)
{
for
(
String
typeName
:
typeNames
)
{
ObjectNode
typeNode
=
AtlasJson
.
createV1ObjectNode
(
AtlasClient
.
NAME
,
typeNames
.
get
(
i
));
typesResponse
.
add
(
Collections
.
singletonMap
(
AtlasClient
.
NAME
,
typeName
));
typesResponse
.
add
(
typeNode
);
}
}
ObjectNode
response
=
AtlasJson
.
createV1ObjectNode
();
Map
<
String
,
Object
>
response
=
new
HashMap
<>
();
response
.
put
(
AtlasClient
.
REQUEST_ID
,
Servlets
.
getRequestId
());
response
.
put
(
AtlasClient
.
REQUEST_ID
,
Servlets
.
getRequestId
());
response
.
put
(
AtlasClient
.
TYPES
,
typesResponse
);
response
.
put
(
AtlasClient
.
TYPES
,
typesResponse
);
return
Response
.
status
(
ClientResponse
.
Status
.
CREATED
).
entity
(
response
).
build
();
return
Response
.
status
(
ClientResponse
.
Status
.
CREATED
).
entity
(
AtlasJson
.
toV1Json
(
response
)
).
build
();
}
catch
(
AtlasBaseException
e
)
{
}
catch
(
AtlasBaseException
e
)
{
LOG
.
error
(
"Type creation failed"
,
e
);
LOG
.
error
(
"Type creation failed"
,
e
);
throw
new
WebApplicationException
(
Servlets
.
getErrorResponse
(
e
));
throw
new
WebApplicationException
(
Servlets
.
getErrorResponse
(
e
));
...
@@ -168,7 +167,6 @@ public class TypesResource {
...
@@ -168,7 +167,6 @@ public class TypesResource {
perf
=
AtlasPerfTracer
.
getPerfTracer
(
PERF_LOG
,
"TypesResource.update()"
);
perf
=
AtlasPerfTracer
.
getPerfTracer
(
PERF_LOG
,
"TypesResource.update()"
);
}
}
ArrayNode
typesResponse
=
AtlasJson
.
createV1ArrayNode
();
try
{
try
{
final
String
typeDefinition
=
Servlets
.
getRequestPayload
(
request
);
final
String
typeDefinition
=
Servlets
.
getRequestPayload
(
request
);
...
@@ -179,17 +177,16 @@ public class TypesResource {
...
@@ -179,17 +177,16 @@ public class TypesResource {
AtlasTypesDef
updateTypesDef
=
TypeConverterUtil
.
toAtlasTypesDef
(
typeDefinition
,
typeRegistry
);
AtlasTypesDef
updateTypesDef
=
TypeConverterUtil
.
toAtlasTypesDef
(
typeDefinition
,
typeRegistry
);
AtlasTypesDef
updatedTypesDef
=
typeDefStore
.
createUpdateTypesDef
(
updateTypesDef
);
AtlasTypesDef
updatedTypesDef
=
typeDefStore
.
createUpdateTypesDef
(
updateTypesDef
);
List
<
String
>
typeNames
=
TypeConverterUtil
.
getTypeNames
(
updatedTypesDef
);
List
<
String
>
typeNames
=
TypeConverterUtil
.
getTypeNames
(
updatedTypesDef
);
List
<
Map
<
String
,
Object
>>
typesResponse
=
new
ArrayList
<>(
typeNames
.
size
());
for
(
int
i
=
0
;
i
<
typeNames
.
size
();
i
++)
{
for
(
String
typeName
:
typeNames
)
{
ObjectNode
typeNode
=
AtlasJson
.
createV1ObjectNode
(
AtlasClient
.
NAME
,
typeNames
.
get
(
i
));
typesResponse
.
add
(
Collections
.
singletonMap
(
AtlasClient
.
NAME
,
typeName
));
typesResponse
.
add
(
typeNode
);
}
}
ObjectNode
response
=
AtlasJson
.
createV1ObjectNode
();
Map
<
String
,
Object
>
response
=
new
HashMap
<>
();
response
.
put
(
AtlasClient
.
REQUEST_ID
,
Servlets
.
getRequestId
());
response
.
put
(
AtlasClient
.
REQUEST_ID
,
Servlets
.
getRequestId
());
response
.
put
(
AtlasClient
.
TYPES
,
typesResponse
);
response
.
put
(
AtlasClient
.
TYPES
,
typesResponse
);
return
Response
.
ok
().
entity
(
response
).
build
();
return
Response
.
ok
().
entity
(
AtlasJson
.
toV1Json
(
response
)
).
build
();
}
catch
(
AtlasBaseException
e
)
{
}
catch
(
AtlasBaseException
e
)
{
LOG
.
error
(
"Unable to persist types"
,
e
);
LOG
.
error
(
"Unable to persist types"
,
e
);
throw
new
WebApplicationException
(
Servlets
.
getErrorResponse
(
e
));
throw
new
WebApplicationException
(
Servlets
.
getErrorResponse
(
e
));
...
@@ -230,16 +227,16 @@ public class TypesResource {
...
@@ -230,16 +227,16 @@ public class TypesResource {
perf
=
AtlasPerfTracer
.
getPerfTracer
(
PERF_LOG
,
"TypesResource.getDefinition("
+
typeName
+
")"
);
perf
=
AtlasPerfTracer
.
getPerfTracer
(
PERF_LOG
,
"TypesResource.getDefinition("
+
typeName
+
")"
);
}
}
ObjectNode
response
=
AtlasJson
.
createV1ObjectNode
();
Map
<
String
,
Object
>
response
=
new
HashMap
<>
();
try
{
try
{
TypesDef
typesDef
=
TypeConverterUtil
.
toTypesDef
(
typeRegistry
.
getType
(
typeName
),
typeRegistry
);;
TypesDef
typesDef
=
TypeConverterUtil
.
toTypesDef
(
typeRegistry
.
getType
(
typeName
),
typeRegistry
);;
response
.
put
(
AtlasClient
.
TYPENAME
,
typeName
);
response
.
put
(
AtlasClient
.
TYPENAME
,
typeName
);
response
.
put
POJO
(
AtlasClient
.
DEFINITION
,
typesDef
);
response
.
put
(
AtlasClient
.
DEFINITION
,
typesDef
);
response
.
put
(
AtlasClient
.
REQUEST_ID
,
Servlets
.
getRequestId
());
response
.
put
(
AtlasClient
.
REQUEST_ID
,
Servlets
.
getRequestId
());
return
Response
.
ok
(
response
).
build
();
return
Response
.
ok
(
AtlasJson
.
toV1Json
(
response
)
).
build
();
}
catch
(
AtlasBaseException
e
)
{
}
catch
(
AtlasBaseException
e
)
{
LOG
.
error
(
"Unable to get type definition for type {}"
,
typeName
,
e
);
LOG
.
error
(
"Unable to get type definition for type {}"
,
typeName
,
e
);
throw
new
WebApplicationException
(
Servlets
.
getErrorResponse
(
e
));
throw
new
WebApplicationException
(
Servlets
.
getErrorResponse
(
e
));
...
@@ -288,15 +285,15 @@ public class TypesResource {
...
@@ -288,15 +285,15 @@ public class TypesResource {
perf
=
AtlasPerfTracer
.
getPerfTracer
(
PERF_LOG
,
"TypesResource.getTypesByFilter("
+
typeCategory
+
", "
+
supertype
+
", "
+
notsupertype
+
")"
);
perf
=
AtlasPerfTracer
.
getPerfTracer
(
PERF_LOG
,
"TypesResource.getTypesByFilter("
+
typeCategory
+
", "
+
supertype
+
", "
+
notsupertype
+
")"
);
}
}
ObjectNode
response
=
AtlasJson
.
createV1ObjectNode
();
Map
<
String
,
Object
>
response
=
new
HashMap
<>
();
try
{
try
{
List
<
String
>
result
=
TypeConverterUtil
.
getTypeNames
(
typesREST
.
getTypeDefHeaders
(
request
));
List
<
String
>
result
=
TypeConverterUtil
.
getTypeNames
(
typesREST
.
getTypeDefHeaders
(
request
));
response
.
put
POJO
(
AtlasClient
.
RESULTS
,
result
);
response
.
put
(
AtlasClient
.
RESULTS
,
result
);
response
.
put
(
AtlasClient
.
COUNT
,
result
.
size
());
response
.
put
(
AtlasClient
.
COUNT
,
result
.
size
());
response
.
put
(
AtlasClient
.
REQUEST_ID
,
Servlets
.
getRequestId
());
response
.
put
(
AtlasClient
.
REQUEST_ID
,
Servlets
.
getRequestId
());
return
Response
.
ok
(
response
).
build
();
return
Response
.
ok
(
AtlasJson
.
toV1Json
(
response
)
).
build
();
}
catch
(
AtlasBaseException
e
)
{
}
catch
(
AtlasBaseException
e
)
{
LOG
.
warn
(
"TypesREST exception: {} {}"
,
e
.
getClass
().
getSimpleName
(),
e
.
getMessage
());
LOG
.
warn
(
"TypesREST exception: {} {}"
,
e
.
getClass
().
getSimpleName
(),
e
.
getMessage
());
throw
new
WebApplicationException
(
Servlets
.
getErrorResponse
(
e
));
throw
new
WebApplicationException
(
Servlets
.
getErrorResponse
(
e
));
...
...
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