Java Code Examples for org.apache.atlas.type.AtlasType#createDefaultValue()
The following examples show how to use
org.apache.atlas.type.AtlasType#createDefaultValue() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EntityGraphMapper.java From atlas with Apache License 2.0 | 6 votes |
private void mapAttribute(AtlasAttribute attribute, Object attrValue, AtlasVertex vertex, EntityOperation op, EntityMutationContext context) throws AtlasBaseException { boolean isDeletedEntity = context.isDeletedEntity(vertex); AtlasType attrType = attribute.getAttributeType(); if (attrValue == null) { AtlasAttributeDef attributeDef = attribute.getAttributeDef(); if (attrType.getTypeCategory() == TypeCategory.PRIMITIVE) { if (attributeDef.getDefaultValue() != null) { attrValue = attrType.createDefaultValue(attributeDef.getDefaultValue()); } else { if (attribute.getAttributeDef().getIsOptional()) { attrValue = attrType.createOptionalDefaultValue(); } else { attrValue = attrType.createDefaultValue(); } } } } if (attrType.getTypeCategory() == TypeCategory.PRIMITIVE || attrType.getTypeCategory() == TypeCategory.ENUM) { mapPrimitiveValue(vertex, attribute, attrValue, isDeletedEntity); } else { AttributeMutationContext ctx = new AttributeMutationContext(op, vertex, attribute, attrValue); mapToVertexByTypeCategory(ctx, context); } }
Example 2
Source File: EntityGraphMapper.java From incubator-atlas with Apache License 2.0 | 6 votes |
private void mapAttribute(AtlasAttribute attribute, Object attrValue, AtlasVertex vertex, EntityOperation op, EntityMutationContext context) throws AtlasBaseException { if (attrValue == null) { AtlasAttributeDef attributeDef = attribute.getAttributeDef(); AtlasType attrType = attribute.getAttributeType(); if (attrType.getTypeCategory() == TypeCategory.PRIMITIVE) { if (attributeDef.getDefaultValue() != null) { attrValue = attrType.createDefaultValue(attributeDef.getDefaultValue()); } else { if (attribute.getAttributeDef().getIsOptional()) { attrValue = attrType.createOptionalDefaultValue(); } else { attrValue = attrType.createDefaultValue(); } } } } AttributeMutationContext ctx = new AttributeMutationContext(op, vertex, attribute, attrValue); mapToVertexByTypeCategory(ctx, context); }