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
ee5b03ca
Commit
ee5b03ca
authored
8 years ago
by
apoorvnaik
Committed by
Madhan Neethiraj
8 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-1278: Added API to get typedef header info
Signed-off-by:
Madhan Neethiraj
<
madhan@apache.org
>
parent
bf5f53a7
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
223 additions
and
16 deletions
+223
-16
TypeCategory.java
intg/src/main/java/org/apache/atlas/model/TypeCategory.java
+22
-0
AtlasTypeDefHeader.java
...va/org/apache/atlas/model/typedef/AtlasTypeDefHeader.java
+131
-0
AtlasArrayType.java
intg/src/main/java/org/apache/atlas/type/AtlasArrayType.java
+1
-0
AtlasBuiltInTypes.java
...rc/main/java/org/apache/atlas/type/AtlasBuiltInTypes.java
+1
-0
AtlasClassificationType.java
...n/java/org/apache/atlas/type/AtlasClassificationType.java
+1
-0
AtlasEntityType.java
.../src/main/java/org/apache/atlas/type/AtlasEntityType.java
+1
-0
AtlasEnumType.java
intg/src/main/java/org/apache/atlas/type/AtlasEnumType.java
+1
-0
AtlasMapType.java
intg/src/main/java/org/apache/atlas/type/AtlasMapType.java
+1
-0
AtlasStructType.java
.../src/main/java/org/apache/atlas/type/AtlasStructType.java
+1
-0
AtlasType.java
intg/src/main/java/org/apache/atlas/type/AtlasType.java
+1
-4
AtlasTypeUtil.java
intg/src/main/java/org/apache/atlas/type/AtlasTypeUtil.java
+32
-1
release-log.txt
release-log.txt
+1
-0
AtlasClassificationDefStoreV1.java
...ository/store/graph/v1/AtlasClassificationDefStoreV1.java
+3
-3
AtlasEntityDefStoreV1.java
...tlas/repository/store/graph/v1/AtlasEntityDefStoreV1.java
+3
-3
AtlasStructDefStoreV1.java
...tlas/repository/store/graph/v1/AtlasStructDefStoreV1.java
+5
-5
TypesREST.java
...pp/src/main/java/org/apache/atlas/web/rest/TypesREST.java
+18
-0
No files found.
intg/src/main/java/org/apache/atlas/model/TypeCategory.java
0 → 100644
View file @
ee5b03ca
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
model
;
public
enum
TypeCategory
{
PRIMITIVE
,
ARRAY
,
MAP
,
ENTITY
,
STRUCT
,
CLASSIFICATION
,
OBJECT_ID_TYPE
}
This diff is collapsed.
Click to expand it.
intg/src/main/java/org/apache/atlas/model/typedef/AtlasTypeDefHeader.java
0 → 100644
View file @
ee5b03ca
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
apache
.
atlas
.
model
.
typedef
;
import
org.apache.atlas.model.TypeCategory
;
import
org.codehaus.jackson.annotate.JsonAutoDetect
;
import
org.codehaus.jackson.annotate.JsonIgnoreProperties
;
import
org.codehaus.jackson.map.annotate.JsonSerialize
;
import
javax.xml.bind.annotation.XmlAccessType
;
import
javax.xml.bind.annotation.XmlAccessorType
;
import
javax.xml.bind.annotation.XmlRootElement
;
import
static
org
.
codehaus
.
jackson
.
annotate
.
JsonAutoDetect
.
Visibility
.
NONE
;
import
static
org
.
codehaus
.
jackson
.
annotate
.
JsonAutoDetect
.
Visibility
.
PUBLIC_ONLY
;
@JsonAutoDetect
(
getterVisibility
=
PUBLIC_ONLY
,
setterVisibility
=
PUBLIC_ONLY
,
fieldVisibility
=
NONE
)
@JsonSerialize
(
include
=
JsonSerialize
.
Inclusion
.
NON_NULL
)
@JsonIgnoreProperties
(
ignoreUnknown
=
true
)
@XmlRootElement
@XmlAccessorType
(
XmlAccessType
.
PROPERTY
)
public
class
AtlasTypeDefHeader
{
private
String
guid
;
private
String
name
;
private
TypeCategory
category
;
public
AtlasTypeDefHeader
(
String
guid
,
String
name
,
TypeCategory
category
)
{
this
.
guid
=
guid
;
this
.
name
=
name
;
this
.
category
=
category
;
}
public
AtlasTypeDefHeader
()
{
this
(
null
,
null
,
null
);
}
public
AtlasTypeDefHeader
(
AtlasTypeDefHeader
other
)
{
super
();
if
(
other
==
null
)
{
setGuid
(
null
);
setName
(
null
);
setCategory
(
null
);
}
else
{
setGuid
(
other
.
getGuid
());
setName
(
other
.
getName
());
setCategory
(
other
.
getCategory
());
}
}
public
String
getGuid
()
{
return
guid
;
}
public
void
setGuid
(
String
guid
)
{
this
.
guid
=
guid
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
TypeCategory
getCategory
()
{
return
category
;
}
public
void
setCategory
(
TypeCategory
category
)
{
this
.
category
=
category
;
}
@Override
public
String
toString
()
{
return
toString
(
new
StringBuilder
()).
toString
();
}
@Override
public
boolean
equals
(
Object
o
)
{
if
(
this
==
o
)
{
return
true
;
}
if
(
o
==
null
||
getClass
()
!=
o
.
getClass
())
{
return
false
;
}
AtlasTypeDefHeader
that
=
(
AtlasTypeDefHeader
)
o
;
if
(
guid
!=
null
?
!
guid
.
equals
(
that
.
guid
)
:
that
.
guid
!=
null
)
{
return
false
;
}
if
(
name
!=
null
?
!
name
.
equals
(
that
.
name
)
:
that
.
name
!=
null
)
{
return
false
;
}
if
(
category
!=
null
?
!
category
.
equals
(
that
.
category
)
:
that
.
category
!=
null
)
{
return
false
;
}
return
true
;
}
@Override
public
int
hashCode
()
{
int
result
=
guid
!=
null
?
guid
.
hashCode
()
:
0
;
result
=
31
*
result
+
(
name
!=
null
?
name
.
hashCode
()
:
0
);
result
=
31
*
result
+
(
category
!=
null
?
category
.
hashCode
()
:
0
);
return
result
;
}
public
StringBuilder
toString
(
StringBuilder
sb
)
{
if
(
sb
==
null
)
{
sb
=
new
StringBuilder
();
}
sb
.
append
(
"AtlasTypeDefHeader{"
);
sb
.
append
(
"guid='"
).
append
(
guid
).
append
(
'\''
);
sb
.
append
(
", name='"
).
append
(
name
).
append
(
'\''
);
sb
.
append
(
", typeCategory='"
).
append
(
category
).
append
(
'\''
);
sb
.
append
(
'}'
);
return
sb
;
}
}
This diff is collapsed.
Click to expand it.
intg/src/main/java/org/apache/atlas/type/AtlasArrayType.java
View file @
ee5b03ca
...
@@ -19,6 +19,7 @@ package org.apache.atlas.type;
...
@@ -19,6 +19,7 @@ package org.apache.atlas.type;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.TypeCategory
;
import
org.apache.atlas.model.typedef.AtlasBaseTypeDef
;
import
org.apache.atlas.model.typedef.AtlasBaseTypeDef
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
...
This diff is collapsed.
Click to expand it.
intg/src/main/java/org/apache/atlas/type/AtlasBuiltInTypes.java
View file @
ee5b03ca
...
@@ -24,6 +24,7 @@ import java.text.ParseException;
...
@@ -24,6 +24,7 @@ import java.text.ParseException;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.Map
;
import
java.util.Map
;
import
org.apache.atlas.model.TypeCategory
;
import
org.apache.atlas.model.instance.AtlasObjectId
;
import
org.apache.atlas.model.instance.AtlasObjectId
;
import
org.apache.atlas.model.typedef.AtlasBaseTypeDef
;
import
org.apache.atlas.model.typedef.AtlasBaseTypeDef
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
...
...
This diff is collapsed.
Click to expand it.
intg/src/main/java/org/apache/atlas/type/AtlasClassificationType.java
View file @
ee5b03ca
...
@@ -20,6 +20,7 @@ package org.apache.atlas.type;
...
@@ -20,6 +20,7 @@ package org.apache.atlas.type;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.TypeCategory
;
import
org.apache.atlas.model.instance.AtlasClassification
;
import
org.apache.atlas.model.instance.AtlasClassification
;
import
org.apache.atlas.model.typedef.AtlasClassificationDef
;
import
org.apache.atlas.model.typedef.AtlasClassificationDef
;
import
org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef
;
import
org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef
;
...
...
This diff is collapsed.
Click to expand it.
intg/src/main/java/org/apache/atlas/type/AtlasEntityType.java
View file @
ee5b03ca
...
@@ -20,6 +20,7 @@ package org.apache.atlas.type;
...
@@ -20,6 +20,7 @@ package org.apache.atlas.type;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.TypeCategory
;
import
org.apache.atlas.model.instance.AtlasEntity
;
import
org.apache.atlas.model.instance.AtlasEntity
;
import
org.apache.atlas.model.typedef.AtlasEntityDef
;
import
org.apache.atlas.model.typedef.AtlasEntityDef
;
import
org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef
;
import
org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef
;
...
...
This diff is collapsed.
Click to expand it.
intg/src/main/java/org/apache/atlas/type/AtlasEnumType.java
View file @
ee5b03ca
...
@@ -23,6 +23,7 @@ import java.util.HashMap;
...
@@ -23,6 +23,7 @@ import java.util.HashMap;
import
java.util.Map
;
import
java.util.Map
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.TypeCategory
;
import
org.apache.atlas.model.typedef.AtlasEnumDef
;
import
org.apache.atlas.model.typedef.AtlasEnumDef
;
import
org.apache.atlas.model.typedef.AtlasEnumDef.AtlasEnumElementDef
;
import
org.apache.atlas.model.typedef.AtlasEnumDef.AtlasEnumElementDef
;
...
...
This diff is collapsed.
Click to expand it.
intg/src/main/java/org/apache/atlas/type/AtlasMapType.java
View file @
ee5b03ca
...
@@ -19,6 +19,7 @@ package org.apache.atlas.type;
...
@@ -19,6 +19,7 @@ package org.apache.atlas.type;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.TypeCategory
;
import
org.apache.atlas.model.typedef.AtlasBaseTypeDef
;
import
org.apache.atlas.model.typedef.AtlasBaseTypeDef
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
...
This diff is collapsed.
Click to expand it.
intg/src/main/java/org/apache/atlas/type/AtlasStructType.java
View file @
ee5b03ca
...
@@ -19,6 +19,7 @@ package org.apache.atlas.type;
...
@@ -19,6 +19,7 @@ package org.apache.atlas.type;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.TypeCategory
;
import
org.apache.atlas.model.instance.AtlasStruct
;
import
org.apache.atlas.model.instance.AtlasStruct
;
import
org.apache.atlas.model.typedef.AtlasStructDef
;
import
org.apache.atlas.model.typedef.AtlasStructDef
;
import
org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef
;
import
org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef
;
...
...
This diff is collapsed.
Click to expand it.
intg/src/main/java/org/apache/atlas/type/AtlasType.java
View file @
ee5b03ca
...
@@ -21,6 +21,7 @@ package org.apache.atlas.type;
...
@@ -21,6 +21,7 @@ package org.apache.atlas.type;
import
com.google.gson.Gson
;
import
com.google.gson.Gson
;
import
com.google.gson.GsonBuilder
;
import
com.google.gson.GsonBuilder
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.model.TypeCategory
;
import
org.apache.atlas.model.typedef.AtlasBaseTypeDef
;
import
org.apache.atlas.model.typedef.AtlasBaseTypeDef
;
import
java.util.List
;
import
java.util.List
;
...
@@ -31,10 +32,6 @@ import java.util.List;
...
@@ -31,10 +32,6 @@ import java.util.List;
*/
*/
public
abstract
class
AtlasType
{
public
abstract
class
AtlasType
{
public
enum
TypeCategory
{
PRIMITIVE
,
ARRAY
,
MAP
,
ENTITY
,
STRUCT
,
CLASSIFICATION
,
OBJECT_ID_TYPE
}
private
static
final
Gson
GSON
=
private
static
final
Gson
GSON
=
new
GsonBuilder
().
setDateFormat
(
AtlasBaseTypeDef
.
SERIALIZED_DATE_FORMAT_STR
).
create
();
new
GsonBuilder
().
setDateFormat
(
AtlasBaseTypeDef
.
SERIALIZED_DATE_FORMAT_STR
).
create
();
...
...
This diff is collapsed.
Click to expand it.
intg/src/main/java/org/apache/atlas/type/AtlasTypeUtil.java
View file @
ee5b03ca
...
@@ -27,16 +27,19 @@ import org.apache.atlas.model.typedef.AtlasEnumDef.AtlasEnumElementDef;
...
@@ -27,16 +27,19 @@ import org.apache.atlas.model.typedef.AtlasEnumDef.AtlasEnumElementDef;
import
org.apache.atlas.model.typedef.AtlasStructDef
;
import
org.apache.atlas.model.typedef.AtlasStructDef
;
import
org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef
;
import
org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef
;
import
org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef.Cardinality
;
import
org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef.Cardinality
;
import
org.apache.atlas.model.typedef.AtlasTypeDefHeader
;
import
org.apache.atlas.model.typedef.AtlasTypesDef
;
import
org.apache.atlas.model.typedef.AtlasTypesDef
;
import
org.apache.atlas.model.TypeCategory
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang.StringUtils
;
import
org.apache.commons.lang.StringUtils
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.Collections
;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.Set
;
import
java.util.Arrays
;
import
static
org
.
apache
.
atlas
.
model
.
typedef
.
AtlasBaseTypeDef
.
ATLAS_TYPE_ARRAY_PREFIX
;
import
static
org
.
apache
.
atlas
.
model
.
typedef
.
AtlasBaseTypeDef
.
ATLAS_TYPE_ARRAY_PREFIX
;
import
static
org
.
apache
.
atlas
.
model
.
typedef
.
AtlasBaseTypeDef
.
ATLAS_TYPE_ARRAY_SUFFIX
;
import
static
org
.
apache
.
atlas
.
model
.
typedef
.
AtlasBaseTypeDef
.
ATLAS_TYPE_ARRAY_SUFFIX
;
...
@@ -194,4 +197,31 @@ public class AtlasTypeUtil {
...
@@ -194,4 +197,31 @@ public class AtlasTypeUtil {
List
<
AtlasEntityDef
>
classes
)
{
List
<
AtlasEntityDef
>
classes
)
{
return
new
AtlasTypesDef
(
enums
,
structs
,
traits
,
classes
);
return
new
AtlasTypesDef
(
enums
,
structs
,
traits
,
classes
);
}
}
public
static
List
<
AtlasTypeDefHeader
>
toTypeDefHeader
(
AtlasTypesDef
typesDef
)
{
List
<
AtlasTypeDefHeader
>
headerList
=
new
LinkedList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
typesDef
.
getEnumDefs
()))
{
for
(
AtlasEnumDef
enumDef
:
typesDef
.
getEnumDefs
())
{
headerList
.
add
(
new
AtlasTypeDefHeader
(
enumDef
.
getGuid
(),
enumDef
.
getName
(),
TypeCategory
.
PRIMITIVE
));
}
}
if
(
CollectionUtils
.
isNotEmpty
(
typesDef
.
getStructDefs
()))
{
for
(
AtlasStructDef
structDef
:
typesDef
.
getStructDefs
())
{
headerList
.
add
(
new
AtlasTypeDefHeader
(
structDef
.
getGuid
(),
structDef
.
getName
(),
TypeCategory
.
STRUCT
));
}
}
if
(
CollectionUtils
.
isNotEmpty
(
typesDef
.
getClassificationDefs
()))
{
for
(
AtlasClassificationDef
classificationDef
:
typesDef
.
getClassificationDefs
())
{
headerList
.
add
(
new
AtlasTypeDefHeader
(
classificationDef
.
getGuid
(),
classificationDef
.
getName
(),
TypeCategory
.
CLASSIFICATION
));
}
}
if
(
CollectionUtils
.
isNotEmpty
(
typesDef
.
getEntityDefs
()))
{
for
(
AtlasEntityDef
entityDef
:
typesDef
.
getEntityDefs
())
{
headerList
.
add
(
new
AtlasTypeDefHeader
(
entityDef
.
getGuid
(),
entityDef
.
getName
(),
TypeCategory
.
ENTITY
));
}
}
return
headerList
;
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
release-log.txt
View file @
ee5b03ca
...
@@ -9,6 +9,7 @@ ATLAS-1060 Add composite indexes for exact match performance improvements for al
...
@@ -9,6 +9,7 @@ ATLAS-1060 Add composite indexes for exact match performance improvements for al
ATLAS-1127 Modify creation and modification timestamps to Date instead of Long(sumasai)
ATLAS-1127 Modify creation and modification timestamps to Date instead of Long(sumasai)
ALL CHANGES:
ALL CHANGES:
ATLAS-1278 Added API to get typedef header info
ATLAS-1246 Upgrade versions of dependencies (shwethags)
ATLAS-1246 Upgrade versions of dependencies (shwethags)
ATLAS-1192 Atlas IE support (kevalbhatt)
ATLAS-1192 Atlas IE support (kevalbhatt)
ATLAS-1273 Test testOnChangeRefresh in DefaultMetadataServiceTest is failing (ayubkhan via shwethags)
ATLAS-1273 Test testOnChangeRefresh in DefaultMetadataServiceTest is failing (ayubkhan via shwethags)
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasClassificationDefStoreV1.java
View file @
ee5b03ca
...
@@ -58,7 +58,7 @@ public class AtlasClassificationDefStoreV1 extends AtlasAbstractDefStoreV1 imple
...
@@ -58,7 +58,7 @@ public class AtlasClassificationDefStoreV1 extends AtlasAbstractDefStoreV1 imple
AtlasType
type
=
typeRegistry
.
getType
(
classificationDef
.
getName
());
AtlasType
type
=
typeRegistry
.
getType
(
classificationDef
.
getName
());
if
(
type
.
getTypeCategory
()
!=
AtlasType
.
TypeCategory
.
CLASSIFICATION
)
{
if
(
type
.
getTypeCategory
()
!=
org
.
apache
.
atlas
.
model
.
TypeCategory
.
CLASSIFICATION
)
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
TYPE_MATCH_FAILED
,
classificationDef
.
getName
(),
TypeCategory
.
TRAIT
.
name
());
throw
new
AtlasBaseException
(
AtlasErrorCode
.
TYPE_MATCH_FAILED
,
classificationDef
.
getName
(),
TypeCategory
.
TRAIT
.
name
());
}
}
...
@@ -193,7 +193,7 @@ public class AtlasClassificationDefStoreV1 extends AtlasAbstractDefStoreV1 imple
...
@@ -193,7 +193,7 @@ public class AtlasClassificationDefStoreV1 extends AtlasAbstractDefStoreV1 imple
AtlasType
type
=
typeRegistry
.
getType
(
classificationDef
.
getName
());
AtlasType
type
=
typeRegistry
.
getType
(
classificationDef
.
getName
());
if
(
type
.
getTypeCategory
()
!=
AtlasType
.
TypeCategory
.
CLASSIFICATION
)
{
if
(
type
.
getTypeCategory
()
!=
org
.
apache
.
atlas
.
model
.
TypeCategory
.
CLASSIFICATION
)
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
TYPE_MATCH_FAILED
,
classificationDef
.
getName
(),
TypeCategory
.
TRAIT
.
name
());
throw
new
AtlasBaseException
(
AtlasErrorCode
.
TYPE_MATCH_FAILED
,
classificationDef
.
getName
(),
TypeCategory
.
TRAIT
.
name
());
}
}
...
@@ -223,7 +223,7 @@ public class AtlasClassificationDefStoreV1 extends AtlasAbstractDefStoreV1 imple
...
@@ -223,7 +223,7 @@ public class AtlasClassificationDefStoreV1 extends AtlasAbstractDefStoreV1 imple
AtlasType
type
=
typeRegistry
.
getTypeByGuid
(
guid
);
AtlasType
type
=
typeRegistry
.
getTypeByGuid
(
guid
);
if
(
type
.
getTypeCategory
()
!=
AtlasType
.
TypeCategory
.
CLASSIFICATION
)
{
if
(
type
.
getTypeCategory
()
!=
org
.
apache
.
atlas
.
model
.
TypeCategory
.
CLASSIFICATION
)
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
TYPE_MATCH_FAILED
,
classificationDef
.
getName
(),
TypeCategory
.
TRAIT
.
name
());
throw
new
AtlasBaseException
(
AtlasErrorCode
.
TYPE_MATCH_FAILED
,
classificationDef
.
getName
(),
TypeCategory
.
TRAIT
.
name
());
}
}
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasEntityDefStoreV1.java
View file @
ee5b03ca
...
@@ -57,7 +57,7 @@ public class AtlasEntityDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
...
@@ -57,7 +57,7 @@ public class AtlasEntityDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
AtlasType
type
=
typeRegistry
.
getType
(
entityDef
.
getName
());
AtlasType
type
=
typeRegistry
.
getType
(
entityDef
.
getName
());
if
(
type
.
getTypeCategory
()
!=
AtlasType
.
TypeCategory
.
ENTITY
)
{
if
(
type
.
getTypeCategory
()
!=
org
.
apache
.
atlas
.
model
.
TypeCategory
.
ENTITY
)
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
TYPE_MATCH_FAILED
,
entityDef
.
getName
(),
TypeCategory
.
CLASS
.
name
());
throw
new
AtlasBaseException
(
AtlasErrorCode
.
TYPE_MATCH_FAILED
,
entityDef
.
getName
(),
TypeCategory
.
CLASS
.
name
());
}
}
...
@@ -191,7 +191,7 @@ public class AtlasEntityDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
...
@@ -191,7 +191,7 @@ public class AtlasEntityDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
AtlasType
type
=
typeRegistry
.
getType
(
entityDef
.
getName
());
AtlasType
type
=
typeRegistry
.
getType
(
entityDef
.
getName
());
if
(
type
.
getTypeCategory
()
!=
AtlasType
.
TypeCategory
.
ENTITY
)
{
if
(
type
.
getTypeCategory
()
!=
org
.
apache
.
atlas
.
model
.
TypeCategory
.
ENTITY
)
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
TYPE_MATCH_FAILED
,
entityDef
.
getName
(),
TypeCategory
.
CLASS
.
name
());
throw
new
AtlasBaseException
(
AtlasErrorCode
.
TYPE_MATCH_FAILED
,
entityDef
.
getName
(),
TypeCategory
.
CLASS
.
name
());
}
}
...
@@ -221,7 +221,7 @@ public class AtlasEntityDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
...
@@ -221,7 +221,7 @@ public class AtlasEntityDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
AtlasType
type
=
typeRegistry
.
getTypeByGuid
(
guid
);
AtlasType
type
=
typeRegistry
.
getTypeByGuid
(
guid
);
if
(
type
.
getTypeCategory
()
!=
AtlasType
.
TypeCategory
.
ENTITY
)
{
if
(
type
.
getTypeCategory
()
!=
org
.
apache
.
atlas
.
model
.
TypeCategory
.
ENTITY
)
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
TYPE_MATCH_FAILED
,
entityDef
.
getName
(),
TypeCategory
.
CLASS
.
name
());
throw
new
AtlasBaseException
(
AtlasErrorCode
.
TYPE_MATCH_FAILED
,
entityDef
.
getName
(),
TypeCategory
.
CLASS
.
name
());
}
}
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasStructDefStoreV1.java
View file @
ee5b03ca
...
@@ -69,7 +69,7 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
...
@@ -69,7 +69,7 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
AtlasType
type
=
typeRegistry
.
getType
(
structDef
.
getName
());
AtlasType
type
=
typeRegistry
.
getType
(
structDef
.
getName
());
if
(
type
.
getTypeCategory
()
!=
AtlasType
.
TypeCategory
.
STRUCT
)
{
if
(
type
.
getTypeCategory
()
!=
org
.
apache
.
atlas
.
model
.
TypeCategory
.
STRUCT
)
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
TYPE_MATCH_FAILED
,
structDef
.
getName
(),
TypeCategory
.
STRUCT
.
name
());
throw
new
AtlasBaseException
(
AtlasErrorCode
.
TYPE_MATCH_FAILED
,
structDef
.
getName
(),
TypeCategory
.
STRUCT
.
name
());
}
}
...
@@ -202,7 +202,7 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
...
@@ -202,7 +202,7 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
AtlasType
type
=
typeRegistry
.
getType
(
structDef
.
getName
());
AtlasType
type
=
typeRegistry
.
getType
(
structDef
.
getName
());
if
(
type
.
getTypeCategory
()
!=
AtlasType
.
TypeCategory
.
STRUCT
)
{
if
(
type
.
getTypeCategory
()
!=
org
.
apache
.
atlas
.
model
.
TypeCategory
.
STRUCT
)
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
TYPE_MATCH_FAILED
,
structDef
.
getName
(),
TypeCategory
.
STRUCT
.
name
());
throw
new
AtlasBaseException
(
AtlasErrorCode
.
TYPE_MATCH_FAILED
,
structDef
.
getName
(),
TypeCategory
.
STRUCT
.
name
());
}
}
...
@@ -232,7 +232,7 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
...
@@ -232,7 +232,7 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
AtlasType
type
=
typeRegistry
.
getTypeByGuid
(
guid
);
AtlasType
type
=
typeRegistry
.
getTypeByGuid
(
guid
);
if
(
type
.
getTypeCategory
()
!=
AtlasType
.
TypeCategory
.
STRUCT
)
{
if
(
type
.
getTypeCategory
()
!=
org
.
apache
.
atlas
.
model
.
TypeCategory
.
STRUCT
)
{
throw
new
AtlasBaseException
(
AtlasErrorCode
.
TYPE_MATCH_FAILED
,
structDef
.
getName
(),
TypeCategory
.
STRUCT
.
name
());
throw
new
AtlasBaseException
(
AtlasErrorCode
.
TYPE_MATCH_FAILED
,
structDef
.
getName
(),
TypeCategory
.
STRUCT
.
name
());
}
}
...
@@ -494,11 +494,11 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
...
@@ -494,11 +494,11 @@ public class AtlasStructDefStoreV1 extends AtlasAbstractDefStoreV1 implements At
if
(
isForeignKey
)
{
// check if the referenced entity has foreignKeyRef to this attribute
if
(
isForeignKey
)
{
// check if the referenced entity has foreignKeyRef to this attribute
AtlasType
attribType
=
structType
.
getAttributeType
(
attributeDef
.
getName
());
AtlasType
attribType
=
structType
.
getAttributeType
(
attributeDef
.
getName
());
if
(
attribType
.
getTypeCategory
()
==
AtlasType
.
TypeCategory
.
ARRAY
)
{
if
(
attribType
.
getTypeCategory
()
==
org
.
apache
.
atlas
.
model
.
TypeCategory
.
ARRAY
)
{
attribType
=
((
AtlasArrayType
)
attribType
).
getElementType
();
attribType
=
((
AtlasArrayType
)
attribType
).
getElementType
();
}
}
if
(
attribType
.
getTypeCategory
()
==
AtlasType
.
TypeCategory
.
ENTITY
)
{
if
(
attribType
.
getTypeCategory
()
==
org
.
apache
.
atlas
.
model
.
TypeCategory
.
ENTITY
)
{
reverseAttribName
=
((
AtlasStructType
)
attribType
).
getMappedFromRefAttribute
(
structType
.
getTypeName
(),
reverseAttribName
=
((
AtlasStructType
)
attribType
).
getMappedFromRefAttribute
(
structType
.
getTypeName
(),
attributeDef
.
getName
());
attributeDef
.
getName
());
}
}
...
...
This diff is collapsed.
Click to expand it.
webapp/src/main/java/org/apache/atlas/web/rest/TypesREST.java
View file @
ee5b03ca
...
@@ -29,13 +29,16 @@ import org.apache.atlas.model.typedef.AtlasEnumDef;
...
@@ -29,13 +29,16 @@ import org.apache.atlas.model.typedef.AtlasEnumDef;
import
org.apache.atlas.model.typedef.AtlasEnumDef.AtlasEnumDefs
;
import
org.apache.atlas.model.typedef.AtlasEnumDef.AtlasEnumDefs
;
import
org.apache.atlas.model.typedef.AtlasStructDef
;
import
org.apache.atlas.model.typedef.AtlasStructDef
;
import
org.apache.atlas.model.typedef.AtlasStructDef.AtlasStructDefs
;
import
org.apache.atlas.model.typedef.AtlasStructDef.AtlasStructDefs
;
import
org.apache.atlas.model.typedef.AtlasTypeDefHeader
;
import
org.apache.atlas.model.typedef.AtlasTypesDef
;
import
org.apache.atlas.model.typedef.AtlasTypesDef
;
import
org.apache.atlas.store.AtlasTypeDefStore
;
import
org.apache.atlas.store.AtlasTypeDefStore
;
import
org.apache.atlas.type.AtlasTypeUtil
;
import
org.apache.atlas.web.util.Servlets
;
import
org.apache.atlas.web.util.Servlets
;
import
org.apache.http.annotation.Experimental
;
import
org.apache.http.annotation.Experimental
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.Set
;
import
javax.inject.Singleton
;
import
javax.inject.Singleton
;
...
@@ -387,6 +390,21 @@ public class TypesREST {
...
@@ -387,6 +390,21 @@ public class TypesREST {
/** Bulk API operations **/
/** Bulk API operations **/
/******************************************************************/
/******************************************************************/
/**
* Bulk retrieval API for all type definitions returned as a list of minimal information header
* @return List of AtlasTypeDefHeader {@link AtlasTypeDefHeader}
* @throws AtlasBaseException
*/
@GET
@Path
(
"/typedefs/headers"
)
@Produces
(
Servlets
.
JSON_MEDIA_TYPE
)
public
List
<
AtlasTypeDefHeader
>
getTypeDefHeaders
()
throws
AtlasBaseException
{
SearchFilter
searchFilter
=
getSearchFilter
();
AtlasTypesDef
searchTypesDef
=
typeDefStore
.
searchTypesDef
(
searchFilter
);
return
AtlasTypeUtil
.
toTypeDefHeader
(
searchTypesDef
);
}
/**
/**
* Bulk retrieval API for retrieving all type definitions in Atlas
* Bulk retrieval API for retrieving all type definitions in Atlas
...
...
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