ATLAS-1873: renamed AtlasRelationshipEndPoint to AtlasRelationshipEnd
Signed-off-by: Madhan Neethiraj <madhan@apache.org>
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 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";
/**
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 @@
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"),
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 @@
* 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 @@
* 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 @@
* 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 @@
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 @@
* 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 @@
* 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 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 @@
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 @@
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 @@
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 @@
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
diff --git a/intg/src/main/java/org/apache/atlas/model/typedef/AtlasRelationshipEndPointDef.java b/intg/src/main/java/org/apache/atlas/model/typedef/AtlasRelationshipEndDef.java
similarity index 80%
rename from intg/src/main/java/org/apache/atlas/model/typedef/AtlasRelationshipEndPointDef.java
rename to intg/src/main/java/org/apache/atlas/model/typedef/AtlasRelationshipEndDef.java
index dde8416..000d747 100644
--- a/intg/src/main/java/org/apache/atlas/model/typedef/AtlasRelationshipEndPointDef.java
+++ b/intg/src/main/java/org/apache/atlas/model/typedef/AtlasRelationshipEndDef.java
@@ -32,7 +32,7 @@
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
+ * 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)
@@ -40,14 +40,14 @@
@JsonIgnoreProperties(ignoreUnknown = true)
@XmlRootElement
@XmlAccessorType(XmlAccessType.PROPERTY)
-public class AtlasRelationshipEndPointDef implements Serializable {
+public class AtlasRelationshipEndDef implements Serializable {
private static final long serialVersionUID = 1L;
/**
- * The type associated with the endpoint.
+ * The type associated with the end.
*/
private String type;
/**
- * The name of the attribute for this endpoint
+ * The name of the attribute for this end
*/
private String name;
@@ -56,14 +56,14 @@
*/
private boolean isContainer;
/**
- * This is the cardinality of the end point
+ * This is the cardinality of the end
*/
private Cardinality cardinality;
/**
* Base constructor
*/
- public AtlasRelationshipEndPointDef() {
+ public AtlasRelationshipEndDef() {
this(null, null, Cardinality.SINGLE, false);
}
@@ -74,9 +74,9 @@
* @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)
+ * - this indicates whether the end is SINGLE (1) or SET (many)
*/
- public AtlasRelationshipEndPointDef(String typeName, String name, Cardinality cardinality) {
+ public AtlasRelationshipEndDef(String typeName, String name, Cardinality cardinality) {
this(typeName, name, cardinality, false);
}
@@ -87,11 +87,11 @@
* @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)
+ * - whether the end is SINGLE (1) or SET (many)
* @param isContainer
- * - whether the end point is a container or not
+ * - whether the end is a container or not
*/
- public AtlasRelationshipEndPointDef(String typeName, String name, Cardinality cardinality, boolean isContainer) {
+ public AtlasRelationshipEndDef(String typeName, String name, Cardinality cardinality, boolean isContainer) {
setType(typeName);
setName(name);
setCardinality(cardinality);
@@ -115,7 +115,7 @@
}
/**
- * set whether this endpoint is a container or not.
+ * set whether this end is a container or not.
* @param isContainer
*/
public void setIsContainer(boolean isContainer) {
@@ -127,7 +127,7 @@
}
/**
- * set the cardinality SINGLE or SET on the endpoint.
+ * set the cardinality SINGLE or SET on the end.
* @param cardinality
*/
public void setCardinality(AtlasStructDef.AtlasAttributeDef.Cardinality cardinality) {
@@ -143,10 +143,10 @@
}
/**
- * Construct using an existing AtlasRelationshipEndPointDef
+ * Construct using an existing AtlasRelationshipEndDef
* @param other
*/
- public AtlasRelationshipEndPointDef(AtlasRelationshipEndPointDef other) {
+ public AtlasRelationshipEndDef(AtlasRelationshipEndDef other) {
if (other != null) {
setType(other.getType());
setName(other.getName());
@@ -160,7 +160,7 @@
sb = new StringBuilder();
}
- sb.append("AtlasRelationshipEndPointsDef{");
+ sb.append("AtlasRelationshipEndDef{");
sb.append("type='").append(type).append('\'');
sb.append(", name==>'").append(name).append('\'');
sb.append(", isContainer==>'").append(isContainer).append('\'');
@@ -176,7 +176,7 @@
return true;
if (o == null || getClass() != o.getClass())
return false;
- AtlasRelationshipEndPointDef that = (AtlasRelationshipEndPointDef) o;
+ AtlasRelationshipEndDef that = (AtlasRelationshipEndDef) o;
return Objects.equals(type, that.type) && Objects.equals(name, that.name)
&& (isContainer == that.isContainer) && (cardinality == that.cardinality);
}
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.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 @@
* @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
+}
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 @@
@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 @@
@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 @@
@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);
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 @@
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 @@
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 @@
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");
}
}
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.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 @@
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 @@
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 @@
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 @@
}
}
- 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);