static Map<String, List<String>> getVertexPropertiesForCollectionAttributes(AtlasStructType type) { try { Map<String, List<String>> collectionProperties = new HashMap<>(); for (AtlasAttribute attr : type.getAllAttributes().values()) { addIfCollectionAttribute(attr, collectionProperties); } return collectionProperties; } catch (Exception e) { LOG.error("addVertexPropertiesForCollectionAttributes", e); } return null; }
void visitStruct(AtlasStructType structType, AtlasStruct struct) throws AtlasBaseException { for (AtlasAttribute attribute : structType.getAllAttributes().values()) { AtlasType attrType = attribute.getAttributeType(); Object attrVal = struct.getAttribute(attribute.getName()); visitAttribute(attrType, attrVal); } }
void visitStruct(AtlasStructType structType, AtlasStruct struct) throws AtlasBaseException { for (AtlasAttribute attribute : structType.getAllAttributes().values()) { AtlasType attrType = attribute.getAttributeType(); Object attrVal = struct.getAttribute(attribute.getName()); visitAttribute(attrType, attrVal); } }
private void mapAttributes(AtlasVertex entityVertex, AtlasStruct struct, AtlasEntityExtInfo entityExtInfo, boolean isMinExtInfo) throws AtlasBaseException { AtlasType objType = typeRegistry.getType(struct.getTypeName()); if (!(objType instanceof AtlasStructType)) { throw new AtlasBaseException(AtlasErrorCode.TYPE_NAME_INVALID, struct.getTypeName()); } AtlasStructType structType = (AtlasStructType) objType; for (AtlasAttribute attribute : structType.getAllAttributes().values()) { Object attrValue = mapVertexToAttribute(entityVertex, attribute, entityExtInfo, isMinExtInfo); struct.setAttribute(attribute.getName(), attrValue); } }
private void mapAttributes(AtlasVertex entityVertex, AtlasStruct struct, AtlasEntityExtInfo entityExtInfo, boolean isMinExtInfo) throws AtlasBaseException { AtlasType objType = typeRegistry.getType(struct.getTypeName()); if (!(objType instanceof AtlasStructType)) { throw new AtlasBaseException(AtlasErrorCode.TYPE_NAME_INVALID, struct.getTypeName()); } AtlasStructType structType = (AtlasStructType) objType; for (AtlasAttribute attribute : structType.getAllAttributes().values()) { Object attrValue = mapVertexToAttribute(entityVertex, attribute, entityExtInfo, isMinExtInfo); struct.setAttribute(attribute.getName(), attrValue); } }
private void mapAttributes(AtlasStruct struct, AtlasVertex vertex, EntityOperation op, EntityMutationContext context) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> mapAttributes({}, {})", op, struct.getTypeName()); } if (MapUtils.isNotEmpty(struct.getAttributes())) { AtlasStructType structType = getStructType(struct.getTypeName()); if (op.equals(CREATE)) { for (AtlasAttribute attribute : structType.getAllAttributes().values()) { Object attrValue = struct.getAttribute(attribute.getName()); mapAttribute(attribute, attrValue, vertex, op, context); } } else if (op.equals(UPDATE)) { for (String attrName : struct.getAttributes().keySet()) { AtlasAttribute attribute = structType.getAttribute(attrName); if (attribute != null) { Object attrValue = struct.getAttribute(attrName); mapAttribute(attribute, attrValue, vertex, op, context); } else { LOG.warn("mapAttributes(): invalid attribute {}.{}. Ignored..", struct.getTypeName(), attrName); } } } updateModificationMetadata(vertex); } if (LOG.isDebugEnabled()) { LOG.debug("<== mapAttributes({}, {})", op, struct.getTypeName()); } }
private void mapAttributes(AtlasStruct struct, AtlasVertex vertex, EntityOperation op, EntityMutationContext context) throws AtlasBaseException { if (LOG.isDebugEnabled()) { LOG.debug("==> mapAttributes({}, {})", op, struct.getTypeName()); } if (MapUtils.isNotEmpty(struct.getAttributes())) { MetricRecorder metric = RequestContext.get().startMetricRecord("mapAttributes"); AtlasStructType structType = getStructType(struct.getTypeName()); if (op.equals(CREATE)) { for (AtlasAttribute attribute : structType.getAllAttributes().values()) { Object attrValue = struct.getAttribute(attribute.getName()); mapAttribute(attribute, attrValue, vertex, op, context); } } else if (op.equals(UPDATE)) { for (String attrName : struct.getAttributes().keySet()) { AtlasAttribute attribute = structType.getAttribute(attrName); if (attribute != null) { Object attrValue = struct.getAttribute(attrName); mapAttribute(attribute, attrValue, vertex, op, context); } else { LOG.warn("mapAttributes(): invalid attribute {}.{}. Ignored..", struct.getTypeName(), attrName); } } } updateModificationMetadata(vertex); RequestContext.get().endMetricRecord(metric); } if (LOG.isDebugEnabled()) { LOG.debug("<== mapAttributes({}, {})", op, struct.getTypeName()); } }
boolean isEntityType = (parentType instanceof AtlasEntityType); for (AtlasStructType.AtlasAttribute attributeInfo : structType.getAllAttributes().values()) { if (LOG.isDebugEnabled()) { LOG.debug("Deleting attribute {} for {}", attributeInfo.getName(), string(instanceVertex));