@VisibleForTesting List<AtlasStructDef.AtlasAttributeDef> getElementsAbsentInExisting(AtlasStructDef existing, AtlasStructDef incoming) throws AtlasBaseException { List<AtlasStructDef.AtlasAttributeDef> difference = new ArrayList<>(); for (AtlasStructDef.AtlasAttributeDef attr : incoming.getAttributeDefs()) { updateCollectionWithDifferingAttributes(difference, existing, attr); } return difference; }
public static void updateVertexAddReferences(AtlasStructDef structDef, AtlasVertex vertex, AtlasTypeDefGraphStoreV2 typeDefStore) throws AtlasBaseException { for (AtlasAttributeDef attributeDef : structDef.getAttributeDefs()) { addReferencesForAttribute(vertex, attributeDef, typeDefStore); } }
public static void updateVertexAddReferences(AtlasStructDef structDef, AtlasVertex vertex, AtlasTypeDefGraphStoreV2 typeDefStore) throws AtlasBaseException { for (AtlasAttributeDef attributeDef : structDef.getAttributeDefs()) { addReferencesForAttribute(vertex, attributeDef, typeDefStore); } }
private static AttributeDefinition[] getAttributes(AtlasStructType structType, AtlasTypeRegistry registry) throws AtlasBaseException { List<AttributeDefinition> ret = new ArrayList<>(); List<AtlasAttributeDef> attrDefs = structType.getStructDef().getAttributeDefs(); if (CollectionUtils.isNotEmpty(attrDefs)) { for (AtlasAttributeDef attrDef : attrDefs) { AtlasAttribute attribute = structType.getAttribute(attrDef.getName()); ret.add(AtlasStructDefStoreV1.toAttributeDefintion(attribute)); } } return ret.toArray(new AttributeDefinition[ret.size()]); } }
public void normalizeAttributeValuesForUpdate(Map<String, Object> obj) { if (obj != null) { for (AtlasAttributeDef attrDef : structDef.getAttributeDefs()) { String attrName = attrDef.getName(); Object attrValue = obj.get(attrName); if (obj.containsKey(attrName)) { attrValue = getNormalizedValueForUpdate(attrValue, attrDef); obj.put(attrName, attrValue); } } } }
public void normalizeAttributeValuesForUpdate(Map<String, Object> obj) { if (obj != null) { for (AtlasAttributeDef attrDef : structDef.getAttributeDefs()) { String attrName = attrDef.getName(); Object attrValue = obj.get(attrName); if (obj.containsKey(attrName)) { attrValue = getNormalizedValueForUpdate(attrValue, attrDef); obj.put(attrName, attrValue); } } } }
public void normalizeAttributeValues(Map<String, Object> obj) { if (obj != null) { for (AtlasAttributeDef attributeDef : structDef.getAttributeDefs()) { String attributeName = attributeDef.getName(); if (obj.containsKey(attributeName)) { Object attributeValue = getNormalizedValue(obj.get(attributeName), attributeDef); obj.put(attributeName, attributeValue); } else if (!attributeDef.getIsOptional()) { obj.put(attributeName, createDefaultValue(attributeDef)); } } } }
public void normalizeAttributeValues(Map<String, Object> obj) { if (obj != null) { for (AtlasAttributeDef attributeDef : structDef.getAttributeDefs()) { String attributeName = attributeDef.getName(); if (obj.containsKey(attributeName)) { Object attributeValue = getNormalizedValue(obj.get(attributeName), attributeDef); obj.put(attributeName, attributeValue); } else if (!attributeDef.getIsOptional()) { obj.put(attributeName, createDefaultValue(attributeDef)); } } } }
private void addAttributeTypes(AtlasStructType structType, ExportContext context) { for (AtlasAttributeDef attributeDef : structType.getStructDef().getAttributeDefs()) { addType(attributeDef.getTypeName(), context); } }
private void addAttributeTypes(AtlasStructType structType, ExportService.ExportContext context) { for (AtlasStructDef.AtlasAttributeDef attributeDef : structType.getStructDef().getAttributeDefs()) { addType(attributeDef.getTypeName(), context); } }
private void addAttributeTypes(AtlasStructType structType, ExportContext context) { for (AtlasAttributeDef attributeDef : structType.getStructDef().getAttributeDefs()) { addType(attributeDef.getTypeName(), context); } }
public void normalizeAttributeValuesForUpdate(AtlasStruct obj) { if (obj != null) { for (AtlasAttributeDef attributeDef : structDef.getAttributeDefs()) { String attributeName = attributeDef.getName(); if (obj.hasAttribute(attributeName)) { Object attributeValue = getNormalizedValueForUpdate(obj.getAttribute(attributeName), attributeDef); obj.setAttribute(attributeName, attributeValue); } } } }
public void normalizeAttributeValuesForUpdate(AtlasStruct obj) { if (obj != null) { for (AtlasAttributeDef attributeDef : structDef.getAttributeDefs()) { String attributeName = attributeDef.getName(); if (obj.hasAttribute(attributeName)) { Object attributeValue = getNormalizedValueForUpdate(obj.getAttribute(attributeName), attributeDef); obj.setAttribute(attributeName, attributeValue); } } } }
@Test public void testStructDefHasAttribute() { AtlasStructDef structDef = ModelTestUtil.getStructDef(); for (AtlasAttributeDef attributeDef : structDef.getAttributeDefs()) { assertTrue(structDef.hasAttribute(attributeDef.getName())); } assertFalse(structDef.hasAttribute("01234-xyzabc-;''-)(")); }
@Test public void testStructDefRemoveAttribute() { AtlasStructDef structDef = ModelTestUtil.newStructDef(); String attrName = structDef.getAttributeDefs().get(0).getName(); assertTrue(structDef.hasAttribute(attrName)); structDef.removeAttribute(attrName); assertFalse(structDef.hasAttribute(attrName)); }
@Test public void testStructDefHasAttribute() { AtlasStructDef structDef = ModelTestUtil.getStructDef(); for (AtlasAttributeDef attributeDef : structDef.getAttributeDefs()) { assertTrue(structDef.hasAttribute(attributeDef.getName())); } assertFalse(structDef.hasAttribute("01234-xyzabc-;''-)(")); }
@Test public void testStructDefRemoveAttribute() { AtlasStructDef structDef = ModelTestUtil.newStructDef(); String attrName = structDef.getAttributeDefs().get(0).getName(); assertTrue(structDef.hasAttribute(attrName)); structDef.removeAttribute(attrName); assertFalse(structDef.hasAttribute(attrName)); }
private void checkAndUpdate(AtlasStructDef structDef) { for (AtlasAttributeDef attrDef : structDef.getAttributeDefs()) { String attrTypeName = getAttributeTypeName(attrDef.getTypeName()); if (classificationIndexMap.containsKey(attrTypeName)) { ClassificationToStructDefName pair = createLegacyStructDefFromClassification(attrTypeName); if (pair != null) { updateAttributeWithNewType(pair.getTypeName(), pair.getLegacyTypeName(), attrDef); addStructDefToTypesDef(structDef.getName(), attrDef.getName(), pair); LOG.info("scrubbed: {}:{} -> {}", structDef.getName(), attrDef.getName(), attrDef.getTypeName()); } } } }
public void normalizeAttributeValues(AtlasStruct obj) { if (obj != null) { for (AtlasAttributeDef attributeDef : structDef.getAttributeDefs()) { String attributeName = attributeDef.getName(); if (obj.hasAttribute(attributeName)) { Object attributeValue = getNormalizedValue(obj.getAttribute(attributeName), attributeDef); obj.setAttribute(attributeName, attributeValue); } else if (!attributeDef.getIsOptional()) { obj.setAttribute(attributeName, createDefaultValue(attributeDef)); } } } }
public void normalizeAttributeValues(AtlasStruct obj) { if (obj != null) { for (AtlasAttributeDef attributeDef : structDef.getAttributeDefs()) { String attributeName = attributeDef.getName(); if (obj.hasAttribute(attributeName)) { Object attributeValue = getNormalizedValue(obj.getAttribute(attributeName), attributeDef); obj.setAttribute(attributeName, attributeValue); } else if (!attributeDef.getIsOptional()) { obj.setAttribute(attributeName, createDefaultValue(attributeDef)); } } } }