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
df9f5d27
Commit
df9f5d27
authored
Jan 07, 2018
by
Madhan Neethiraj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-2327: updated V1 to V2 conversion with addition of validation of attribute values
parent
08ac11c0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
6 deletions
+11
-6
AtlasStructFormatConverter.java
...las/repository/converters/AtlasStructFormatConverter.java
+7
-2
EntityResource.java
...n/java/org/apache/atlas/web/resources/EntityResource.java
+4
-4
No files found.
repository/src/main/java/org/apache/atlas/repository/converters/AtlasStructFormatConverter.java
View file @
df9f5d27
...
...
@@ -246,10 +246,15 @@ public class AtlasStructFormatConverter extends AtlasAbstractFormatConverter {
AtlasType
attrType
=
attr
.
getAttributeType
();
AtlasFormatConverter
attrConverter
=
converterRegistry
.
getConverter
(
attrType
.
getTypeCategory
());
Object
v1Value
=
attributes
.
get
(
attr
.
getName
());
Object
v1Value
=
attributes
.
get
(
attrName
);
if
(
attrType
.
isValidValue
(
v1Value
))
{
Object
v2Value
=
attrConverter
.
fromV1ToV2
(
v1Value
,
attrType
,
context
);
ret
.
put
(
attr
.
getAttributeDef
().
getName
(),
v2Value
);
ret
.
put
(
attrName
,
v2Value
);
}
else
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
INSTANCE_CRUD_INVALID_PARAMS
,
attrName
+
"="
+
v1Value
);
}
}
}
...
...
webapp/src/main/java/org/apache/atlas/web/resources/EntityResource.java
View file @
df9f5d27
...
...
@@ -138,13 +138,13 @@ public class EntityResource {
perf
=
AtlasPerfTracer
.
getPerfTracer
(
PERF_LOG
,
"EntityResource.submit()"
);
}
String
entities
=
Servlets
.
getRequestPayload
(
request
);
entityJson
=
Servlets
.
getRequestPayload
(
request
);
//Handle backward compatibility - if entities is not JSONArray, convert to JSONArray
String
[]
jsonStrings
;
try
{
ArrayNode
jsonEntities
=
AtlasJson
.
parseToV1ArrayNode
(
entit
ies
);
ArrayNode
jsonEntities
=
AtlasJson
.
parseToV1ArrayNode
(
entit
yJson
);
jsonStrings
=
new
String
[
jsonEntities
.
size
()];
...
...
@@ -154,11 +154,11 @@ public class EntityResource {
}
catch
(
IOException
e
)
{
jsonStrings
=
new
String
[
1
];
jsonStrings
[
0
]
=
entit
ies
;
jsonStrings
[
0
]
=
entit
yJson
;
}
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"submitting entities: count={}; entities-json={}"
,
jsonStrings
.
length
,
entit
ies
);
LOG
.
debug
(
"submitting entities: count={}; entities-json={}"
,
jsonStrings
.
length
,
entit
yJson
);
}
AtlasEntitiesWithExtInfo
entitiesInfo
=
restAdapters
.
toAtlasEntities
(
jsonStrings
);
...
...
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