private void updateRelationshipAttributes(AtlasRelationship relationship, AtlasRelatedObjectId relatedObjectId) { AtlasStruct relationshipAttributes = relatedObjectId.getRelationshipAttributes(); if (Objects.nonNull(relationshipAttributes)) { for (Map.Entry<String, Object> attrEntry : relationshipAttributes.getAttributes().entrySet()) { relationship.setAttribute(attrEntry.getKey(), attrEntry.getValue()); } } }
private void updateRelationshipAttributes(AtlasRelationship relationship, AtlasRelatedObjectId relatedObjectId) { AtlasStruct relationshipAttributes = relatedObjectId.getRelationshipAttributes(); if (Objects.nonNull(relationshipAttributes)) { for (Map.Entry<String, Object> attrEntry : relationshipAttributes.getAttributes().entrySet()) { relationship.setAttribute(attrEntry.getKey(), attrEntry.getValue()); } } }
private static Map<String, Object> getRelationshipAttributes(Object val) throws AtlasBaseException { if (val instanceof AtlasRelatedObjectId) { AtlasStruct relationshipStruct = ((AtlasRelatedObjectId) val).getRelationshipAttributes(); return (relationshipStruct != null) ? relationshipStruct.getAttributes() : null; } else if (val instanceof Map) { Object relationshipStruct = ((Map) val).get(KEY_RELATIONSHIP_ATTRIBUTES); if (relationshipStruct instanceof Map) { return AtlasTypeUtil.toStructAttributes(((Map) relationshipStruct)); } } return null; }
private static Map<String, Object> getRelationshipAttributes(Object val) throws AtlasBaseException { if (val instanceof AtlasRelatedObjectId) { AtlasStruct relationshipStruct = ((AtlasRelatedObjectId) val).getRelationshipAttributes(); return (relationshipStruct != null) ? relationshipStruct.getAttributes() : null; } else if (val instanceof Map) { Object relationshipStruct = ((Map) val).get(KEY_RELATIONSHIP_ATTRIBUTES); if (relationshipStruct instanceof Map) { return AtlasTypeUtil.toStructAttributes(((Map) relationshipStruct)); } } return null; }
public AtlasStruct(AtlasStruct other) { if (other != null) { setTypeName(other.getTypeName()); setAttributes(new HashMap<>(other.getAttributes())); } }
public AtlasStruct(AtlasStruct other) { if (other != null) { setTypeName(other.getTypeName()); setAttributes(new HashMap<>(other.getAttributes())); } }
private AtlasRelationship defineTermAssignment(String termGuid, AtlasRelatedObjectId relatedObjectId) { AtlasRelationshipType relationshipType = typeRegistry.getRelationshipTypeByName(TERM_ASSIGNMENT); AtlasStruct defaultAttrs = relationshipType.createDefaultValue(); AtlasObjectId end1 = new AtlasObjectId(termGuid); AtlasRelationship relationship = new AtlasRelationship(TERM_ASSIGNMENT, end1, relatedObjectId, defaultAttrs.getAttributes()); updateRelationshipAttributes(relationship, relatedObjectId); return relationship; }
private AtlasRelationship defineTermAssignment(String termGuid, AtlasRelatedObjectId relatedObjectId) { AtlasRelationshipType relationshipType = typeRegistry.getRelationshipTypeByName(TERM_ASSIGNMENT); AtlasStruct defaultAttrs = relationshipType.createDefaultValue(); AtlasObjectId end1 = new AtlasObjectId(termGuid); AtlasRelationship relationship = new AtlasRelationship(TERM_ASSIGNMENT, end1, relatedObjectId, defaultAttrs.getAttributes()); updateRelationshipAttributes(relationship, relatedObjectId); return relationship; }
private AtlasRelationship defineCategoryAnchorRelation(String glossaryGuid, String categoryGuid) { AtlasRelationshipType relationshipType = typeRegistry.getRelationshipTypeByName(CATEGORY_ANCHOR); AtlasStruct defaultAttrs = relationshipType.createDefaultValue(); return new AtlasRelationship(CATEGORY_ANCHOR, new AtlasObjectId(glossaryGuid), new AtlasObjectId(categoryGuid), defaultAttrs.getAttributes()); }
private AtlasRelationship defineTermAnchorRelation(String glossaryGuid, String termGuid) { AtlasRelationshipType relationshipType = typeRegistry.getRelationshipTypeByName(TERM_ANCHOR); AtlasStruct defaultAttrs = relationshipType.createDefaultValue(); return new AtlasRelationship(TERM_ANCHOR, new AtlasObjectId(glossaryGuid), new AtlasObjectId(termGuid), defaultAttrs.getAttributes()); }
private AtlasRelationship defineCategoryAnchorRelation(String glossaryGuid, String categoryGuid) { AtlasRelationshipType relationshipType = typeRegistry.getRelationshipTypeByName(CATEGORY_ANCHOR); AtlasStruct defaultAttrs = relationshipType.createDefaultValue(); return new AtlasRelationship(CATEGORY_ANCHOR, new AtlasObjectId(glossaryGuid), new AtlasObjectId(categoryGuid), defaultAttrs.getAttributes()); }
private AtlasRelationship defineTermAnchorRelation(String glossaryGuid, String termGuid) { AtlasRelationshipType relationshipType = typeRegistry.getRelationshipTypeByName(TERM_ANCHOR); AtlasStruct defaultAttrs = relationshipType.createDefaultValue(); return new AtlasRelationship(TERM_ANCHOR, new AtlasObjectId(glossaryGuid), new AtlasObjectId(termGuid), defaultAttrs.getAttributes()); }
private AtlasRelationship defineCategoryHierarchyLink(AtlasRelatedCategoryHeader parentCategory, String childGuid) { AtlasRelationshipType relationshipType = typeRegistry.getRelationshipTypeByName(CATEGORY_HIERARCHY); AtlasStruct defaultAttrs = relationshipType.createDefaultValue(); AtlasRelationship relationship = new AtlasRelationship(CATEGORY_HIERARCHY, new AtlasObjectId(parentCategory.getCategoryGuid()), new AtlasObjectId(childGuid), defaultAttrs.getAttributes()); updateRelationshipAttributes(relationship, parentCategory); return relationship; }
private AtlasRelationship defineCategoryHierarchyLink(String parentCategoryGuid, AtlasRelatedCategoryHeader childCategory) { AtlasRelationshipType relationshipType = typeRegistry.getRelationshipTypeByName(CATEGORY_HIERARCHY); AtlasStruct defaultAttrs = relationshipType.createDefaultValue(); AtlasRelationship relationship = new AtlasRelationship(CATEGORY_HIERARCHY, new AtlasObjectId(parentCategoryGuid), new AtlasObjectId(childCategory.getCategoryGuid()), defaultAttrs.getAttributes()); updateRelationshipAttributes(relationship, childCategory); return relationship; }
private AtlasRelationship defineCategoryHierarchyLink(AtlasRelatedCategoryHeader parentCategory, String childGuid) { AtlasRelationshipType relationshipType = typeRegistry.getRelationshipTypeByName(CATEGORY_HIERARCHY); AtlasStruct defaultAttrs = relationshipType.createDefaultValue(); AtlasRelationship relationship = new AtlasRelationship(CATEGORY_HIERARCHY, new AtlasObjectId(parentCategory.getCategoryGuid()), new AtlasObjectId(childGuid), defaultAttrs.getAttributes()); updateRelationshipAttributes(relationship, parentCategory); return relationship; }
private AtlasRelationship defineCategorizedTerm(String categoryGuid, AtlasRelatedTermHeader relatedTermId) { AtlasRelationshipType relationshipType = typeRegistry.getRelationshipTypeByName(TERM_CATEGORIZATION); AtlasStruct defaultAttrs = relationshipType.createDefaultValue(); AtlasRelationship relationship = new AtlasRelationship(TERM_CATEGORIZATION, new AtlasObjectId(categoryGuid), new AtlasObjectId(relatedTermId.getTermGuid()), defaultAttrs.getAttributes()); updateRelationshipAttributes(relationship, relatedTermId); return relationship; }
private AtlasRelationship defineCategorizedTerm(AtlasTermCategorizationHeader relatedCategoryId, String termId) { AtlasRelationshipType relationshipType = typeRegistry.getRelationshipTypeByName(TERM_CATEGORIZATION); AtlasStruct defaultAttrs = relationshipType.createDefaultValue(); AtlasRelationship relationship = new AtlasRelationship(TERM_CATEGORIZATION, new AtlasObjectId(relatedCategoryId.getCategoryGuid()), new AtlasObjectId(termId), defaultAttrs.getAttributes()); updateRelationshipAttributes(relationship, relatedCategoryId); return relationship; }
private AtlasRelationship defineCategorizedTerm(String categoryGuid, AtlasRelatedTermHeader relatedTermId) { AtlasRelationshipType relationshipType = typeRegistry.getRelationshipTypeByName(TERM_CATEGORIZATION); AtlasStruct defaultAttrs = relationshipType.createDefaultValue(); AtlasRelationship relationship = new AtlasRelationship(TERM_CATEGORIZATION, new AtlasObjectId(categoryGuid), new AtlasObjectId(relatedTermId.getTermGuid()), defaultAttrs.getAttributes()); updateRelationshipAttributes(relationship, relatedTermId); return relationship; }
private AtlasRelationship defineCategoryHierarchyLink(String parentCategoryGuid, AtlasRelatedCategoryHeader childCategory) { AtlasRelationshipType relationshipType = typeRegistry.getRelationshipTypeByName(CATEGORY_HIERARCHY); AtlasStruct defaultAttrs = relationshipType.createDefaultValue(); AtlasRelationship relationship = new AtlasRelationship(CATEGORY_HIERARCHY, new AtlasObjectId(parentCategoryGuid), new AtlasObjectId(childCategory.getCategoryGuid()), defaultAttrs.getAttributes()); updateRelationshipAttributes(relationship, childCategory); return relationship; }
private AtlasRelationship defineCategorizedTerm(AtlasTermCategorizationHeader relatedCategoryId, String termId) { AtlasRelationshipType relationshipType = typeRegistry.getRelationshipTypeByName(TERM_CATEGORIZATION); AtlasStruct defaultAttrs = relationshipType.createDefaultValue(); AtlasRelationship relationship = new AtlasRelationship(TERM_CATEGORIZATION, new AtlasObjectId(relatedCategoryId.getCategoryGuid()), new AtlasObjectId(termId), defaultAttrs.getAttributes()); updateRelationshipAttributes(relationship, relatedCategoryId); return relationship; }