private void mapRelationshipAttributes(AtlasVertex entityVertex, AtlasEntity entity) throws AtlasBaseException { AtlasEntityType entityType = typeRegistry.getEntityTypeByName(entity.getTypeName()); if (entityType == null) { throw new AtlasBaseException(AtlasErrorCode.TYPE_NAME_INVALID, entity.getTypeName()); } for (AtlasAttribute attribute : entityType.getRelationshipAttributes().values()) { Object attrValue = mapVertexToRelationshipAttribute(entityVertex, entityType, attribute); entity.setRelationshipAttribute(attribute.getName(), attrValue); } }
private void mapRelationshipAttributes(AtlasVertex entityVertex, AtlasEntity entity) throws AtlasBaseException { AtlasEntityType entityType = typeRegistry.getEntityTypeByName(entity.getTypeName()); if (entityType == null) { throw new AtlasBaseException(AtlasErrorCode.TYPE_NAME_INVALID, entity.getTypeName()); } for (AtlasAttribute attribute : entityType.getRelationshipAttributes().values()) { Object attrValue = mapVertexToRelationshipAttribute(entityVertex, entityType, attribute); entity.setRelationshipAttribute(attribute.getName(), attrValue); } }
maxEntityForUpdate.setRelationshipAttribute("manager", juliusId); maxEntityForUpdate.setRelationshipAttribute("friends", ImmutableList.of(johnId, juliusId)); juliusEntityForUpdate.setRelationshipAttribute("sibling", mikeId);
maxEntityForUpdate.setRelationshipAttribute("manager", juliusId); maxEntityForUpdate.setRelationshipAttribute("friends", ImmutableList.of(johnId, juliusId)); juliusEntityForUpdate.setRelationshipAttribute("sibling", mikeId);
jane.setRelationshipAttribute("department", getAtlasObjectId(hrDept)); jane.setAttribute("address", janeAddr); julius.setRelationshipAttribute("department", getAtlasObjectId(hrDept)); julius.setRelationshipAttribute("sibling", getAtlasObjectId(jane)); julius.setAttribute("address", juliusAddr); max.setRelationshipAttribute("department", getAtlasObjectId(hrDept)); max.setAttribute("address", maxAddr); max.setRelationshipAttribute("manager", getAtlasObjectId(jane)); max.setRelationshipAttribute("mentors", getAtlasObjectIds(julius)); max.setAttribute("birthday",new Date(1979, 3, 15)); max.setAttribute("hasPets", true); john.setRelationshipAttribute("department", getAtlasObjectId(hrDept)); john.setAttribute("address", johnAddr); john.setRelationshipAttribute("manager", getAtlasObjectId(jane)); john.setRelationshipAttribute("mentors", getAtlasObjectIds(max, julius)); john.setRelationshipAttribute("friends", getAtlasObjectIds(max)); john.setAttribute("birthday",new Date(1950, 5, 15)); john.setAttribute("hasPets", true); mike.setRelationshipAttribute("department", getAtlasObjectId(hrDept)); mike.setAttribute("address", mikeAddr); mike.setRelationshipAttribute("manager", getAtlasObjectId(julius)); mike.setRelationshipAttribute("friends", getAtlasObjectIds(max, john)); mike.setAttribute("birthday",new Date(1947, 8, 15)); mike.setAttribute("hasPets", false);
julius.setRelationshipAttribute("department", getAtlasObjectId(hrDept)); julius.setAttribute("address", juliusAddr); max.setRelationshipAttribute("department", getAtlasObjectId(hrDept)); max.setAttribute("address", maxAddr); max.setRelationshipAttribute("manager", getAtlasObjectId(jane)); max.setRelationshipAttribute("mentor", getAtlasObjectId(julius)); max.setAttribute("birthday",new Date(1979, 3, 15)); max.setAttribute("hasPets", true); john.setRelationshipAttribute("department", getAtlasObjectId(hrDept)); john.setAttribute("address", johnAddr); john.setRelationshipAttribute("manager", getAtlasObjectId(jane)); john.setRelationshipAttribute("mentor", getAtlasObjectId(max)); john.setAttribute("birthday",new Date(1950, 5, 15)); john.setAttribute("hasPets", true);
b1PartialUpdate.setRelationshipAttribute("manyToManyA", ImmutableList.of(getAtlasObjectId(a1), getAtlasObjectId(a2)));
b1PartialUpdate.setRelationshipAttribute("manyToManyA", ImmutableList.of(getAtlasObjectId(a1), getAtlasObjectId(a2)));
partialUpdateB.setRelationshipAttribute("a", getAtlasObjectId(a1)); partialUpdateB.setRelationshipAttribute("a", getAtlasObjectId(a2)); response = entityStore.updateByUniqueAttributes(bType, Collections.<String, Object>singletonMap(NAME, b.getAttribute(NAME)), new AtlasEntityWithExtInfo(partialUpdateB)); partialUpdatedEntitiesHeader = response.getPartialUpdatedEntities();
partialUpdateB.setRelationshipAttribute("a", getAtlasObjectId(a1)); partialUpdateB.setRelationshipAttribute("a", getAtlasObjectId(a2)); response = entityStore.updateByUniqueAttributes(bType, Collections.<String, Object>singletonMap(NAME, b.getAttribute(NAME)), new AtlasEntityWithExtInfo(partialUpdateB)); partialUpdatedEntitiesHeader = response.getPartialUpdatedEntities();
bPartialUpdate.setRelationshipAttribute("manyA", ImmutableList.of(getAtlasObjectId(a1), getAtlasObjectId(a2))); bPartialUpdate.setRelationshipAttribute("manyA", ImmutableList.of(getAtlasObjectId(a3))); init(); response = entityStore.updateByUniqueAttributes(typeRegistry.getEntityTypeByName("B"),
bPartialUpdate.setRelationshipAttribute("manyA", ImmutableList.of(getAtlasObjectId(a1), getAtlasObjectId(a2))); bPartialUpdate.setRelationshipAttribute("manyA", ImmutableList.of(getAtlasObjectId(a3))); init(); response = entityStore.updateByUniqueAttributes(typeRegistry.getEntityTypeByName("B"),