private void toVertex(AtlasEnumDef enumDef, AtlasVertex vertex) throws AtlasBaseException { if (CollectionUtils.isEmpty(enumDef.getElementDefs())) { throw new AtlasBaseException(AtlasErrorCode.MISSING_MANDATORY_ATTRIBUTE, enumDef.getName(), "values"); } List<String> values = new ArrayList<>(enumDef.getElementDefs().size()); for (AtlasEnumElementDef element : enumDef.getElementDefs()) { // Validate the enum element if (StringUtils.isEmpty(element.getValue()) || null == element.getOrdinal()) { throw new AtlasBaseException(AtlasErrorCode.MISSING_MANDATORY_ATTRIBUTE, enumDef.getName(), "elementValue"); } String elemKey = AtlasGraphUtilsV2.getTypeDefPropertyKey(enumDef, element.getValue()); AtlasGraphUtilsV2.setProperty(vertex, elemKey, element.getOrdinal()); if (StringUtils.isNotBlank(element.getDescription())) { String descKey = AtlasGraphUtilsV2.getTypeDefPropertyKey(elemKey, "description"); AtlasGraphUtilsV2.setProperty(vertex, descKey, element.getDescription()); } values.add(element.getValue()); } AtlasGraphUtilsV2.setProperty(vertex, AtlasGraphUtilsV2.getTypeDefPropertyKey(enumDef), values); String defaultValueKey = AtlasGraphUtilsV2.getTypeDefPropertyKey(enumDef, "defaultValue"); AtlasGraphUtilsV2.setProperty(vertex, defaultValueKey, enumDef.getDefaultValue()); }
private void toVertex(AtlasEnumDef enumDef, AtlasVertex vertex) throws AtlasBaseException { if (CollectionUtils.isEmpty(enumDef.getElementDefs())) { throw new AtlasBaseException(AtlasErrorCode.MISSING_MANDATORY_ATTRIBUTE, enumDef.getName(), "values"); } List<String> values = new ArrayList<>(enumDef.getElementDefs().size()); for (AtlasEnumElementDef element : enumDef.getElementDefs()) { // Validate the enum element if (StringUtils.isEmpty(element.getValue()) || null == element.getOrdinal()) { throw new AtlasBaseException(AtlasErrorCode.MISSING_MANDATORY_ATTRIBUTE, enumDef.getName(), "elementValue"); } String elemKey = AtlasGraphUtilsV2.getTypeDefPropertyKey(enumDef, element.getValue()); AtlasGraphUtilsV2.setProperty(vertex, elemKey, element.getOrdinal()); if (StringUtils.isNotBlank(element.getDescription())) { String descKey = AtlasGraphUtilsV2.getTypeDefPropertyKey(elemKey, "description"); AtlasGraphUtilsV2.setProperty(vertex, descKey, element.getDescription()); } values.add(element.getValue()); } AtlasGraphUtilsV2.setProperty(vertex, AtlasGraphUtilsV2.getTypeDefPropertyKey(enumDef), values); String defaultValueKey = AtlasGraphUtilsV2.getTypeDefPropertyKey(enumDef, "defaultValue"); AtlasGraphUtilsV2.setProperty(vertex, defaultValueKey, enumDef.getDefaultValue()); }
public AtlasEnumElementDef(AtlasEnumElementDef other) { if (other != null) { setValue(other.getValue()); setDescription(other.getDescription()); setOrdinal(other.getOrdinal()); } }
public AtlasEnumElementDef(AtlasEnumElementDef other) { if (other != null) { setValue(other.getValue()); setDescription(other.getDescription()); setOrdinal(other.getOrdinal()); } }