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
5b8b16eb
Commit
5b8b16eb
authored
Jul 24, 2019
by
mayanknj
Committed by
nixonrodrigues
Aug 08, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-3206 - Additional attribute for AtlasGlossary, AtlasGlossaryTerm & AtlasGlossaryCategory.
Signed-off-by:
nixonrodrigues
<
nixon@apache.org
>
parent
8127189c
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
131 additions
and
19 deletions
+131
-19
0011-glossary_model.json
addons/models/0000-Area0/0011-glossary_model.json
+33
-4
004-glossary_model_add_additionalAttributes.json
.../patches/004-glossary_model_add_additionalAttributes.json
+64
-0
AtlasGlossaryBaseObject.java
.../apache/atlas/model/glossary/AtlasGlossaryBaseObject.java
+25
-12
AtlasGlossaryCategoryDTO.java
...las/repository/ogm/glossary/AtlasGlossaryCategoryDTO.java
+3
-1
AtlasGlossaryDTO.java
...pache/atlas/repository/ogm/glossary/AtlasGlossaryDTO.java
+4
-2
AtlasGlossaryTermDTO.java
...e/atlas/repository/ogm/glossary/AtlasGlossaryTermDTO.java
+2
-0
No files found.
addons/models/0000-Area0/0011-glossary_model.json
View file @
5b8b16eb
...
...
@@ -86,7 +86,7 @@
"__internal"
],
"serviceType"
:
"atlas_core"
,
"typeVersion"
:
"1.
0
"
,
"typeVersion"
:
"1.
1
"
,
"attributeDefs"
:
[
{
"name"
:
"qualifiedName"
,
...
...
@@ -135,8 +135,18 @@
"isIndexable"
:
false
,
"isOptional"
:
true
,
"isUnique"
:
false
},
{
"name"
:
"additionalAttributes"
,
"typeName"
:
"map<string,string>"
,
"cardinality"
:
"SINGLE"
,
"isIndexable"
:
false
,
"isOptional"
:
true
,
"isUnique"
:
false
}
]
},
{
"name"
:
"AtlasGlossaryTerm"
,
...
...
@@ -144,7 +154,7 @@
"__internal"
],
"serviceType"
:
"atlas_core"
,
"typeVersion"
:
"1.
0
"
,
"typeVersion"
:
"1.
1
"
,
"attributeDefs"
:
[
{
"name"
:
"qualifiedName"
,
...
...
@@ -201,8 +211,18 @@
"isIndexable"
:
false
,
"isOptional"
:
true
,
"isUnique"
:
false
},
{
"name"
:
"additionalAttributes"
,
"typeName"
:
"map<string,string>"
,
"cardinality"
:
"SINGLE"
,
"isIndexable"
:
false
,
"isOptional"
:
true
,
"isUnique"
:
false
}
]
},
{
"name"
:
"AtlasGlossaryCategory"
,
...
...
@@ -210,7 +230,7 @@
"__internal"
],
"serviceType"
:
"atlas_core"
,
"typeVersion"
:
"1.
0
"
,
"typeVersion"
:
"1.
1
"
,
"attributeDefs"
:
[
{
"name"
:
"qualifiedName"
,
...
...
@@ -243,6 +263,14 @@
"isIndexable"
:
false
,
"isOptional"
:
true
,
"isUnique"
:
false
},
{
"name"
:
"additionalAttributes"
,
"typeName"
:
"map<string,string>"
,
"cardinality"
:
"SINGLE"
,
"isIndexable"
:
false
,
"isOptional"
:
true
,
"isUnique"
:
false
}
]
}
...
...
@@ -895,4 +923,4 @@
]
}
]
}
}
\ No newline at end of file
addons/models/0000-Area0/patches/004-glossary_model_add_additionalAttributes.json
0 → 100644
View file @
5b8b16eb
{
"patches"
:
[
{
"id"
:
"TYPEDEF_PATCH_0001_004"
,
"description"
:
"Add 'additionalAttributes' attribute to AtlasGlossary"
,
"action"
:
"ADD_ATTRIBUTE"
,
"typeName"
:
"AtlasGlossary"
,
"applyToVersion"
:
"1.1"
,
"updateToVersion"
:
"1.2"
,
"params"
:
null
,
"attributeDefs"
:
[
{
"name"
:
"additionalAttributes"
,
"typeName"
:
"map<string,string>"
,
"cardinality"
:
"SINGLE"
,
"isIndexable"
:
false
,
"isOptional"
:
true
,
"isUnique"
:
false
}
]
},
{
"id"
:
"TYPEDEF_PATCH_0002_004"
,
"description"
:
"Add 'additionalAttributes' attribute to AtlasGlossaryTerm"
,
"action"
:
"ADD_ATTRIBUTE"
,
"typeName"
:
"AtlasGlossaryTerm"
,
"applyToVersion"
:
"1.1"
,
"updateToVersion"
:
"1.2"
,
"params"
:
null
,
"attributeDefs"
:
[
{
"name"
:
"additionalAttributes"
,
"typeName"
:
"map<string,string>"
,
"cardinality"
:
"SINGLE"
,
"isIndexable"
:
false
,
"isOptional"
:
true
,
"isUnique"
:
false
}
]
},
{
"id"
:
"TYPEDEF_PATCH_0003_004"
,
"description"
:
"Add 'additionalAttributes' attribute to AtlasGlossaryCategory"
,
"action"
:
"ADD_ATTRIBUTE"
,
"typeName"
:
"AtlasGlossaryCategory"
,
"applyToVersion"
:
"1.1"
,
"updateToVersion"
:
"1.2"
,
"params"
:
null
,
"attributeDefs"
:
[
{
"name"
:
"additionalAttributes"
,
"typeName"
:
"map<string,string>"
,
"cardinality"
:
"SINGLE"
,
"isIndexable"
:
false
,
"isOptional"
:
true
,
"isUnique"
:
false
}
]
}
]
}
intg/src/main/java/org/apache/atlas/model/glossary/AtlasGlossaryBaseObject.java
View file @
5b8b16eb
...
...
@@ -25,14 +25,17 @@ import org.apache.commons.collections.CollectionUtils;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Objects
;
import
java.util.Map
;
public
abstract
class
AtlasGlossaryBaseObject
extends
AtlasBaseModelObject
{
// Core attributes
private
String
qualifiedName
;
private
String
qualifiedName
;
protected
String
name
;
protected
String
shortDescription
;
protected
String
longDescription
;
private
Map
<
String
,
Object
>
additionalAttributes
;
// Classifications
protected
List
<
AtlasClassification
>
classifications
;
...
...
@@ -47,6 +50,15 @@ public abstract class AtlasGlossaryBaseObject extends AtlasBaseModelObject {
this
.
longDescription
=
other
.
longDescription
;
this
.
classifications
=
other
.
classifications
;
this
.
qualifiedName
=
other
.
qualifiedName
;
this
.
additionalAttributes
=
other
.
additionalAttributes
;
}
public
Map
<
String
,
Object
>
getAdditionalAttributes
()
{
return
additionalAttributes
;
}
public
void
setAdditionalAttributes
(
Map
<
String
,
Object
>
additionalAttributes
)
{
this
.
additionalAttributes
=
additionalAttributes
;
}
public
String
getQualifiedName
()
{
...
...
@@ -109,22 +121,22 @@ public abstract class AtlasGlossaryBaseObject extends AtlasBaseModelObject {
}
@Override
public
boolean
equals
(
final
Object
o
)
{
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
return
true
;
if
(
!(
o
instanceof
AtlasGlossaryBaseObject
))
return
false
;
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
(
))
return
false
;
if
(!
super
.
equals
(
o
))
return
false
;
final
AtlasGlossaryBaseObject
that
=
(
AtlasGlossaryBaseObject
)
o
;
return
Objects
.
equals
(
name
,
that
.
name
)
&&
Objects
.
equals
(
shortDescription
,
that
.
shortDescription
)
&&
Objects
.
equals
(
longDescription
,
that
.
longDescription
)
&&
Objects
.
equals
(
classifications
,
that
.
classifications
)
&&
Objects
.
equals
(
qualifiedName
,
that
.
qualifiedName
);
AtlasGlossaryBaseObject
that
=
(
AtlasGlossaryBaseObject
)
o
;
return
Objects
.
equals
(
qualifiedName
,
that
.
qualifiedName
)
&&
Objects
.
equals
(
name
,
that
.
name
)
&&
Objects
.
equals
(
shortDescription
,
that
.
shortDescription
)
&&
Objects
.
equals
(
longDescription
,
that
.
longDescription
)
&&
Objects
.
equals
(
additionalAttributes
,
that
.
additionalAttributes
)
&&
Objects
.
equals
(
classifications
,
that
.
classifications
);
}
@Override
public
int
hashCode
()
{
return
Objects
.
hash
(
super
.
hashCode
(),
name
,
shortDescription
,
longDescription
,
classifications
,
qualifiedName
);
return
Objects
.
hash
(
super
.
hashCode
(),
qualifiedName
,
name
,
shortDescription
,
longDescription
,
additionalAttributes
,
classifications
);
}
@Override
...
...
@@ -133,7 +145,8 @@ public abstract class AtlasGlossaryBaseObject extends AtlasBaseModelObject {
sb
.
append
(
", name='"
).
append
(
name
).
append
(
'\''
);
sb
.
append
(
", shortDescription='"
).
append
(
shortDescription
).
append
(
'\''
);
sb
.
append
(
", longDescription='"
).
append
(
longDescription
).
append
(
'\''
);
sb
.
append
(
", classifications="
).
append
(
classifications
);
sb
.
append
(
", classifications="
).
append
(
classifications
).
append
(
'\''
);
sb
.
append
(
", additionalAttributes="
).
append
(
additionalAttributes
);
return
sb
;
}
...
...
repository/src/main/java/org/apache/atlas/repository/ogm/glossary/AtlasGlossaryCategoryDTO.java
View file @
5b8b16eb
...
...
@@ -29,10 +29,10 @@ import org.slf4j.LoggerFactory;
import
org.springframework.stereotype.Component
;
import
javax.inject.Inject
;
import
java.util.Collection
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.Collection
;
@Component
public
class
AtlasGlossaryCategoryDTO
extends
AbstractGlossaryDTO
<
AtlasGlossaryCategory
>
{
...
...
@@ -57,6 +57,7 @@ public class AtlasGlossaryCategoryDTO extends AbstractGlossaryDTO<AtlasGlossaryC
ret
.
setName
((
String
)
entity
.
getAttribute
(
"name"
));
ret
.
setShortDescription
((
String
)
entity
.
getAttribute
(
"shortDescription"
));
ret
.
setLongDescription
((
String
)
entity
.
getAttribute
(
"longDescription"
));
ret
.
setAdditionalAttributes
((
Map
)
entity
.
getAttribute
(
"additionalAttributes"
));
Object
anchor
=
entity
.
getRelationshipAttribute
(
"anchor"
);
if
(
anchor
instanceof
AtlasRelatedObjectId
)
{
...
...
@@ -125,6 +126,7 @@ public class AtlasGlossaryCategoryDTO extends AbstractGlossaryDTO<AtlasGlossaryC
ret
.
setAttribute
(
"shortDescription"
,
obj
.
getShortDescription
());
ret
.
setAttribute
(
"longDescription"
,
obj
.
getLongDescription
());
ret
.
setAttribute
(
"anchor"
,
new
AtlasObjectId
(
obj
.
getAnchor
().
getGlossaryGuid
()));
ret
.
setAttribute
(
"additionalAttributes"
,
obj
.
getAdditionalAttributes
());
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"<== AtlasGlossaryCategoryDTO.toEntity() : {}"
,
ret
);
...
...
repository/src/main/java/org/apache/atlas/repository/ogm/glossary/AtlasGlossaryDTO.java
View file @
5b8b16eb
...
...
@@ -58,9 +58,10 @@ public class AtlasGlossaryDTO extends AbstractGlossaryDTO<AtlasGlossary> {
ret
.
setLongDescription
((
String
)
entity
.
getAttribute
(
"longDescription"
));
ret
.
setLanguage
((
String
)
entity
.
getAttribute
(
"language"
));
ret
.
setUsage
((
String
)
entity
.
getAttribute
(
"usage"
));
ret
.
setAdditionalAttributes
((
Map
)
entity
.
getAttribute
(
"additionalAttributes"
));
Object
categoriesAttr
=
entity
.
getRelationshipAttribute
(
"categories"
);
Object
termsAttr
=
entity
.
getRelationshipAttribute
(
"terms"
);
Object
termsAttr
=
entity
.
getRelationshipAttribute
(
"terms"
);
// Populate categories
if
(
Objects
.
nonNull
(
categoriesAttr
))
{
...
...
@@ -92,7 +93,7 @@ public class AtlasGlossaryDTO extends AbstractGlossaryDTO<AtlasGlossary> {
@Override
public
AtlasGlossary
from
(
final
AtlasEntity
.
AtlasEntityWithExtInfo
entityWithExtInfo
)
{
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"==> AtlasGlossaryDTO.from()"
,
entityWithExtInfo
);
LOG
.
debug
(
"==> AtlasGlossaryDTO.from()"
,
entityWithExtInfo
);
}
Objects
.
requireNonNull
(
entityWithExtInfo
,
"entity"
);
AtlasGlossary
ret
=
from
(
entityWithExtInfo
.
getEntity
());
...
...
@@ -119,6 +120,7 @@ public class AtlasGlossaryDTO extends AbstractGlossaryDTO<AtlasGlossary> {
ret
.
setAttribute
(
"longDescription"
,
obj
.
getLongDescription
());
ret
.
setAttribute
(
"language"
,
obj
.
getLanguage
());
ret
.
setAttribute
(
"usage"
,
obj
.
getUsage
());
ret
.
setAttribute
(
"additionalAttributes"
,
obj
.
getAdditionalAttributes
());
if
(
LOG
.
isDebugEnabled
())
{
LOG
.
debug
(
"<== AtlasGlossaryDTO.toEntity() : {}"
,
ret
);
...
...
repository/src/main/java/org/apache/atlas/repository/ogm/glossary/AtlasGlossaryTermDTO.java
View file @
5b8b16eb
...
...
@@ -63,6 +63,7 @@ public class AtlasGlossaryTermDTO extends AbstractGlossaryDTO<AtlasGlossaryTerm>
ret
.
setExamples
((
List
<
String
>)
entity
.
getAttribute
(
"examples"
));
ret
.
setAbbreviation
((
String
)
entity
.
getAttribute
(
"abbreviation"
));
ret
.
setUsage
((
String
)
entity
.
getAttribute
(
"usage"
));
ret
.
setAdditionalAttributes
((
Map
)
entity
.
getAttribute
(
"additionalAttributes"
));
Object
anchor
=
entity
.
getRelationshipAttribute
(
"anchor"
);
if
(
anchor
instanceof
AtlasRelatedObjectId
)
{
...
...
@@ -220,6 +221,7 @@ public class AtlasGlossaryTermDTO extends AbstractGlossaryDTO<AtlasGlossaryTerm>
ret
.
setAttribute
(
"abbreviation"
,
obj
.
getAbbreviation
());
ret
.
setAttribute
(
"usage"
,
obj
.
getUsage
());
ret
.
setAttribute
(
"anchor"
,
new
AtlasObjectId
(
obj
.
getAnchor
().
getGlossaryGuid
()));
ret
.
setAttribute
(
"additionalAttributes"
,
obj
.
getAdditionalAttributes
());
if
(
CollectionUtils
.
isNotEmpty
(
obj
.
getClassifications
()))
{
if
(
LOG
.
isDebugEnabled
())
{
...
...
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