private void clearRelationshipAttributes(AtlasEntity entity) { if (entity != null && entity.getRelationshipAttributes() != null) { entity.getRelationshipAttributes().clear(); } } }
private void clearRelationshipAttributes(AtlasEntity entity) { if (entity != null && entity.getRelationshipAttributes() != null) { entity.getRelationshipAttributes().clear(); } } }
private void clearRelationshipAttributes(AtlasEntity entity) { if (entity != null && entity.getRelationshipAttributes() != null) { entity.getRelationshipAttributes().clear(); } }
private static void compactAttributes(AtlasEntity entity) { if (entity != null) { Map<String, Object> relationshipAttributes = entity.getRelationshipAttributes(); Map<String, Object> attributes = entity.getAttributes(); if (MapUtils.isNotEmpty(relationshipAttributes) && MapUtils.isNotEmpty(attributes)) { for (String attrName : relationshipAttributes.keySet()) { if (attributes.containsKey(attrName)) { entity.removeAttribute(attrName); } } } } }
private static void compactAttributes(AtlasEntity entity) { if (entity != null) { Map<String, Object> relationshipAttributes = entity.getRelationshipAttributes(); Map<String, Object> attributes = entity.getAttributes(); if (MapUtils.isNotEmpty(relationshipAttributes) && MapUtils.isNotEmpty(attributes)) { for (String attrName : relationshipAttributes.keySet()) { if (attributes.containsKey(attrName)) { entity.removeAttribute(attrName); } } } } }
@Test(dataProvider = "stocks-legacy") public void importLegacy(ZipSource zipSource) throws IOException, AtlasBaseException { loadBaseModel(); loadFsModel(); loadHiveModel(); runImportWithNoParameters(importService, zipSource); List<AtlasEntityHeader> result = getImportedEntities("hive_db", "886c5e9c-3ac6-40be-8201-fb0cebb64783"); assertEquals(result.size(), 1); AtlasEntity.AtlasEntityWithExtInfo entityWithExtInfo = getEntity(result.get(0)); Map<String, Object> relationshipAttributes = entityWithExtInfo.getEntity().getRelationshipAttributes(); assertNotNull(relationshipAttributes); assertNotNull(relationshipAttributes.get("tables")); List<AtlasRelatedObjectId> relatedList = (List<AtlasRelatedObjectId>) relationshipAttributes.get("tables"); AtlasRelatedObjectId relatedObjectId = relatedList.get(0); assertNotNull(relatedObjectId.getRelationshipGuid()); }
private void mapRelationshipAttributes(AtlasEntity entity, AtlasVertex vertex, EntityOperation op, EntityMutationContext context) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> mapRelationshipAttributes({}, {})", op, entity.getTypeName()); } if (MapUtils.isNotEmpty(entity.getRelationshipAttributes())) { AtlasEntityType entityType = getEntityType(entity.getTypeName()); if (op.equals(CREATE)) { for (AtlasAttribute attribute : entityType.getRelationshipAttributes().values()) { Object attrValue = entity.getRelationshipAttribute(attribute.getName()); mapAttribute(attribute, attrValue, vertex, op, context); } } else if (op.equals(UPDATE)) { // relationship attributes mapping for (AtlasAttribute attribute : entityType.getRelationshipAttributes().values()) { if (attribute != null && entity.hasRelationshipAttribute(attribute.getName())) { Object attrValue = entity.getRelationshipAttribute(attribute.getName()); mapAttribute(attribute, attrValue, vertex, op, context); } } } updateModificationMetadata(vertex); } if (LOG.isDebugEnabled()) { LOG.debug("<== mapRelationshipAttributes({}, {})", op, entity.getTypeName()); } }
private void mapRelationshipAttributes(AtlasEntity entity, AtlasVertex vertex, EntityOperation op, EntityMutationContext context) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> mapRelationshipAttributes({}, {})", op, entity.getTypeName()); } if (MapUtils.isNotEmpty(entity.getRelationshipAttributes())) { MetricRecorder metric = RequestContext.get().startMetricRecord("mapRelationshipAttributes"); AtlasEntityType entityType = getEntityType(entity.getTypeName()); if (op.equals(CREATE)) { for (AtlasAttribute attribute : entityType.getRelationshipAttributes().values()) { Object attrValue = entity.getRelationshipAttribute(attribute.getName()); mapAttribute(attribute, attrValue, vertex, op, context); } } else if (op.equals(UPDATE)) { // relationship attributes mapping for (AtlasAttribute attribute : entityType.getRelationshipAttributes().values()) { if (attribute != null && entity.hasRelationshipAttribute(attribute.getName())) { Object attrValue = entity.getRelationshipAttribute(attribute.getName()); mapAttribute(attribute, attrValue, vertex, op, context); } } } updateModificationMetadata(vertex); RequestContext.get().endMetricRecord(metric); } if (LOG.isDebugEnabled()) { LOG.debug("<== mapRelationshipAttributes({}, {})", op, entity.getTypeName()); } }
boolean hasUpdates = false; if (MapUtils.isNotEmpty(entity.getRelationshipAttributes())) { hasUpdates = true; // if relationship attributes are provided, assume there is an update
Map<String, Object> relAttrValues = entity.getRelationshipAttributes();
Map<String, Object> relAttrValues = entity.getRelationshipAttributes();