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
08ac11c0
Commit
08ac11c0
authored
7 years ago
by
Madhan Neethiraj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-2346: fix V1 REST API to include AttributeDefinition.dataTypeName field in type details
parent
413aa88e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
5 deletions
+38
-5
AttributeDefinition.java
...rg/apache/atlas/v1/model/typedef/AttributeDefinition.java
+0
-1
TypeConverterUtil.java
...apache/atlas/repository/converters/TypeConverterUtil.java
+1
-1
AtlasStructDefStoreV1.java
...tlas/repository/store/graph/v1/AtlasStructDefStoreV1.java
+37
-3
No files found.
intg/src/main/java/org/apache/atlas/v1/model/typedef/AttributeDefinition.java
View file @
08ac11c0
...
@@ -33,7 +33,6 @@ import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_
...
@@ -33,7 +33,6 @@ import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_
@JsonAutoDetect
(
getterVisibility
=
PUBLIC_ONLY
,
setterVisibility
=
PUBLIC_ONLY
,
fieldVisibility
=
NONE
)
@JsonAutoDetect
(
getterVisibility
=
PUBLIC_ONLY
,
setterVisibility
=
PUBLIC_ONLY
,
fieldVisibility
=
NONE
)
@JsonSerialize
(
include
=
JsonSerialize
.
Inclusion
.
NON_NULL
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@XmlRootElement
@XmlRootElement
@XmlAccessorType
(
XmlAccessType
.
PROPERTY
)
@XmlAccessorType
(
XmlAccessType
.
PROPERTY
)
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/converters/TypeConverterUtil.java
View file @
08ac11c0
...
@@ -360,7 +360,7 @@ public final class TypeConverterUtil {
...
@@ -360,7 +360,7 @@ public final class TypeConverterUtil {
for
(
AtlasAttributeDef
attrDef
:
attrDefs
)
{
for
(
AtlasAttributeDef
attrDef
:
attrDefs
)
{
AtlasAttribute
attribute
=
structType
.
getAttribute
(
attrDef
.
getName
());
AtlasAttribute
attribute
=
structType
.
getAttribute
(
attrDef
.
getName
());
AttributeDefinition
oldAttrDef
=
AtlasStructDefStoreV1
.
toAttributeDefintion
(
attribute
);
AttributeDefinition
oldAttrDef
=
AtlasStructDefStoreV1
.
toAttributeDefin
i
tion
(
attribute
);
ret
.
add
(
new
AttributeDefinition
(
oldAttrDef
.
getName
(),
oldAttrDef
.
getDataTypeName
(),
new
Multiplicity
(
oldAttrDef
.
getMultiplicity
()),
oldAttrDef
.
getIsComposite
(),
oldAttrDef
.
getIsUnique
(),
oldAttrDef
.
getIsIndexable
(),
oldAttrDef
.
getReverseAttributeName
()));
ret
.
add
(
new
AttributeDefinition
(
oldAttrDef
.
getName
(),
oldAttrDef
.
getDataTypeName
(),
new
Multiplicity
(
oldAttrDef
.
getMultiplicity
()),
oldAttrDef
.
getIsComposite
(),
oldAttrDef
.
getIsUnique
(),
oldAttrDef
.
getIsIndexable
(),
oldAttrDef
.
getReverseAttributeName
()));
}
}
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasStructDefStoreV1.java
View file @
08ac11c0
...
@@ -33,6 +33,7 @@ import org.apache.atlas.type.AtlasType;
...
@@ -33,6 +33,7 @@ import org.apache.atlas.type.AtlasType;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.atlas.type.AtlasTypeRegistry
;
import
org.apache.atlas.type.AtlasTypeUtil
;
import
org.apache.atlas.type.AtlasTypeUtil
;
import
org.apache.atlas.typesystem.types.DataTypes.TypeCategory
;
import
org.apache.atlas.typesystem.types.DataTypes.TypeCategory
;
import
org.apache.atlas.v1.model.typedef.Multiplicity
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
...
@@ -544,10 +545,43 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasStructDe
...
@@ -544,10 +545,43 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1<AtlasStructDe
return
ret
;
return
ret
;
}
}
public
static
AttributeDefinition
toAttributeDefintion
(
AtlasAttribute
attribute
)
{
public
static
Multiplicity
getMultiplicity
(
AtlasAttributeDef
attributeDef
)
{
String
jsonString
=
toJsonFromAttribute
(
attribute
);
final
int
lower
;
final
int
upper
;
final
boolean
isUnique
=
AtlasAttributeDef
.
Cardinality
.
SET
.
equals
(
attributeDef
.
getCardinality
());
AttributeDefinition
ret
=
AtlasType
.
fromV1Json
(
jsonString
,
AttributeDefinition
.
class
);
if
(
attributeDef
.
getCardinality
()
==
AtlasAttributeDef
.
Cardinality
.
SINGLE
)
{
lower
=
attributeDef
.
getIsOptional
()
?
0
:
1
;
upper
=
1
;
}
else
{
if
(
attributeDef
.
getIsOptional
())
{
lower
=
0
;
}
else
{
lower
=
attributeDef
.
getValuesMinCount
()
<
1
?
1
:
attributeDef
.
getValuesMinCount
();
}
upper
=
attributeDef
.
getValuesMaxCount
()
<
2
?
Integer
.
MAX_VALUE
:
attributeDef
.
getValuesMaxCount
();
}
Multiplicity
ret
=
new
Multiplicity
(
lower
,
upper
,
isUnique
);
return
ret
;
}
public
static
AttributeDefinition
toAttributeDefinition
(
AtlasAttribute
attribute
)
{
final
AtlasAttributeDef
attrDef
=
attribute
.
getAttributeDef
();
AttributeDefinition
ret
=
new
AttributeDefinition
();
ret
.
setName
(
attrDef
.
getName
());
ret
.
setDataTypeName
(
attrDef
.
getTypeName
());
ret
.
setMultiplicity
(
getMultiplicity
(
attrDef
));
ret
.
setIsComposite
(
attribute
.
isOwnedRef
());
ret
.
setIsUnique
(
attrDef
.
getIsUnique
());
ret
.
setIsIndexable
(
attrDef
.
getIsIndexable
());
ret
.
setReverseAttributeName
(
attribute
.
getInverseRefAttributeName
());
ret
.
setDescription
(
attrDef
.
getDescription
());
ret
.
setDefaultValue
(
attrDef
.
getDefaultValue
());
return
ret
;
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