use of org.apache.atlas.typesystem.types.EnumTypeDefinition in project incubator-atlas by apache.
the class TypeConverterUtil method toAtlasEnumDefs.
private static List<AtlasEnumDef> toAtlasEnumDefs(List<EnumTypeDefinition> enumTypeDefinitions) {
List<AtlasEnumDef> ret = new ArrayList<AtlasEnumDef>();
for (EnumTypeDefinition enumType : enumTypeDefinitions) {
AtlasEnumDef enumDef = new AtlasEnumDef();
enumDef.setName(enumType.name);
enumDef.setDescription(enumType.description);
enumDef.setTypeVersion(enumType.version);
enumDef.setElementDefs(getAtlasEnumElementDefs(enumType.enumValues));
ret.add(enumDef);
}
return ret;
}
use of org.apache.atlas.typesystem.types.EnumTypeDefinition in project incubator-atlas by apache.
the class TypeConverterUtil method enumToTypesDef.
private static TypesDef enumToTypesDef(AtlasEnumType enumType) {
TypesDef ret = null;
AtlasEnumDef enumDef = enumType.getEnumDef();
String enumName = enumDef.getName();
String enumDesc = enumDef.getDescription();
String enumVersion = enumDef.getTypeVersion();
EnumValue[] enumValues = getEnumValues(enumDef.getElementDefs());
if (enumName != null && enumValues != null && enumValues.length > 0) {
EnumTypeDefinition enumTypeDef = new EnumTypeDefinition(enumName, enumDesc, enumVersion, enumValues);
ret = TypesUtil.getTypesDef(ImmutableList.of(enumTypeDef), ImmutableList.<StructTypeDefinition>of(), ImmutableList.<HierarchicalTypeDefinition<TraitType>>of(), ImmutableList.<HierarchicalTypeDefinition<ClassType>>of());
}
return ret;
}
Aggregations