You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ma...@apache.org on 2017/06/20 16:31:12 UTC
[09/14] incubator-atlas git commit: ATLAS-1873: renamed
AtlasRelationshipEndPoint to AtlasRelationshipEnd
ATLAS-1873: renamed AtlasRelationshipEndPoint to AtlasRelationshipEnd
Signed-off-by: Madhan Neethiraj <ma...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/incubator-atlas/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-atlas/commit/1de6016d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-atlas/tree/1de6016d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-atlas/diff/1de6016d
Branch: refs/heads/feature-odf
Commit: 1de6016df57c13100e18f7278c560fb3f4e50500
Parents: c2c05d6
Author: David Radley <da...@uk.ibm.com>
Authored: Wed Jun 14 22:08:55 2017 -0700
Committer: Madhan Neethiraj <ma...@apache.org>
Committed: Wed Jun 14 22:29:05 2017 -0700
----------------------------------------------------------------------
.../org/apache/atlas/repository/Constants.java | 4 +-
.../java/org/apache/atlas/AtlasErrorCode.java | 14 +-
.../model/typedef/AtlasRelationshipDef.java | 91 ++++-----
.../model/typedef/AtlasRelationshipEndDef.java | 193 +++++++++++++++++++
.../typedef/AtlasRelationshipEndPointDef.java | 193 -------------------
.../atlas/type/AtlasRelationshipType.java | 42 ++--
.../model/typedef/TestAtlasRelationshipDef.java | 12 +-
.../atlas/type/TestAtlasRelationshipType.java | 20 +-
.../graph/v1/AtlasRelationshipDefStoreV1.java | 24 +--
9 files changed, 297 insertions(+), 296 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1de6016d/common/src/main/java/org/apache/atlas/repository/Constants.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/atlas/repository/Constants.java b/common/src/main/java/org/apache/atlas/repository/Constants.java
index b07934b..ac02252 100644
--- a/common/src/main/java/org/apache/atlas/repository/Constants.java
+++ b/common/src/main/java/org/apache/atlas/repository/Constants.java
@@ -58,8 +58,8 @@ public final class Constants {
public static final String TYPEOPTIONS_PROPERTY_KEY = INTERNAL_PROPERTY_KEY_PREFIX + "type.options";
// relationship def constants
- public static final String RELATIONSHIPTYPE_ENDPOINT1_KEY = "endPointDef1";
- public static final String RELATIONSHIPTYPE_ENDPOINT2_KEY = "endPointDef2";
+ public static final String RELATIONSHIPTYPE_END1_KEY = "endDef1";
+ public static final String RELATIONSHIPTYPE_END2_KEY = "endDef2";
public static final String RELATIONSHIPTYPE_CATEGORY_KEY = "relationshipCategory";
public static final String RELATIONSHIPTYPE_TAG_PROPAGATION_KEY = "tagPropagation";
/**
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1de6016d/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java b/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java
index ca2f3d0..6c33f40 100644
--- a/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java
+++ b/intg/src/main/java/org/apache/atlas/AtlasErrorCode.java
@@ -71,14 +71,14 @@ public enum AtlasErrorCode {
BAD_REQUEST(400, "ATLAS-400-00-029", "{0}"),
PARAMETER_PARSING_FAILED(400, "ATLAS-400-00-02A", "Parameter parsing failed at: {0}"),
MISSING_MANDATORY_ATTRIBUTE(400, "ATLAS-400-00-02B", "Mandatory field {0}.{1} has empty/null value"),
- RELATIONSHIPDEF_INSUFFICIENT_ENDPOINTS(400, "ATLAS-400-00-02C", "Relationship def {0} creation attempted without 2 end points"),
- RELATIONSHIPDEF_DOUBLE_CONTAINERS(400, "ATLAS-400-00-02D", "Relationship def {0} creation attempted with both end points as containers"),
+ RELATIONSHIPDEF_INSUFFICIENT_ENDS(400, "ATLAS-400-00-02C", "relationshipDef {0} creation attempted without 2 ends"),
+ RELATIONSHIPDEF_DOUBLE_CONTAINERS(400, "ATLAS-400-00-02D", "relationshipDef {0} creation attempted with both ends as containers"),
RELATIONSHIPDEF_UNSUPPORTED_ATTRIBUTE_TYPE(400, "ATLAS-400-00-02F", "Cannot set an Attribute with type {0} on relationship def {1}, as it is not a primitive type "),
- RELATIONSHIPDEF_ASSOCIATION_AND_CONTAINER(400, "ATLAS-400-00-030", "ASSOCIATION relationship def {0} creation attempted with an endpoint specifying isContainer"),
- RELATIONSHIPDEF_COMPOSITION_NO_CONTAINER(400, "ATLAS-400-00-031", "COMPOSITION relationship def {0} creation attempted without an endpoint specifying isContainer"),
- RELATIONSHIPDEF_AGGREGATION_NO_CONTAINER(400, "ATLAS-400-00-032", "AGGREGATION relationship def {0} creation attempted without an endpoint specifying isContainer"),
- RELATIONSHIPDEF_COMPOSITION_SET_CONTAINER(400, "ATLAS-400-00-033", "COMPOSITION relationship def {0} cannot have a SET cardinality and be a container"),
- RELATIONSHIPDEF_LIST_ON_ENDPOINT(400, "ATLAS-400-00-034", "relationship def {0} cannot have a LIST cardinality on an endpoint"),
+ RELATIONSHIPDEF_ASSOCIATION_AND_CONTAINER(400, "ATLAS-400-00-030", "ASSOCIATION relationshipDef {0} creation attempted with an end specifying isContainer"),
+ RELATIONSHIPDEF_COMPOSITION_NO_CONTAINER(400, "ATLAS-400-00-031", "COMPOSITION relationshipDef {0} creation attempted without an end specifying isContainer"),
+ RELATIONSHIPDEF_AGGREGATION_NO_CONTAINER(400, "ATLAS-400-00-032", "AGGREGATION relationshipDef {0} creation attempted without an end specifying isContainer"),
+ RELATIONSHIPDEF_COMPOSITION_SET_CONTAINER(400, "ATLAS-400-00-033", "COMPOSITION relationshipDef {0} cannot have a SET cardinality and be a container"),
+ RELATIONSHIPDEF_LIST_ON_END(400, "ATLAS-400-00-034", "relationshipDef {0} cannot have a LIST cardinality on an end"),
// All Not found enums go here
TYPE_NAME_NOT_FOUND(404, "ATLAS-404-00-001", "Given typename {0} was invalid"),
TYPE_GUID_NOT_FOUND(404, "ATLAS-404-00-002", "Given type guid {0} was invalid"),
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1de6016d/intg/src/main/java/org/apache/atlas/model/typedef/AtlasRelationshipDef.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/model/typedef/AtlasRelationshipDef.java b/intg/src/main/java/org/apache/atlas/model/typedef/AtlasRelationshipDef.java
index eb8330e..fc820d4 100644
--- a/intg/src/main/java/org/apache/atlas/model/typedef/AtlasRelationshipDef.java
+++ b/intg/src/main/java/org/apache/atlas/model/typedef/AtlasRelationshipDef.java
@@ -39,8 +39,8 @@ import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONL
* As with other typeDefs the AtlasRelationshipDef has a name. Once created the RelationshipDef has a guid.
* The name and the guid are the 2 ways that the RelationshipDef is identified.
*
- * RelationshipDefs have 2 endpoints, each of which specify cardinality, an EntityDef type name and name and optionally
- * whether the endpoint is a container.
+ * RelationshipDefs have 2 ends, each of which specify cardinality, an EntityDef type name and name and optionally
+ * whether the end is a container.
* RelationshipDefs can have AttributeDefs - though only primitive types are allowed.
* RelationshipDefs have a relationshipCategory specifying the UML type of relationship required
* RelationshipDefs also have a PropogateTag - indicating which way tags could flow over the relationships.
@@ -51,9 +51,9 @@ import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONL
* RelationshipDefs introduce new atributes to the entity instances. For example
* EntityDef A might have attributes attr1,attr2,attr3
* EntityDef B might have attributes attr4,attr5,attr6
- * RelationshipDef AtoB might define 2 endpoints
- * endpoint1: type A, name attr7
- * endpoint1: type B, name attr8
+ * RelationshipDef AtoB might define 2 ends
+ * end1: type A, name attr7
+ * end1: type B, name attr8
*
* When an instance of EntityDef A is created, it will have attributes attr1,attr2,attr3,attr7
* When an instance of EntityDef B is created, it will have attributes attr4,attr5,attr6,attr8
@@ -88,11 +88,11 @@ public class AtlasRelationshipDef extends AtlasStructDef implements java.io.Seri
* PropagateTags indicates whether tags should propagate across the relationship instance.
* Tags can propagate:
* NONE - not at all
- * ONE_TO_TWO - from endpoint 1 to 2
- * TWO_TO_ONE - from endpoint 2 to 1
+ * ONE_TO_TWO - from end 1 to 2
+ * TWO_TO_ONE - from end 2 to 1
* BOTH - both ways
*
- * Care needs to be taken when specifying. The use cases we are aware of this flag being useful are :
+ * Care needs to be taken when specifying. The use cases we are aware of where this flag is useful:
*
* - propagating confidentiality classifications from a table to columns - ONE_TO_TWO could be used here
* - propagating classifications around Glossary synonyms - BOTH could be used here.
@@ -104,10 +104,10 @@ public class AtlasRelationshipDef extends AtlasStructDef implements java.io.Seri
NONE, ONE_TO_TWO, TWO_TO_ONE, BOTH
};
- private RelationshipCategory relationshipCategory;
- private PropagateTags propagateTags;
- private AtlasRelationshipEndPointDef endPointDef1;
- private AtlasRelationshipEndPointDef endPointDef2;
+ private RelationshipCategory relationshipCategory;
+ private PropagateTags propagateTags;
+ private AtlasRelationshipEndDef endDef1;
+ private AtlasRelationshipEndDef endDef2;
/**
* AtlasRelationshipDef contructor
@@ -130,22 +130,23 @@ public class AtlasRelationshipDef extends AtlasStructDef implements java.io.Seri
* and AGGREGATION
* @param propagatetags
* -
- * @param endPointDef1
- * - first endpoint. As endpoint specifies an entity
- * type and an attribute name. the attribute name then appears in
+ * @param endDef1
+ * - first end. An end specifies an entity type and an attribute name. the attribute name then appears in
* the relationship instance
- * @param endPointDef2
- * - second endpoint. The endpoints are defined as 1
- * ad 2 to avoid implying a direction. So we do not use to and
- * from.
+ * @param endDef2
+ * - second end. An end specifies an entity type and an attribute name. the attribute name then appears in
+ * the relationship instance
+ *
+ * The ends are defined as 1 and 2 to avoid implying a direction. So we do not use to and from.
+ *
* @throws AtlasBaseException
*/
public AtlasRelationshipDef(String name, String description, String typeVersion,
RelationshipCategory relationshipCategory,
PropagateTags propagatetags,
- AtlasRelationshipEndPointDef endPointDef1,
- AtlasRelationshipEndPointDef endPointDef2) throws AtlasBaseException {
- this(name, description, typeVersion, relationshipCategory,propagatetags, endPointDef1, endPointDef2,
+ AtlasRelationshipEndDef endDef1,
+ AtlasRelationshipEndDef endDef2) throws AtlasBaseException {
+ this(name, description, typeVersion, relationshipCategory,propagatetags, endDef1, endDef2,
new ArrayList<AtlasAttributeDef>());
}
@@ -162,12 +163,12 @@ public class AtlasRelationshipDef extends AtlasStructDef implements java.io.Seri
* and AGGREGATION
* @param propagatetags
* -
- * @param endPointDef1
- * - First endpoint. As endpoint specifies an entity
+ * @param endDef1
+ * - First end. As end specifies an entity
* type and an attribute name. the attribute name then appears in
* the relationship instance
- * @param endPointDef2
- * - Second endpoint. The endpoints are defined as 1
+ * @param endDef2
+ * - Second end. The ends are defined as 1
* ad 2 to avoid implying a direction. So we do not use to and
* from.
* @param attributeDefs
@@ -175,15 +176,15 @@ public class AtlasRelationshipDef extends AtlasStructDef implements java.io.Seri
*/
public AtlasRelationshipDef(String name, String description, String typeVersion,
RelationshipCategory relationshipCategory,
- PropagateTags propagatetags, AtlasRelationshipEndPointDef endPointDef1,
- AtlasRelationshipEndPointDef endPointDef2, List<AtlasAttributeDef> attributeDefs)
+ PropagateTags propagatetags, AtlasRelationshipEndDef endDef1,
+ AtlasRelationshipEndDef endDef2, List<AtlasAttributeDef> attributeDefs)
{
super(TypeCategory.RELATIONSHIP, name, description, typeVersion, attributeDefs, null);
setRelationshipCategory(relationshipCategory);
setPropagateTags(propagatetags);
- setEndPointDef1(endPointDef1);
- setEndPointDef2(endPointDef2);
+ setEndDef1(endDef1);
+ setEndDef2(endDef2);
}
public void setRelationshipCategory(RelationshipCategory relationshipCategory) {
@@ -202,20 +203,20 @@ public class AtlasRelationshipDef extends AtlasStructDef implements java.io.Seri
return this.propagateTags;
}
- public void setEndPointDef1(AtlasRelationshipEndPointDef endPointDef1) {
- this.endPointDef1 = endPointDef1;
+ public void setEndDef1(AtlasRelationshipEndDef endDef1) {
+ this.endDef1 = endDef1;
}
- public AtlasRelationshipEndPointDef getEndPointDef1() {
- return this.endPointDef1;
+ public AtlasRelationshipEndDef getEndDef1() {
+ return this.endDef1;
}
- public void setEndPointDef2(AtlasRelationshipEndPointDef endPointDef2) {
- this.endPointDef2 = endPointDef2;
+ public void setEndDef2(AtlasRelationshipEndDef endDef2) {
+ this.endDef2 = endDef2;
}
- public AtlasRelationshipEndPointDef getEndPointDef2() {
- return this.endPointDef2;
+ public AtlasRelationshipEndDef getEndDef2() {
+ return this.endDef2;
}
public AtlasRelationshipDef(AtlasRelationshipDef other) throws AtlasBaseException {
@@ -224,8 +225,8 @@ public class AtlasRelationshipDef extends AtlasStructDef implements java.io.Seri
if (other != null) {
setRelationshipCategory(other.getRelationshipCategory());
setPropagateTags(other.getPropagateTags());
- setEndPointDef1(other.getEndPointDef1());
- setEndPointDef2(other.getEndPointDef2());
+ setEndDef1(other.getEndDef1());
+ setEndDef2(other.getEndDef2());
}
}
@Override
@@ -241,9 +242,9 @@ public class AtlasRelationshipDef extends AtlasStructDef implements java.io.Seri
sb.append(',');
sb.append(this.propagateTags);
sb.append(',');
- sb.append(this.endPointDef1.toString());
+ sb.append(this.endDef1.toString());
sb.append(',');
- sb.append(this.endPointDef2.toString());
+ sb.append(this.endDef2.toString());
sb.append('}');
return sb;
}
@@ -262,14 +263,14 @@ public class AtlasRelationshipDef extends AtlasStructDef implements java.io.Seri
return false;
if (!Objects.equals(propagateTags, that.getPropagateTags()))
return false;
- if (!Objects.equals(endPointDef1, that.getEndPointDef1()))
+ if (!Objects.equals(endDef1, that.getEndDef1()))
return false;
- return (Objects.equals(endPointDef2, that.getEndPointDef2()));
+ return (Objects.equals(endDef2, that.getEndDef2()));
}
@Override
public int hashCode() {
- return Objects.hash(super.hashCode(), relationshipCategory, propagateTags, endPointDef1, endPointDef2);
+ return Objects.hash(super.hashCode(), relationshipCategory, propagateTags, endDef1, endDef2);
}
@Override
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1de6016d/intg/src/main/java/org/apache/atlas/model/typedef/AtlasRelationshipEndDef.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/model/typedef/AtlasRelationshipEndDef.java b/intg/src/main/java/org/apache/atlas/model/typedef/AtlasRelationshipEndDef.java
new file mode 100644
index 0000000..000d747
--- /dev/null
+++ b/intg/src/main/java/org/apache/atlas/model/typedef/AtlasRelationshipEndDef.java
@@ -0,0 +1,193 @@
+/**
+ * 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.typedef.AtlasStructDef.AtlasAttributeDef.Cardinality;
+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 java.io.Serializable;
+import java.util.Objects;
+
+import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.NONE;
+import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY;
+
+/**
+ * The relationshipEndDef represents an end of the relationship. The end of the relationship is defined by a type, an
+ * attribute name, cardinality and whether it is the container end of the relationship.
+ */
+@JsonAutoDetect(getterVisibility = PUBLIC_ONLY, setterVisibility = PUBLIC_ONLY, fieldVisibility = NONE)
+@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
+@JsonIgnoreProperties(ignoreUnknown = true)
+@XmlRootElement
+@XmlAccessorType(XmlAccessType.PROPERTY)
+public class AtlasRelationshipEndDef implements Serializable {
+ private static final long serialVersionUID = 1L;
+ /**
+ * The type associated with the end.
+ */
+ private String type;
+ /**
+ * The name of the attribute for this end
+ */
+ private String name;
+
+ /**
+ * When set this indicates that this end is the container end
+ */
+ private boolean isContainer;
+ /**
+ * This is the cardinality of the end
+ */
+ private Cardinality cardinality;
+
+ /**
+ * Base constructor
+ */
+ public AtlasRelationshipEndDef() {
+ this(null, null, Cardinality.SINGLE, false);
+ }
+
+ /**
+ *
+ * @param typeName
+ * - The name of an entityDef type
+ * @param name
+ * - The name of the new attribute that the entity instance will pick up.
+ * @param cardinality
+ * - this indicates whether the end is SINGLE (1) or SET (many)
+ */
+ public AtlasRelationshipEndDef(String typeName, String name, Cardinality cardinality) {
+ this(typeName, name, cardinality, false);
+ }
+
+ /**
+ *
+ * @param typeName
+ * - The name of an entityDef type
+ * @param name
+ * - The name of the new attribute that the entity instance will pick up.
+ * @param cardinality
+ * - whether the end is SINGLE (1) or SET (many)
+ * @param isContainer
+ * - whether the end is a container or not
+ */
+ public AtlasRelationshipEndDef(String typeName, String name, Cardinality cardinality, boolean isContainer) {
+ setType(typeName);
+ setName(name);
+ setCardinality(cardinality);
+ setIsContainer(isContainer);
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * set whether this end is a container or not.
+ * @param isContainer
+ */
+ public void setIsContainer(boolean isContainer) {
+ this.isContainer = isContainer;
+ }
+
+ public boolean getIsContainer() {
+ return isContainer;
+ }
+
+ /**
+ * set the cardinality SINGLE or SET on the end.
+ * @param cardinality
+ */
+ public void setCardinality(AtlasStructDef.AtlasAttributeDef.Cardinality cardinality) {
+ this.cardinality = cardinality;
+ }
+
+ /**
+ *
+ * @return the cardinality
+ */
+ public Cardinality getCardinality() {
+ return this.cardinality;
+ }
+
+ /**
+ * Construct using an existing AtlasRelationshipEndDef
+ * @param other
+ */
+ public AtlasRelationshipEndDef(AtlasRelationshipEndDef other) {
+ if (other != null) {
+ setType(other.getType());
+ setName(other.getName());
+ setIsContainer(other.getIsContainer());
+ setCardinality(other.getCardinality());
+ }
+ }
+
+ public StringBuilder toString(StringBuilder sb) {
+ if (sb == null) {
+ sb = new StringBuilder();
+ }
+
+ sb.append("AtlasRelationshipEndDef{");
+ sb.append("type='").append(type).append('\'');
+ sb.append(", name==>'").append(name).append('\'');
+ sb.append(", isContainer==>'").append(isContainer).append('\'');
+ sb.append(", cardinality==>'").append(cardinality).append('\'');
+ sb.append('}');
+
+ return sb;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (o == null || getClass() != o.getClass())
+ return false;
+ AtlasRelationshipEndDef that = (AtlasRelationshipEndDef) o;
+ return Objects.equals(type, that.type) && Objects.equals(name, that.name)
+ && (isContainer == that.isContainer) && (cardinality == that.cardinality);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(type, getName(), isContainer, cardinality);
+ }
+
+ @Override
+ public String toString() {
+ return toString(new StringBuilder()).toString();
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1de6016d/intg/src/main/java/org/apache/atlas/model/typedef/AtlasRelationshipEndPointDef.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/model/typedef/AtlasRelationshipEndPointDef.java b/intg/src/main/java/org/apache/atlas/model/typedef/AtlasRelationshipEndPointDef.java
deleted file mode 100644
index dde8416..0000000
--- a/intg/src/main/java/org/apache/atlas/model/typedef/AtlasRelationshipEndPointDef.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/**
- * 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.typedef.AtlasStructDef.AtlasAttributeDef.Cardinality;
-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 java.io.Serializable;
-import java.util.Objects;
-
-import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.NONE;
-import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY;
-
-/**
- * The relationshipEndPointsDef represents an end of the relationship. The end of the relationship is defined by a type, an
- * attribute name, cardinality and whether it is the container end of the relationship.
- */
-@JsonAutoDetect(getterVisibility = PUBLIC_ONLY, setterVisibility = PUBLIC_ONLY, fieldVisibility = NONE)
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-@JsonIgnoreProperties(ignoreUnknown = true)
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.PROPERTY)
-public class AtlasRelationshipEndPointDef implements Serializable {
- private static final long serialVersionUID = 1L;
- /**
- * The type associated with the endpoint.
- */
- private String type;
- /**
- * The name of the attribute for this endpoint
- */
- private String name;
-
- /**
- * When set this indicates that this end is the container end
- */
- private boolean isContainer;
- /**
- * This is the cardinality of the end point
- */
- private Cardinality cardinality;
-
- /**
- * Base constructor
- */
- public AtlasRelationshipEndPointDef() {
- this(null, null, Cardinality.SINGLE, false);
- }
-
- /**
- *
- * @param typeName
- * - The name of an entityDef type
- * @param name
- * - The name of the new attribute that the entity instance will pick up.
- * @param cardinality
- * - this indicates whether the end point is SINGLE (1) or SET (many)
- */
- public AtlasRelationshipEndPointDef(String typeName, String name, Cardinality cardinality) {
- this(typeName, name, cardinality, false);
- }
-
- /**
- *
- * @param typeName
- * - The name of an entityDef type
- * @param name
- * - The name of the new attribute that the entity instance will pick up.
- * @param cardinality
- * - whether the end point is SINGLE (1) or SET (many)
- * @param isContainer
- * - whether the end point is a container or not
- */
- public AtlasRelationshipEndPointDef(String typeName, String name, Cardinality cardinality, boolean isContainer) {
- setType(typeName);
- setName(name);
- setCardinality(cardinality);
- setIsContainer(isContainer);
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getType() {
- return type;
- }
-
- public String getName() {
- return this.name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * set whether this endpoint is a container or not.
- * @param isContainer
- */
- public void setIsContainer(boolean isContainer) {
- this.isContainer = isContainer;
- }
-
- public boolean getIsContainer() {
- return isContainer;
- }
-
- /**
- * set the cardinality SINGLE or SET on the endpoint.
- * @param cardinality
- */
- public void setCardinality(AtlasStructDef.AtlasAttributeDef.Cardinality cardinality) {
- this.cardinality = cardinality;
- }
-
- /**
- *
- * @return the cardinality
- */
- public Cardinality getCardinality() {
- return this.cardinality;
- }
-
- /**
- * Construct using an existing AtlasRelationshipEndPointDef
- * @param other
- */
- public AtlasRelationshipEndPointDef(AtlasRelationshipEndPointDef other) {
- if (other != null) {
- setType(other.getType());
- setName(other.getName());
- setIsContainer(other.getIsContainer());
- setCardinality(other.getCardinality());
- }
- }
-
- public StringBuilder toString(StringBuilder sb) {
- if (sb == null) {
- sb = new StringBuilder();
- }
-
- sb.append("AtlasRelationshipEndPointsDef{");
- sb.append("type='").append(type).append('\'');
- sb.append(", name==>'").append(name).append('\'');
- sb.append(", isContainer==>'").append(isContainer).append('\'');
- sb.append(", cardinality==>'").append(cardinality).append('\'');
- sb.append('}');
-
- return sb;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o)
- return true;
- if (o == null || getClass() != o.getClass())
- return false;
- AtlasRelationshipEndPointDef that = (AtlasRelationshipEndPointDef) o;
- return Objects.equals(type, that.type) && Objects.equals(name, that.name)
- && (isContainer == that.isContainer) && (cardinality == that.cardinality);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(type, getName(), isContainer, cardinality);
- }
-
- @Override
- public String toString() {
- return toString(new StringBuilder()).toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1de6016d/intg/src/main/java/org/apache/atlas/type/AtlasRelationshipType.java
----------------------------------------------------------------------
diff --git a/intg/src/main/java/org/apache/atlas/type/AtlasRelationshipType.java b/intg/src/main/java/org/apache/atlas/type/AtlasRelationshipType.java
index 6328108..eb2fc48 100644
--- a/intg/src/main/java/org/apache/atlas/type/AtlasRelationshipType.java
+++ b/intg/src/main/java/org/apache/atlas/type/AtlasRelationshipType.java
@@ -22,7 +22,7 @@ import org.apache.atlas.AtlasErrorCode;
import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.model.typedef.AtlasRelationshipDef;
import org.apache.atlas.model.typedef.AtlasRelationshipDef.RelationshipCategory;
-import org.apache.atlas.model.typedef.AtlasRelationshipEndPointDef;
+import org.apache.atlas.model.typedef.AtlasRelationshipEndDef;
import org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -103,49 +103,49 @@ public class AtlasRelationshipType extends AtlasStructType {
* @throws AtlasBaseException
*/
public static void validateAtlasRelationshipDef(AtlasRelationshipDef relationshipDef) throws AtlasBaseException {
- AtlasRelationshipEndPointDef endPointDef1 = relationshipDef.getEndPointDef1();
- AtlasRelationshipEndPointDef endPointDef2 = relationshipDef.getEndPointDef2();
- boolean isContainer1 = endPointDef1.getIsContainer();
- boolean isContainer2 = endPointDef2.getIsContainer();
- RelationshipCategory relationshipCategory = relationshipDef.getRelationshipCategory();
- String name = relationshipDef.getName();
+ AtlasRelationshipEndDef endDef1 = relationshipDef.getEndDef1();
+ AtlasRelationshipEndDef endDef2 = relationshipDef.getEndDef2();
+ boolean isContainer1 = endDef1.getIsContainer();
+ boolean isContainer2 = endDef2.getIsContainer();
+ RelationshipCategory relationshipCategory = relationshipDef.getRelationshipCategory();
+ String name = relationshipDef.getName();
if (isContainer1 && isContainer2) {
// we support 0 or 1 of these flags.
throw new AtlasBaseException(AtlasErrorCode.RELATIONSHIPDEF_DOUBLE_CONTAINERS, name);
}
if ((isContainer1 || isContainer2)) {
- // we have an isContainer defined in an endpoint
+ // we have an isContainer defined in an end
if (relationshipCategory == RelationshipCategory.ASSOCIATION) {
// associations are not containment relaitonships - so do not allow an endpoiint with isContainer
throw new AtlasBaseException(AtlasErrorCode.RELATIONSHIPDEF_ASSOCIATION_AND_CONTAINER, name);
}
} else {
- // we do not have an isContainer defined in an endpoint
+ // we do not have an isContainer defined in an end
if (relationshipCategory == RelationshipCategory.COMPOSITION) {
- // COMPOSITION needs one endpoint to be the container.
+ // COMPOSITION needs one end to be the container.
throw new AtlasBaseException(AtlasErrorCode.RELATIONSHIPDEF_COMPOSITION_NO_CONTAINER, name);
} else if (relationshipCategory == RelationshipCategory.AGGREGATION) {
- // AGGREGATION needs one endpoint to be the container.
+ // AGGREGATION needs one end to be the container.
throw new AtlasBaseException(AtlasErrorCode.RELATIONSHIPDEF_AGGREGATION_NO_CONTAINER, name);
}
}
if (relationshipCategory == RelationshipCategory.COMPOSITION) {
// composition containers should not be multiple cardinality
- if (endPointDef1 != null &&
- endPointDef1.getCardinality() == AtlasAttributeDef.Cardinality.SET &&
- endPointDef1.getIsContainer()) {
+ if (endDef1 != null &&
+ endDef1.getCardinality() == AtlasAttributeDef.Cardinality.SET &&
+ endDef1.getIsContainer()) {
throw new AtlasBaseException(AtlasErrorCode.RELATIONSHIPDEF_COMPOSITION_SET_CONTAINER, name);
}
- if (endPointDef2 != null && endPointDef2 != null &&
- endPointDef2.getCardinality() == AtlasAttributeDef.Cardinality.SET &&
- endPointDef2.getIsContainer()) {
+ if (endDef2 != null && endDef2 != null &&
+ endDef2.getCardinality() == AtlasAttributeDef.Cardinality.SET &&
+ endDef2.getIsContainer()) {
throw new AtlasBaseException(AtlasErrorCode.RELATIONSHIPDEF_COMPOSITION_SET_CONTAINER, name);
}
}
- if ((endPointDef1 != null && endPointDef1.getCardinality() == AtlasAttributeDef.Cardinality.LIST) ||
- (endPointDef2 != null && endPointDef2.getCardinality() == AtlasAttributeDef.Cardinality.LIST)) {
- throw new AtlasBaseException(AtlasErrorCode.RELATIONSHIPDEF_LIST_ON_ENDPOINT, name);
+ if ((endDef1 != null && endDef1.getCardinality() == AtlasAttributeDef.Cardinality.LIST) ||
+ (endDef2 != null && endDef2.getCardinality() == AtlasAttributeDef.Cardinality.LIST)) {
+ throw new AtlasBaseException(AtlasErrorCode.RELATIONSHIPDEF_LIST_ON_END, name);
}
}
-}
\ No newline at end of file
+}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1de6016d/intg/src/test/java/org/apache/atlas/model/typedef/TestAtlasRelationshipDef.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/model/typedef/TestAtlasRelationshipDef.java b/intg/src/test/java/org/apache/atlas/model/typedef/TestAtlasRelationshipDef.java
index 78efa6e..7989a24 100644
--- a/intg/src/test/java/org/apache/atlas/model/typedef/TestAtlasRelationshipDef.java
+++ b/intg/src/test/java/org/apache/atlas/model/typedef/TestAtlasRelationshipDef.java
@@ -38,8 +38,8 @@ public class TestAtlasRelationshipDef {
@Test
public void testRelationshipDefSerDeEmpty() throws AtlasBaseException {
- AtlasRelationshipEndPointDef ep1 = new AtlasRelationshipEndPointDef("typeA", "attr1", Cardinality.SINGLE);
- AtlasRelationshipEndPointDef ep2 = new AtlasRelationshipEndPointDef("typeB", "attr2", Cardinality.SINGLE);
+ AtlasRelationshipEndDef ep1 = new AtlasRelationshipEndDef("typeA", "attr1", Cardinality.SINGLE);
+ AtlasRelationshipEndDef ep2 = new AtlasRelationshipEndDef("typeB", "attr2", Cardinality.SINGLE);
AtlasRelationshipDef relationshipDef = new AtlasRelationshipDef("emptyRelationshipDef", "desc 1", "version1",
RelationshipCategory.ASSOCIATION, AtlasRelationshipDef.PropagateTags.ONE_TO_TWO, ep1, ep2);
@@ -58,8 +58,8 @@ public class TestAtlasRelationshipDef {
@Test
public void testRelationshipDefSerDeAttributes() throws AtlasBaseException {
- AtlasRelationshipEndPointDef ep1 = new AtlasRelationshipEndPointDef("typeA", "attr1", Cardinality.SINGLE);
- AtlasRelationshipEndPointDef ep2 = new AtlasRelationshipEndPointDef("typeB", "attr2", Cardinality.SINGLE);
+ AtlasRelationshipEndDef ep1 = new AtlasRelationshipEndDef("typeA", "attr1", Cardinality.SINGLE);
+ AtlasRelationshipEndDef ep2 = new AtlasRelationshipEndDef("typeB", "attr2", Cardinality.SINGLE);
AtlasRelationshipDef relationshipDef = new AtlasRelationshipDef("emptyRelationshipDef", "desc 1", "version1",
RelationshipCategory.ASSOCIATION, AtlasRelationshipDef.PropagateTags.ONE_TO_TWO, ep1, ep2);
relationshipDef.setAttributeDefs(
@@ -77,8 +77,8 @@ public class TestAtlasRelationshipDef {
@Test
public void testRelationshipEquals() throws AtlasBaseException {
- AtlasRelationshipEndPointDef ep1 = new AtlasRelationshipEndPointDef("typeA", "attr1", Cardinality.SINGLE);
- AtlasRelationshipEndPointDef ep2 = new AtlasRelationshipEndPointDef("typeB", "attr2", Cardinality.SINGLE);
+ AtlasRelationshipEndDef ep1 = new AtlasRelationshipEndDef("typeA", "attr1", Cardinality.SINGLE);
+ AtlasRelationshipEndDef ep2 = new AtlasRelationshipEndDef("typeB", "attr2", Cardinality.SINGLE);
AtlasRelationshipDef relationshipDef1 = new AtlasRelationshipDef("emptyRelationshipDef", "desc 1", "version1",
RelationshipCategory.ASSOCIATION, AtlasRelationshipDef.PropagateTags.ONE_TO_TWO, ep1, ep2);
List<AtlasStructDef.AtlasAttributeDef> attributeDefs = ModelTestUtil.newAttributeDefsWithAllBuiltInTypesForRelationship(PREFIX_ATTRIBUTE_NAME);
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1de6016d/intg/src/test/java/org/apache/atlas/type/TestAtlasRelationshipType.java
----------------------------------------------------------------------
diff --git a/intg/src/test/java/org/apache/atlas/type/TestAtlasRelationshipType.java b/intg/src/test/java/org/apache/atlas/type/TestAtlasRelationshipType.java
index 6af374a..7a4e9fd 100644
--- a/intg/src/test/java/org/apache/atlas/type/TestAtlasRelationshipType.java
+++ b/intg/src/test/java/org/apache/atlas/type/TestAtlasRelationshipType.java
@@ -20,20 +20,20 @@ package org.apache.atlas.type;
import org.apache.atlas.AtlasErrorCode;
import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.model.typedef.AtlasRelationshipDef;
-import org.apache.atlas.model.typedef.AtlasRelationshipEndPointDef;
+import org.apache.atlas.model.typedef.AtlasRelationshipEndDef;
import org.apache.atlas.model.typedef.AtlasStructDef;
import org.testng.annotations.Test;
-import static org.testng.AssertJUnit.fail;
+import static org.testng.Assert.fail;
public class TestAtlasRelationshipType {
@Test
public void testvalidateAtlasRelationshipDef() throws AtlasBaseException {
- AtlasRelationshipEndPointDef ep1 = new AtlasRelationshipEndPointDef("typeA", "attr1", AtlasStructDef.AtlasAttributeDef.Cardinality.SINGLE);
- AtlasRelationshipEndPointDef ep2 = new AtlasRelationshipEndPointDef("typeB", "attr2", AtlasStructDef.AtlasAttributeDef.Cardinality.SINGLE);
- AtlasRelationshipEndPointDef ep3 = new AtlasRelationshipEndPointDef("typeC", "attr2", AtlasStructDef.AtlasAttributeDef.Cardinality.SINGLE, true);
- AtlasRelationshipEndPointDef ep4 = new AtlasRelationshipEndPointDef("typeD", "attr2", AtlasStructDef.AtlasAttributeDef.Cardinality.SINGLE, true);
- AtlasRelationshipEndPointDef ep5 = new AtlasRelationshipEndPointDef("typeA", "attr1", AtlasStructDef.AtlasAttributeDef.Cardinality.SET,true);
- AtlasRelationshipEndPointDef ep6 = new AtlasRelationshipEndPointDef("typeA", "attr1", AtlasStructDef.AtlasAttributeDef.Cardinality.LIST,true);
+ AtlasRelationshipEndDef ep1 = new AtlasRelationshipEndDef("typeA", "attr1", AtlasStructDef.AtlasAttributeDef.Cardinality.SINGLE);
+ AtlasRelationshipEndDef ep2 = new AtlasRelationshipEndDef("typeB", "attr2", AtlasStructDef.AtlasAttributeDef.Cardinality.SINGLE);
+ AtlasRelationshipEndDef ep3 = new AtlasRelationshipEndDef("typeC", "attr2", AtlasStructDef.AtlasAttributeDef.Cardinality.SINGLE, true);
+ AtlasRelationshipEndDef ep4 = new AtlasRelationshipEndDef("typeD", "attr2", AtlasStructDef.AtlasAttributeDef.Cardinality.SINGLE, true);
+ AtlasRelationshipEndDef ep5 = new AtlasRelationshipEndDef("typeA", "attr1", AtlasStructDef.AtlasAttributeDef.Cardinality.SET,true);
+ AtlasRelationshipEndDef ep6 = new AtlasRelationshipEndDef("typeA", "attr1", AtlasStructDef.AtlasAttributeDef.Cardinality.LIST,true);
AtlasRelationshipDef relationshipDef1 = new AtlasRelationshipDef("emptyRelationshipDef", "desc 1", "version1",
AtlasRelationshipDef.RelationshipCategory.ASSOCIATION, AtlasRelationshipDef.PropagateTags.ONE_TO_TWO, ep1, ep2);
AtlasRelationshipDef relationshipDef2 = new AtlasRelationshipDef("emptyRelationshipDef", "desc 1", "version1",
@@ -88,7 +88,7 @@ public class TestAtlasRelationshipType {
AtlasRelationshipType.validateAtlasRelationshipDef(relationshipDef);
fail("This call is expected to fail");
} catch (AtlasBaseException abe) {
- if (!abe.getAtlasErrorCode().equals(AtlasErrorCode.RELATIONSHIPDEF_LIST_ON_ENDPOINT)) {
+ if (!abe.getAtlasErrorCode().equals(AtlasErrorCode.RELATIONSHIPDEF_LIST_ON_END)) {
fail("This call expected a different error");
}
}
@@ -98,7 +98,7 @@ public class TestAtlasRelationshipType {
AtlasRelationshipType.validateAtlasRelationshipDef(relationshipDef);
fail("This call is expected to fail");
} catch (AtlasBaseException abe) {
- if (!abe.getAtlasErrorCode().equals(AtlasErrorCode.RELATIONSHIPDEF_LIST_ON_ENDPOINT)) {
+ if (!abe.getAtlasErrorCode().equals(AtlasErrorCode.RELATIONSHIPDEF_LIST_ON_END)) {
fail("This call expected a different error");
}
}
http://git-wip-us.apache.org/repos/asf/incubator-atlas/blob/1de6016d/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasRelationshipDefStoreV1.java
----------------------------------------------------------------------
diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasRelationshipDefStoreV1.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasRelationshipDefStoreV1.java
index 96cd8d1..6992e22 100644
--- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasRelationshipDefStoreV1.java
+++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v1/AtlasRelationshipDefStoreV1.java
@@ -22,7 +22,7 @@ import org.apache.atlas.exception.AtlasBaseException;
import org.apache.atlas.model.typedef.AtlasRelationshipDef;
import org.apache.atlas.model.typedef.AtlasRelationshipDef.RelationshipCategory;
import org.apache.atlas.model.typedef.AtlasRelationshipDef.PropagateTags;
-import org.apache.atlas.model.typedef.AtlasRelationshipEndPointDef;
+import org.apache.atlas.model.typedef.AtlasRelationshipEndDef;
import org.apache.atlas.repository.Constants;
import org.apache.atlas.repository.graphdb.AtlasVertex;
import org.apache.atlas.repository.store.graph.AtlasRelationshipDefStore;
@@ -347,9 +347,9 @@ public class AtlasRelationshipDefStoreV1 extends AtlasAbstractDefStoreV1 impleme
private void updateVertexPreCreate(AtlasRelationshipDef relationshipDef, AtlasRelationshipType relationshipType,
AtlasVertex vertex) throws AtlasBaseException {
AtlasStructDefStoreV1.updateVertexPreCreate(relationshipDef, relationshipType, vertex, typeDefStore);
- // Update endpoints
- vertex.setProperty(Constants.RELATIONSHIPTYPE_ENDPOINT1_KEY, AtlasType.toJson(relationshipDef.getEndPointDef1()));
- vertex.setProperty(Constants.RELATIONSHIPTYPE_ENDPOINT2_KEY, AtlasType.toJson(relationshipDef.getEndPointDef2()));
+ // Update ends
+ vertex.setProperty(Constants.RELATIONSHIPTYPE_END1_KEY, AtlasType.toJson(relationshipDef.getEndDef1()));
+ vertex.setProperty(Constants.RELATIONSHIPTYPE_END2_KEY, AtlasType.toJson(relationshipDef.getEndDef2()));
// Update RelationshipCategory
vertex.setProperty(Constants.RELATIONSHIPTYPE_CATEGORY_KEY, relationshipDef.getRelationshipCategory().name());
vertex.setProperty(Constants.RELATIONSHIPTYPE_TAG_PROPAGATION_KEY, relationshipDef.getPropagateTags().name());
@@ -358,8 +358,8 @@ public class AtlasRelationshipDefStoreV1 extends AtlasAbstractDefStoreV1 impleme
private void updateVertexPreUpdate(AtlasRelationshipDef relationshipDef, AtlasRelationshipType relationshipType,
AtlasVertex vertex) throws AtlasBaseException {
AtlasStructDefStoreV1.updateVertexPreUpdate(relationshipDef, relationshipType, vertex, typeDefStore);
- vertex.setProperty(Constants.RELATIONSHIPTYPE_ENDPOINT1_KEY, AtlasType.toJson(relationshipDef.getEndPointDef1()));
- vertex.setProperty(Constants.RELATIONSHIPTYPE_ENDPOINT2_KEY, AtlasType.toJson(relationshipDef.getEndPointDef2()));
+ vertex.setProperty(Constants.RELATIONSHIPTYPE_END1_KEY, AtlasType.toJson(relationshipDef.getEndDef1()));
+ vertex.setProperty(Constants.RELATIONSHIPTYPE_END2_KEY, AtlasType.toJson(relationshipDef.getEndDef2()));
// Update RelationshipCategory
vertex.setProperty(Constants.RELATIONSHIPTYPE_CATEGORY_KEY, relationshipDef.getRelationshipCategory().name());
vertex.setProperty(Constants.RELATIONSHIPTYPE_TAG_PROPAGATION_KEY, relationshipDef.getPropagateTags().name());
@@ -372,14 +372,14 @@ public class AtlasRelationshipDefStoreV1 extends AtlasAbstractDefStoreV1 impleme
String name = vertex.getProperty(Constants.TYPENAME_PROPERTY_KEY, String.class);
String description = vertex.getProperty(Constants.TYPEDESCRIPTION_PROPERTY_KEY, String.class);
String version = vertex.getProperty(Constants.TYPEVERSION_PROPERTY_KEY, String.class);
- String endPoint1Str = vertex.getProperty(Constants.RELATIONSHIPTYPE_ENDPOINT1_KEY, String.class);
- String endPoint2Str = vertex.getProperty(Constants.RELATIONSHIPTYPE_ENDPOINT2_KEY, String.class);
+ String end1Str = vertex.getProperty(Constants.RELATIONSHIPTYPE_END1_KEY, String.class);
+ String end2Str = vertex.getProperty(Constants.RELATIONSHIPTYPE_END2_KEY, String.class);
String relationStr = vertex.getProperty(Constants.RELATIONSHIPTYPE_CATEGORY_KEY, String.class);
String propagateStr = vertex.getProperty(Constants.RELATIONSHIPTYPE_TAG_PROPAGATION_KEY, String.class);
- // set the endpoints
- AtlasRelationshipEndPointDef endPointDef1 = AtlasType.fromJson(endPoint1Str, AtlasRelationshipEndPointDef.class);
- AtlasRelationshipEndPointDef endPointDef2 = AtlasType.fromJson(endPoint2Str, AtlasRelationshipEndPointDef.class);
+ // set the ends
+ AtlasRelationshipEndDef endDef1 = AtlasType.fromJson(end1Str, AtlasRelationshipEndDef.class);
+ AtlasRelationshipEndDef endDef2 = AtlasType.fromJson(end2Str, AtlasRelationshipEndDef.class);
// set the relationship Category
RelationshipCategory relationshipCategory = null;
@@ -397,7 +397,7 @@ public class AtlasRelationshipDefStoreV1 extends AtlasAbstractDefStoreV1 impleme
}
}
- ret = new AtlasRelationshipDef(name, description, version, relationshipCategory, propagateTags, endPointDef1, endPointDef2);
+ ret = new AtlasRelationshipDef(name, description, version, relationshipCategory, propagateTags, endDef1, endDef2);
// add in the attributes
AtlasStructDefStoreV1.toStructDef(vertex, ret, typeDefStore);