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
ce5ffeb7
Commit
ce5ffeb7
authored
6 years ago
by
Graham Wallis
Committed by
David Radley
6 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-2745 - AtlasEnumDefStore should remember default value
Signed-off-by:
David Radley
<
david_radley@uk.ibm.com
>
parent
7174257b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
17 deletions
+25
-17
AtlasEnumDefStoreV2.java
.../atlas/repository/store/graph/v2/AtlasEnumDefStoreV2.java
+25
-17
No files found.
repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasEnumDefStoreV2.java
View file @
ce5ffeb7
...
...
@@ -37,7 +37,7 @@ import java.util.Iterator;
import
java.util.List
;
/**
* EnumDef store in v
1
format.
* EnumDef store in v
2
format.
*/
class
AtlasEnumDefStoreV2
extends
AtlasAbstractDefStoreV2
<
AtlasEnumDef
>
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
AtlasEnumDefStoreV2
.
class
);
...
...
@@ -49,7 +49,7 @@ class AtlasEnumDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasEnumDef> {
@Override
public
AtlasVertex
preCreate
(
AtlasEnumDef
enumDef
)
throws
AtlasBaseException
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> AtlasEnumDefStoreV
1
.preCreate({})"
,
enumDef
);
LOG
.
debug
(
"==> AtlasEnumDefStoreV
2
.preCreate({})"
,
enumDef
);
}
validateType
(
enumDef
);
...
...
@@ -65,7 +65,7 @@ class AtlasEnumDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasEnumDef> {
toVertex
(
enumDef
,
vertex
);
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"<== AtlasEnumDefStoreV
1
.preCreate({}): {}"
,
enumDef
,
vertex
);
LOG
.
debug
(
"<== AtlasEnumDefStoreV
2
.preCreate({}): {}"
,
enumDef
,
vertex
);
}
return
vertex
;
...
...
@@ -74,7 +74,7 @@ class AtlasEnumDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasEnumDef> {
@Override
public
AtlasEnumDef
create
(
AtlasEnumDef
enumDef
,
AtlasVertex
preCreateResult
)
throws
AtlasBaseException
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> AtlasEnumDefStoreV
1
.create({}, {})"
,
enumDef
,
preCreateResult
);
LOG
.
debug
(
"==> AtlasEnumDefStoreV
2
.create({}, {})"
,
enumDef
,
preCreateResult
);
}
AtlasAuthorizationUtils
.
verifyAccess
(
new
AtlasTypeAccessRequest
(
AtlasPrivilege
.
TYPE_CREATE
,
enumDef
),
"create enum-def "
,
enumDef
.
getName
());
...
...
@@ -84,7 +84,7 @@ class AtlasEnumDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasEnumDef> {
AtlasEnumDef
ret
=
toEnumDef
(
vertex
);
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"<== AtlasEntityDefStoreV
1
.create({}, {}): {}"
,
enumDef
,
preCreateResult
,
ret
);
LOG
.
debug
(
"<== AtlasEntityDefStoreV
2
.create({}, {}): {}"
,
enumDef
,
preCreateResult
,
ret
);
}
return
ret
;
...
...
@@ -93,7 +93,7 @@ class AtlasEnumDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasEnumDef> {
@Override
public
List
<
AtlasEnumDef
>
getAll
()
throws
AtlasBaseException
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> AtlasEnumDefStoreV
1
.getAll()"
);
LOG
.
debug
(
"==> AtlasEnumDefStoreV
2
.getAll()"
);
}
List
<
AtlasEnumDef
>
ret
=
new
ArrayList
<>();
...
...
@@ -104,7 +104,7 @@ class AtlasEnumDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasEnumDef> {
}
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"<== AtlasEnumDefStoreV
1
.getAll(): count={}"
,
ret
.
size
());
LOG
.
debug
(
"<== AtlasEnumDefStoreV
2
.getAll(): count={}"
,
ret
.
size
());
}
return
ret
;
...
...
@@ -113,7 +113,7 @@ class AtlasEnumDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasEnumDef> {
@Override
public
AtlasEnumDef
getByName
(
String
name
)
throws
AtlasBaseException
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> AtlasEnumDefStoreV
1
.getByName({})"
,
name
);
LOG
.
debug
(
"==> AtlasEnumDefStoreV
2
.getByName({})"
,
name
);
}
AtlasVertex
vertex
=
typeDefStore
.
findTypeVertexByNameAndCategory
(
name
,
TypeCategory
.
ENUM
);
...
...
@@ -127,7 +127,7 @@ class AtlasEnumDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasEnumDef> {
AtlasEnumDef
ret
=
toEnumDef
(
vertex
);
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"<== AtlasEnumDefStoreV
1
.getByName({}): {}"
,
name
,
ret
);
LOG
.
debug
(
"<== AtlasEnumDefStoreV
2
.getByName({}): {}"
,
name
,
ret
);
}
return
ret
;
...
...
@@ -136,7 +136,7 @@ class AtlasEnumDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasEnumDef> {
@Override
public
AtlasEnumDef
getByGuid
(
String
guid
)
throws
AtlasBaseException
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> AtlasEnumDefStoreV
1
.getByGuid({})"
,
guid
);
LOG
.
debug
(
"==> AtlasEnumDefStoreV
2
.getByGuid({})"
,
guid
);
}
AtlasVertex
vertex
=
typeDefStore
.
findTypeVertexByGuidAndCategory
(
guid
,
TypeCategory
.
ENUM
);
...
...
@@ -148,7 +148,7 @@ class AtlasEnumDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasEnumDef> {
AtlasEnumDef
ret
=
toEnumDef
(
vertex
);
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"<== AtlasEnumDefStoreV
1
.getByGuid({}): {}"
,
guid
,
ret
);
LOG
.
debug
(
"<== AtlasEnumDefStoreV
2
.getByGuid({}): {}"
,
guid
,
ret
);
}
return
ret
;
...
...
@@ -157,7 +157,7 @@ class AtlasEnumDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasEnumDef> {
@Override
public
AtlasEnumDef
update
(
AtlasEnumDef
enumDef
)
throws
AtlasBaseException
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> AtlasEnumDefStoreV
1
.update({})"
,
enumDef
);
LOG
.
debug
(
"==> AtlasEnumDefStoreV
2
.update({})"
,
enumDef
);
}
validateType
(
enumDef
);
...
...
@@ -166,7 +166,7 @@ class AtlasEnumDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasEnumDef> {
:
updateByName
(
enumDef
.
getName
(),
enumDef
);
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"<== AtlasEnumDefStoreV
1
.update({}): {}"
,
enumDef
,
ret
);
LOG
.
debug
(
"<== AtlasEnumDefStoreV
2
.update({}): {}"
,
enumDef
,
ret
);
}
return
ret
;
...
...
@@ -175,7 +175,7 @@ class AtlasEnumDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasEnumDef> {
@Override
public
AtlasEnumDef
updateByName
(
String
name
,
AtlasEnumDef
enumDef
)
throws
AtlasBaseException
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> AtlasEnumDefStoreV
1
.updateByName({}, {})"
,
name
,
enumDef
);
LOG
.
debug
(
"==> AtlasEnumDefStoreV
2
.updateByName({}, {})"
,
name
,
enumDef
);
}
AtlasEnumDef
existingDef
=
typeRegistry
.
getEnumDefByName
(
name
);
...
...
@@ -197,7 +197,7 @@ class AtlasEnumDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasEnumDef> {
AtlasEnumDef
ret
=
toEnumDef
(
vertex
);
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"<== AtlasEnumDefStoreV
1
.updateByName({}, {}): {}"
,
name
,
enumDef
,
ret
);
LOG
.
debug
(
"<== AtlasEnumDefStoreV
2
.updateByName({}, {}): {}"
,
name
,
enumDef
,
ret
);
}
return
ret
;
...
...
@@ -206,7 +206,7 @@ class AtlasEnumDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasEnumDef> {
@Override
public
AtlasEnumDef
updateByGuid
(
String
guid
,
AtlasEnumDef
enumDef
)
throws
AtlasBaseException
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> AtlasEnumDefStoreV
1
.updateByGuid({})"
,
guid
);
LOG
.
debug
(
"==> AtlasEnumDefStoreV
2
.updateByGuid({})"
,
guid
);
}
AtlasEnumDef
existingDef
=
typeRegistry
.
getEnumDefByGuid
(
guid
);
...
...
@@ -228,7 +228,7 @@ class AtlasEnumDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasEnumDef> {
AtlasEnumDef
ret
=
toEnumDef
(
vertex
);
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"<== AtlasEnumDefStoreV
1
.updateByGuid({}): {}"
,
guid
,
ret
);
LOG
.
debug
(
"<== AtlasEnumDefStoreV
2
.updateByGuid({}): {}"
,
guid
,
ret
);
}
return
ret
;
...
...
@@ -290,6 +290,10 @@ class AtlasEnumDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasEnumDef> {
values
.
add
(
element
.
getValue
());
}
AtlasGraphUtilsV2
.
setProperty
(
vertex
,
AtlasGraphUtilsV2
.
getTypeDefPropertyKey
(
enumDef
),
values
);
String
defaultValueKey
=
AtlasGraphUtilsV2
.
getTypeDefPropertyKey
(
enumDef
,
"defaultValue"
);
AtlasGraphUtilsV2
.
setProperty
(
vertex
,
defaultValueKey
,
enumDef
.
getDefaultValue
());
}
private
AtlasEnumDef
toEnumDef
(
AtlasVertex
vertex
)
{
...
...
@@ -320,6 +324,10 @@ class AtlasEnumDefStoreV2 extends AtlasAbstractDefStoreV2<AtlasEnumDef> {
}
ret
.
setElementDefs
(
elements
);
String
defaultValueKey
=
AtlasGraphUtilsV2
.
getTypeDefPropertyKey
(
ret
,
"defaultValue"
);
String
defaultValue
=
AtlasGraphUtilsV2
.
getProperty
(
vertex
,
defaultValueKey
,
String
.
class
);
ret
.
setDefaultValue
(
defaultValue
);
return
ret
;
}
}
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