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
4d9cf456
Commit
4d9cf456
authored
Oct 18, 2016
by
Suma Shivaprasad
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ATLAS-1229 Add TypeCategory and methods to access attribute definitiions in AtlasTypes (sumasai)
parent
d185522b
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
47 additions
and
25 deletions
+47
-25
AtlasArrayType.java
intg/src/main/java/org/apache/atlas/type/AtlasArrayType.java
+3
-3
AtlasBuiltInTypes.java
...rc/main/java/org/apache/atlas/type/AtlasBuiltInTypes.java
+12
-12
AtlasClassificationType.java
...n/java/org/apache/atlas/type/AtlasClassificationType.java
+1
-1
AtlasEntityType.java
.../src/main/java/org/apache/atlas/type/AtlasEntityType.java
+1
-1
AtlasEnumType.java
intg/src/main/java/org/apache/atlas/type/AtlasEnumType.java
+1
-1
AtlasMapType.java
intg/src/main/java/org/apache/atlas/type/AtlasMapType.java
+3
-3
AtlasStructType.java
.../src/main/java/org/apache/atlas/type/AtlasStructType.java
+12
-2
AtlasType.java
intg/src/main/java/org/apache/atlas/type/AtlasType.java
+12
-1
release-log.txt
release-log.txt
+2
-1
No files found.
intg/src/main/java/org/apache/atlas/type/AtlasArrayType.java
View file @
4d9cf456
...
...
@@ -48,7 +48,7 @@ public class AtlasArrayType extends AtlasType {
}
public
AtlasArrayType
(
AtlasType
elementType
,
int
minCount
,
int
maxCount
)
{
super
(
AtlasBaseTypeDef
.
getArrayTypeName
(
elementType
.
getTypeName
()));
super
(
AtlasBaseTypeDef
.
getArrayTypeName
(
elementType
.
getTypeName
())
,
TypeCategory
.
ARRAY
);
this
.
elementTypeName
=
elementType
.
getTypeName
();
this
.
minCount
=
minCount
;
...
...
@@ -61,7 +61,7 @@ public class AtlasArrayType extends AtlasType {
}
public
AtlasArrayType
(
String
elementTypeName
,
int
minCount
,
int
maxCount
)
{
super
(
AtlasBaseTypeDef
.
getArrayTypeName
(
elementTypeName
));
super
(
AtlasBaseTypeDef
.
getArrayTypeName
(
elementTypeName
)
,
TypeCategory
.
ARRAY
);
this
.
elementTypeName
=
elementTypeName
;
this
.
minCount
=
minCount
;
...
...
@@ -75,7 +75,7 @@ public class AtlasArrayType extends AtlasType {
public
AtlasArrayType
(
String
elementTypeName
,
int
minCount
,
int
maxCount
,
AtlasTypeRegistry
typeRegistry
)
throws
AtlasBaseException
{
super
(
AtlasBaseTypeDef
.
getArrayTypeName
(
elementTypeName
));
super
(
AtlasBaseTypeDef
.
getArrayTypeName
(
elementTypeName
)
,
TypeCategory
.
ARRAY
);
this
.
elementTypeName
=
elementTypeName
;
this
.
minCount
=
minCount
;
...
...
intg/src/main/java/org/apache/atlas/type/AtlasBuiltInTypes.java
View file @
4d9cf456
...
...
@@ -41,7 +41,7 @@ public class AtlasBuiltInTypes {
private
static
final
Boolean
DEFAULT_VALUE
=
Boolean
.
FALSE
;
public
AtlasBooleanType
()
{
super
(
AtlasBaseTypeDef
.
ATLAS_TYPE_BOOLEAN
);
super
(
AtlasBaseTypeDef
.
ATLAS_TYPE_BOOLEAN
,
TypeCategory
.
PRIMITIVE
);
}
@Override
...
...
@@ -75,7 +75,7 @@ public class AtlasBuiltInTypes {
private
static
final
Byte
DEFAULT_VALUE
=
new
Byte
((
byte
)
0
);
public
AtlasByteType
()
{
super
(
AtlasBaseTypeDef
.
ATLAS_TYPE_BYTE
);
super
(
AtlasBaseTypeDef
.
ATLAS_TYPE_BYTE
,
TypeCategory
.
PRIMITIVE
);
}
@Override
...
...
@@ -119,7 +119,7 @@ public class AtlasBuiltInTypes {
private
static
final
Short
DEFAULT_VALUE
=
new
Short
((
short
)
0
);
public
AtlasShortType
()
{
super
(
AtlasBaseTypeDef
.
ATLAS_TYPE_SHORT
);
super
(
AtlasBaseTypeDef
.
ATLAS_TYPE_SHORT
,
TypeCategory
.
PRIMITIVE
);
}
@Override
...
...
@@ -163,7 +163,7 @@ public class AtlasBuiltInTypes {
private
static
final
Integer
DEFAULT_VALUE
=
new
Integer
(
0
);
public
AtlasIntType
()
{
super
(
AtlasBaseTypeDef
.
ATLAS_TYPE_INT
);
super
(
AtlasBaseTypeDef
.
ATLAS_TYPE_INT
,
TypeCategory
.
PRIMITIVE
);
}
@Override
...
...
@@ -207,7 +207,7 @@ public class AtlasBuiltInTypes {
private
static
final
Long
DEFAULT_VALUE
=
new
Long
(
0
);
public
AtlasLongType
()
{
super
(
AtlasBaseTypeDef
.
ATLAS_TYPE_LONG
);
super
(
AtlasBaseTypeDef
.
ATLAS_TYPE_LONG
,
TypeCategory
.
PRIMITIVE
);
}
@Override
...
...
@@ -251,7 +251,7 @@ public class AtlasBuiltInTypes {
private
static
final
Float
DEFAULT_VALUE
=
new
Float
(
0
);
public
AtlasFloatType
()
{
super
(
AtlasBaseTypeDef
.
ATLAS_TYPE_FLOAT
);
super
(
AtlasBaseTypeDef
.
ATLAS_TYPE_FLOAT
,
TypeCategory
.
PRIMITIVE
);
}
@Override
...
...
@@ -295,7 +295,7 @@ public class AtlasBuiltInTypes {
private
static
final
Double
DEFAULT_VALUE
=
new
Double
(
0
);
public
AtlasDoubleType
()
{
super
(
AtlasBaseTypeDef
.
ATLAS_TYPE_DOUBLE
);
super
(
AtlasBaseTypeDef
.
ATLAS_TYPE_DOUBLE
,
TypeCategory
.
PRIMITIVE
);
}
@Override
...
...
@@ -341,7 +341,7 @@ public class AtlasBuiltInTypes {
private
static
final
BigInteger
DEFAULT_VALUE
=
BigInteger
.
ZERO
;
public
AtlasBigIntegerType
()
{
super
(
AtlasBaseTypeDef
.
ATLAS_TYPE_BIGINTEGER
);
super
(
AtlasBaseTypeDef
.
ATLAS_TYPE_BIGINTEGER
,
TypeCategory
.
PRIMITIVE
);
}
@Override
...
...
@@ -385,7 +385,7 @@ public class AtlasBuiltInTypes {
private
static
final
BigDecimal
DEFAULT_VALUE
=
BigDecimal
.
ZERO
;
public
AtlasBigDecimalType
()
{
super
(
AtlasBaseTypeDef
.
ATLAS_TYPE_BIGDECIMAL
);
super
(
AtlasBaseTypeDef
.
ATLAS_TYPE_BIGDECIMAL
,
TypeCategory
.
PRIMITIVE
);
}
@Override
...
...
@@ -429,7 +429,7 @@ public class AtlasBuiltInTypes {
private
static
final
Date
DEFAULT_VALUE
=
new
Date
(
0
);
public
AtlasDateType
()
{
super
(
AtlasBaseTypeDef
.
ATLAS_TYPE_DATE
);
super
(
AtlasBaseTypeDef
.
ATLAS_TYPE_DATE
,
TypeCategory
.
PRIMITIVE
);
}
@Override
...
...
@@ -478,7 +478,7 @@ public class AtlasBuiltInTypes {
private
static
final
String
DEFAULT_VALUE
=
""
;
public
AtlasStringType
()
{
super
(
AtlasBaseTypeDef
.
ATLAS_TYPE_STRING
);
super
(
AtlasBaseTypeDef
.
ATLAS_TYPE_STRING
,
TypeCategory
.
PRIMITIVE
);
}
@Override
...
...
@@ -506,7 +506,7 @@ public class AtlasBuiltInTypes {
*/
public
static
class
AtlasObjectIdType
extends
AtlasType
{
public
AtlasObjectIdType
()
{
super
(
AtlasBaseTypeDef
.
ATLAS_TYPE_OBJECT_ID
);
super
(
AtlasBaseTypeDef
.
ATLAS_TYPE_OBJECT_ID
,
TypeCategory
.
OBJECT_ID_TYPE
);
}
@Override
...
...
intg/src/main/java/org/apache/atlas/type/AtlasClassificationType.java
View file @
4d9cf456
...
...
@@ -46,7 +46,7 @@ public class AtlasClassificationType extends AtlasStructType {
private
Set
<
String
>
allSuperTypes
=
Collections
.
emptySet
();
public
AtlasClassificationType
(
AtlasClassificationDef
classificationDef
)
{
super
(
classificationDef
);
super
(
classificationDef
,
TypeCategory
.
CLASSIFICATION
);
this
.
classificationDef
=
classificationDef
;
}
...
...
intg/src/main/java/org/apache/atlas/type/AtlasEntityType.java
View file @
4d9cf456
...
...
@@ -45,7 +45,7 @@ public class AtlasEntityType extends AtlasStructType {
private
Set
<
String
>
allSuperTypes
=
Collections
.
emptySet
();
public
AtlasEntityType
(
AtlasEntityDef
entityDef
)
{
super
(
entityDef
);
super
(
entityDef
,
TypeCategory
.
ENTITY
);
this
.
entityDef
=
entityDef
;
}
...
...
intg/src/main/java/org/apache/atlas/type/AtlasEnumType.java
View file @
4d9cf456
...
...
@@ -36,7 +36,7 @@ public class AtlasEnumType extends AtlasType {
private
final
String
defaultValue
;
public
AtlasEnumType
(
AtlasEnumDef
enumDef
)
{
super
(
enumDef
.
getName
());
super
(
enumDef
.
getName
()
,
TypeCategory
.
PRIMITIVE
);
Map
<
String
,
AtlasEnumElementDef
>
e
=
new
HashMap
<
String
,
AtlasEnumElementDef
>();
...
...
intg/src/main/java/org/apache/atlas/type/AtlasMapType.java
View file @
4d9cf456
...
...
@@ -39,14 +39,14 @@ public class AtlasMapType extends AtlasType {
private
AtlasType
valueType
;
public
AtlasMapType
(
String
keyTypeName
,
String
valueTypeName
)
{
super
(
AtlasBaseTypeDef
.
getMapTypeName
(
keyTypeName
,
valueTypeName
));
super
(
AtlasBaseTypeDef
.
getMapTypeName
(
keyTypeName
,
valueTypeName
)
,
TypeCategory
.
MAP
);
this
.
keyTypeName
=
keyTypeName
;
this
.
valueTypeName
=
valueTypeName
;
}
public
AtlasMapType
(
AtlasType
keyType
,
AtlasType
valueType
)
{
super
(
AtlasBaseTypeDef
.
getMapTypeName
(
keyType
.
getTypeName
(),
valueType
.
getTypeName
()));
super
(
AtlasBaseTypeDef
.
getMapTypeName
(
keyType
.
getTypeName
(),
valueType
.
getTypeName
())
,
TypeCategory
.
MAP
);
this
.
keyTypeName
=
keyType
.
getTypeName
();
this
.
valueTypeName
=
valueType
.
getTypeName
();
...
...
@@ -56,7 +56,7 @@ public class AtlasMapType extends AtlasType {
public
AtlasMapType
(
String
keyTypeName
,
String
valueTypeName
,
AtlasTypeRegistry
typeRegistry
)
throws
AtlasBaseException
{
super
(
AtlasBaseTypeDef
.
getMapTypeName
(
keyTypeName
,
valueTypeName
));
super
(
AtlasBaseTypeDef
.
getMapTypeName
(
keyTypeName
,
valueTypeName
)
,
TypeCategory
.
MAP
);
this
.
keyTypeName
=
keyTypeName
;
this
.
valueTypeName
=
valueTypeName
;
...
...
intg/src/main/java/org/apache/atlas/type/AtlasStructType.java
View file @
4d9cf456
...
...
@@ -48,13 +48,19 @@ public class AtlasStructType extends AtlasType {
public
AtlasStructType
(
AtlasStructDef
structDef
)
{
super
(
structDef
.
getName
());
super
(
structDef
.
getName
(),
TypeCategory
.
STRUCT
);
this
.
structDef
=
structDef
;
}
public
AtlasStructType
(
AtlasStructDef
structDef
,
TypeCategory
category
)
{
super
(
structDef
.
getName
(),
category
);
this
.
structDef
=
structDef
;
}
public
AtlasStructType
(
AtlasStructDef
structDef
,
AtlasTypeRegistry
typeRegistry
)
throws
AtlasBaseException
{
super
(
structDef
.
getName
());
super
(
structDef
.
getName
()
,
TypeCategory
.
STRUCT
);
this
.
structDef
=
structDef
;
...
...
@@ -432,4 +438,8 @@ public class AtlasStructType extends AtlasType {
this
.
attributeName
=
attributeName
;
}
}
public
AtlasStructDef
getStructDefinition
()
{
return
structDef
;
}
}
intg/src/main/java/org/apache/atlas/type/AtlasType.java
View file @
4d9cf456
...
...
@@ -31,13 +31,20 @@ import java.util.List;
*/
public
abstract
class
AtlasType
{
public
enum
TypeCategory
{
PRIMITIVE
,
ARRAY
,
MAP
,
ENTITY
,
STRUCT
,
CLASSIFICATION
,
OBJECT_ID_TYPE
}
private
static
final
Gson
GSON
=
new
GsonBuilder
().
setDateFormat
(
AtlasBaseTypeDef
.
SERIALIZED_DATE_FORMAT_STR
).
create
();
private
final
String
typeName
;
public
AtlasType
(
String
typeName
)
{
private
final
TypeCategory
typeCategory
;
protected
AtlasType
(
String
typeName
,
TypeCategory
category
)
{
this
.
typeName
=
typeName
;
this
.
typeCategory
=
category
;
}
public
void
resolveReferences
(
AtlasTypeRegistry
typeRegistry
)
throws
AtlasBaseException
{
...
...
@@ -51,6 +58,10 @@ public abstract class AtlasType {
public
abstract
Object
getNormalizedValue
(
Object
obj
);
public
TypeCategory
getTypeCategory
()
{
return
typeCategory
;
}
public
boolean
validateValue
(
Object
obj
,
String
objName
,
List
<
String
>
messages
)
{
boolean
ret
=
isValidValue
(
obj
);
...
...
release-log.txt
View file @
4d9cf456
...
...
@@ -9,7 +9,8 @@ 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)
ALL CHANGES:
ATLAS-1227 Added support for attribute constraints in the API
ATLAS-1229 Add TypeCategory and methods to access attribute definitiions in AtlasTypes (sumasai)
ATLAS-1227 Added support for attribute constraints in the API (mneethiraj)
ATLAS-1225 Optimize AtlasTypeDefGraphStore to use typeRegistry (mneethiraj via sumasai)
ATLAS-1221 build failure in windows SyntaxError: invalid syntax (zhangqiang2 via shwethags)
ATLAS-1226 Servlet init-params in web.xml are unused (mneethiraj via shwethags)
...
...
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