This is an automated email from the ASF dual-hosted git repository. madhan pushed a commit to branch branch-1.0 in repository https://gitbox.apache.org/repos/asf/atlas.git
The following commit(s) were added to refs/heads/branch-1.0 by this push: new b107d3f ATLAS-3084: setting default value to the relationship attributes b107d3f is described below commit b107d3f30392f866afad41e18f47598371b782c3 Author: kirankumar D G <kirankuma...@gmail.com> AuthorDate: Wed Apr 10 14:56:11 2019 -0700 ATLAS-3084: setting default value to the relationship attributes Signed-off-by: Madhan Neethiraj <mad...@apache.org> (cherry picked from commit f070d924ddee55259ea1d74c7a0b8e87cea2a75d) --- .../repository/store/graph/v2/AtlasRelationshipStoreV2.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasRelationshipStoreV2.java b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasRelationshipStoreV2.java index b777dc3..5721ca0 100644 --- a/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasRelationshipStoreV2.java +++ b/repository/src/main/java/org/apache/atlas/repository/store/graph/v2/AtlasRelationshipStoreV2.java @@ -427,6 +427,16 @@ public class AtlasRelationshipStoreV2 implements AtlasRelationshipStore { if (relationship.hasAttribute(attrName)) { AtlasGraphUtilsV2.setEncodedProperty(relationshipEdge, attrVertexProperty, relationship.getAttribute(attrName)); + } else { + String defaultValue = attr.getAttributeDef().getDefaultValue(); + + if (StringUtils.isNotEmpty(defaultValue)) { + Object attrValue = attr.getAttributeType().createDefaultValue(defaultValue); + + if (attrValue != null) { + AtlasGraphUtilsV2.setEncodedProperty(relationshipEdge, attrVertexProperty, attrValue); + } + } } } } @@ -873,4 +883,4 @@ public class AtlasRelationshipStoreV2 implements AtlasRelationshipStore { return (attribute != null) ? attribute.getRelationshipEdgeLabel() : null; } -} \ No newline at end of file +}