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
cc2e6af7
Commit
cc2e6af7
authored
5 years ago
by
Madhan Neethiraj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-3611: updated AtlasEntityDef with addition of read-only field namespaceAttributeDefs
parent
4229cb3c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
95 additions
and
5 deletions
+95
-5
AtlasEntityDef.java
...n/java/org/apache/atlas/model/typedef/AtlasEntityDef.java
+53
-3
AtlasEntityType.java
.../src/main/java/org/apache/atlas/type/AtlasEntityType.java
+42
-2
No files found.
intg/src/main/java/org/apache/atlas/model/typedef/AtlasEntityDef.java
View file @
cc2e6af7
...
...
@@ -27,6 +27,7 @@ import org.apache.atlas.model.PList;
import
org.apache.atlas.model.SearchFilter.SortType
;
import
org.apache.atlas.model.TypeCategory
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.MapUtils
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
...
...
@@ -64,6 +65,11 @@ public class AtlasEntityDef extends AtlasStructDef implements java.io.Serializab
// the value of this field is derived from all the relationshipDefs this entityType is referenced in
private
List
<
AtlasRelationshipAttributeDef
>
relationshipAttributeDefs
;
// this is a read-only field, any value provided during create & update operation is ignored
// the value of this field is derived from all the namespaceDefs this entityType is referenced in
private
Map
<
String
,
List
<
AtlasAttributeDef
>>
namespaceAttributeDefs
;
public
AtlasEntityDef
()
{
this
(
null
,
null
,
null
,
null
,
null
,
null
,
null
);
}
...
...
@@ -122,12 +128,16 @@ public class AtlasEntityDef extends AtlasStructDef implements java.io.Serializab
public
AtlasEntityDef
(
AtlasEntityDef
other
)
{
super
(
other
);
setSuperTypes
(
other
!=
null
?
other
.
getSuperTypes
()
:
null
);
if
(
other
!=
null
)
{
setSuperTypes
(
other
.
getSuperTypes
());
setSubTypes
(
other
.
getSubTypes
());
setRelationshipAttributeDefs
(
other
.
getRelationshipAttributeDefs
());
setNamespaceAttributeDefs
(
other
.
getNamespaceAttributeDefs
());
}
}
public
Set
<
String
>
getSuperTypes
()
{
return
superTypes
;
}
...
...
@@ -160,6 +170,14 @@ public class AtlasEntityDef extends AtlasStructDef implements java.io.Serializab
this
.
relationshipAttributeDefs
=
relationshipAttributeDefs
;
}
public
Map
<
String
,
List
<
AtlasAttributeDef
>>
getNamespaceAttributeDefs
()
{
return
namespaceAttributeDefs
;
}
public
void
setNamespaceAttributeDefs
(
Map
<
String
,
List
<
AtlasAttributeDef
>>
namespaceAttributeDefs
)
{
this
.
namespaceAttributeDefs
=
namespaceAttributeDefs
;
}
public
boolean
hasSuperType
(
String
typeName
)
{
return
hasSuperType
(
superTypes
,
typeName
);
}
...
...
@@ -207,14 +225,46 @@ public class AtlasEntityDef extends AtlasStructDef implements java.io.Serializab
if
(
CollectionUtils
.
isNotEmpty
(
relationshipAttributeDefs
))
{
int
i
=
0
;
for
(
AtlasRelationshipAttributeDef
attributeDef
:
relationshipAttributeDefs
)
{
attributeDef
.
toString
(
sb
);
if
(
i
>
0
)
{
sb
.
append
(
", "
);
}
attributeDef
.
toString
(
sb
);
i
++;
}
}
sb
.
append
(
']'
);
sb
.
append
(
", namespaceAttributeDefs={"
);
if
(
MapUtils
.
isNotEmpty
(
namespaceAttributeDefs
))
{
int
nsIdx
=
0
;
for
(
Map
.
Entry
<
String
,
List
<
AtlasAttributeDef
>>
entry
:
namespaceAttributeDefs
.
entrySet
())
{
String
nsName
=
entry
.
getKey
();
List
<
AtlasAttributeDef
>
nsAttrs
=
entry
.
getValue
();
if
(
nsIdx
>
0
)
{
sb
.
append
(
", "
);
}
sb
.
append
(
nsName
).
append
(
"=["
);
int
attrIdx
=
0
;
for
(
AtlasAttributeDef
attributeDef
:
nsAttrs
)
{
if
(
attrIdx
>
0
)
{
sb
.
append
(
", "
);
}
attributeDef
.
toString
(
sb
);
attrIdx
++;
}
sb
.
append
(
']'
);
nsIdx
++;
}
}
sb
.
append
(
'}'
);
sb
.
append
(
'}'
);
return
sb
;
...
...
This diff is collapsed.
Click to expand it.
intg/src/main/java/org/apache/atlas/type/AtlasEntityType.java
View file @
cc2e6af7
...
...
@@ -90,7 +90,7 @@ public class AtlasEntityType extends AtlasStructType {
private
List
<
AtlasAttribute
>
dynEvalTriggerAttributes
=
Collections
.
emptyList
();
private
Map
<
String
,
List
<
TemplateToken
>>
parsedTemplates
=
Collections
.
emptyMap
();
private
Set
<
String
>
tagPropagationEdges
=
Collections
.
emptySet
();
private
Map
<
String
,
List
<
AtlasNamespaceAttribute
>>
namespaceAttributes
=
Collections
.
emptyMap
();
private
Map
<
String
,
List
<
AtlasNamespaceAttribute
>>
namespaceAttributes
=
Collections
.
emptyMap
();
public
AtlasEntityType
(
AtlasEntityDef
entityDef
)
{
super
(
entityDef
);
...
...
@@ -237,6 +237,28 @@ public class AtlasEntityType extends AtlasStructType {
}
}
Map
<
String
,
List
<
AtlasNamespaceAttribute
>>
superTypeNamespaces
=
superType
.
getNamespaceAttributes
();
if
(
MapUtils
.
isNotEmpty
(
superTypeNamespaces
))
{
for
(
Map
.
Entry
<
String
,
List
<
AtlasNamespaceAttribute
>>
entry
:
superTypeNamespaces
.
entrySet
())
{
String
nsName
=
entry
.
getKey
();
List
<
AtlasNamespaceAttribute
>
superTypeNsAttrs
=
entry
.
getValue
();
List
<
AtlasNamespaceAttribute
>
nsAttrs
=
namespaceAttributes
.
get
(
nsName
);
if
(
nsAttrs
==
null
)
{
nsAttrs
=
new
ArrayList
<>();
namespaceAttributes
.
put
(
nsName
,
nsAttrs
);
}
for
(
AtlasNamespaceAttribute
superTypeNsAttr
:
superTypeNsAttrs
)
{
if
(!
nsAttrs
.
contains
(
superTypeNsAttr
))
{
nsAttrs
.
add
(
superTypeNsAttr
);
}
}
}
}
tagPropagationEdges
.
addAll
(
superType
.
tagPropagationEdges
);
}
...
...
@@ -282,11 +304,29 @@ public class AtlasEntityType extends AtlasStructType {
entityDef
.
setRelationshipAttributeDefs
(
Collections
.
unmodifiableList
(
relationshipAttrDefs
));
Map
<
String
,
List
<
AtlasAttributeDef
>>
namespaceAttributeDefs
=
new
HashMap
<>();
for
(
Map
.
Entry
<
String
,
List
<
AtlasNamespaceAttribute
>>
entry
:
namespaceAttributes
.
entrySet
())
{
String
nsName
=
entry
.
getKey
();
List
<
AtlasNamespaceAttribute
>
nsAttrs
=
entry
.
getValue
();
List
<
AtlasAttributeDef
>
nsAttrDefs
=
new
ArrayList
<>();
for
(
AtlasNamespaceAttribute
nsAttr
:
nsAttrs
)
{
nsAttrDefs
.
add
(
nsAttr
.
getAttributeDef
());
}
namespaceAttributeDefs
.
put
(
nsName
,
nsAttrDefs
);
}
entityDef
.
setNamespaceAttributeDefs
(
namespaceAttributeDefs
);
this
.
parsedTemplates
=
parseDynAttributeTemplates
();
populateDynFlagsInfo
();
LOG
.
info
(
"resolveReferencesPhase3({}): tagPropagationEdges={}"
,
getTypeName
(),
tagPropagationEdges
);
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"resolveReferencesPhase3({}): tagPropagationEdges={}"
,
getTypeName
(),
tagPropagationEdges
);
}
}
public
Set
<
String
>
getSuperTypes
()
{
...
...
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