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
dde33712
Commit
dde33712
authored
Jan 24, 2015
by
Venkatesh Seetharam
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add unique and index attributes for types. Contributed by Venkatesh Seetharam
parent
6418f2c2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
2 deletions
+23
-2
AttributeDefinition.java
...org/apache/hadoop/metadata/types/AttributeDefinition.java
+16
-0
AttributeInfo.java
.../java/org/apache/hadoop/metadata/types/AttributeInfo.java
+7
-2
No files found.
typesystem/src/main/java/org/apache/hadoop/metadata/types/AttributeDefinition.java
View file @
dde33712
...
...
@@ -24,6 +24,9 @@ public final class AttributeDefinition {
public
final
String
dataTypeName
;
public
final
Multiplicity
multiplicity
;
public
final
boolean
isComposite
;
public
final
boolean
isUnique
;
public
final
boolean
isIndexable
;
/**
* If this is a reference attribute, then the name of the attribute on the Class
* that this refers to.
...
...
@@ -32,10 +35,19 @@ public final class AttributeDefinition {
public
AttributeDefinition
(
String
name
,
String
dataTypeName
,
Multiplicity
multiplicity
,
boolean
isComposite
,
String
reverseAttributeName
)
{
this
(
name
,
dataTypeName
,
multiplicity
,
isComposite
,
false
,
true
,
reverseAttributeName
);
}
public
AttributeDefinition
(
String
name
,
String
dataTypeName
,
Multiplicity
multiplicity
,
boolean
isComposite
,
boolean
isUnique
,
boolean
isIndexable
,
String
reverseAttributeName
)
{
this
.
name
=
name
;
this
.
dataTypeName
=
dataTypeName
;
this
.
multiplicity
=
multiplicity
;
this
.
isComposite
=
isComposite
;
this
.
isUnique
=
isUnique
;
this
.
isIndexable
=
isIndexable
;
this
.
reverseAttributeName
=
reverseAttributeName
;
}
...
...
@@ -47,6 +59,8 @@ public final class AttributeDefinition {
AttributeDefinition
that
=
(
AttributeDefinition
)
o
;
if
(
isComposite
!=
that
.
isComposite
)
return
false
;
if
(
isUnique
!=
that
.
isUnique
)
return
false
;
if
(
isIndexable
!=
that
.
isIndexable
)
return
false
;
if
(!
dataTypeName
.
equals
(
that
.
dataTypeName
))
return
false
;
if
(!
multiplicity
.
equals
(
that
.
multiplicity
))
return
false
;
if
(!
name
.
equals
(
that
.
name
))
return
false
;
...
...
@@ -63,6 +77,8 @@ public final class AttributeDefinition {
result
=
31
*
result
+
dataTypeName
.
hashCode
();
result
=
31
*
result
+
multiplicity
.
hashCode
();
result
=
31
*
result
+
(
isComposite
?
1
:
0
);
result
=
31
*
result
+
(
isUnique
?
1
:
0
);
result
=
31
*
result
+
(
isIndexable
?
1
:
0
);
result
=
31
*
result
+
(
reverseAttributeName
!=
null
?
reverseAttributeName
.
hashCode
()
:
0
);
return
result
;
}
...
...
typesystem/src/main/java/org/apache/hadoop/metadata/types/AttributeInfo.java
View file @
dde33712
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
...
...
@@ -20,13 +19,15 @@
package
org
.
apache
.
hadoop
.
metadata
.
types
;
import
org.apache.hadoop.metadata.MetadataException
;
import
org.apache.hadoop.metadata.MetadataException
;
public
class
AttributeInfo
{
public
final
String
name
;
private
IDataType
dataType
;
public
final
Multiplicity
multiplicity
;
public
final
boolean
isComposite
;
public
final
boolean
isUnique
;
public
final
boolean
isIndexable
;
/**
* If this is a reference attribute, then the name of the attribute on the Class
* that this refers to.
...
...
@@ -39,6 +40,8 @@ public class AttributeInfo {
this
.
dataType
=
t
.
getDataType
(
IDataType
.
class
,
def
.
dataTypeName
);
this
.
multiplicity
=
def
.
multiplicity
;
this
.
isComposite
=
def
.
isComposite
;
this
.
isUnique
=
def
.
isUnique
;
this
.
isIndexable
=
def
.
isIndexable
;
this
.
reverseAttributeName
=
def
.
reverseAttributeName
;
}
...
...
@@ -57,6 +60,8 @@ public class AttributeInfo {
", dataType="
+
dataType
+
", multiplicity="
+
multiplicity
+
", isComposite="
+
isComposite
+
", isUnique="
+
isUnique
+
", isIndexable="
+
isIndexable
+
", reverseAttributeName='"
+
reverseAttributeName
+
'\''
+
'}'
;
}
...
...
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