private static TypesDef structToTypesDef(AtlasStructType structType, AtlasTypeRegistry registry) throws AtlasBaseException { String typeName = structType.getStructDef().getName(); String typeDesc = structType.getStructDef().getDescription(); String typeVersion = structType.getStructDef().getTypeVersion(); AttributeDefinition[] attributes = getAttributes(structType, registry); StructTypeDefinition structTypeDef = TypesUtil.createStructTypeDef(typeName, typeDesc, typeVersion, attributes); TypesDef ret = TypesUtil.getTypesDef(ImmutableList.<EnumTypeDefinition>of(), ImmutableList.of(structTypeDef), ImmutableList.<HierarchicalTypeDefinition<TraitType>>of(), ImmutableList.<HierarchicalTypeDefinition<ClassType>>of()); return ret; }
public static ClassTypeDefinition toClassTypeDefinition(final AtlasEntityType entityType) { ClassTypeDefinition ret = null; if (entityType != null) { AtlasEntityDef entityDef = entityType.getEntityDef(); ret = new ClassTypeDefinition(); ret.setTypeName(entityDef.getName()); ret.setTypeDescription(entityDef.getDescription()); ret.setTypeVersion(entityDef.getTypeVersion()); ret.setSuperTypes(entityDef.getSuperTypes()); if (MapUtils.isNotEmpty(entityType.getAllAttributes())) { List<AttributeDefinition> attributeDefinitions = entityType.getAllAttributes() .entrySet() .stream() .map(e -> toV1AttributeDefinition(e.getValue())) .collect(Collectors.toList()); ret.setAttributeDefinitions(attributeDefinitions); } } return ret; }
private static TypesDef entityToTypesDef(AtlasEntityType entityType, AtlasTypeRegistry registry) { String typeName = entityType.getEntityDef().getName(); String typeDesc = entityType.getEntityDef().getDescription(); String typeVersion = entityType.getEntityDef().getTypeVersion(); Set<String> superTypes = entityType.getEntityDef().getSuperTypes(); List<AttributeDefinition> attributes = getAttributes(entityType, registry); ClassTypeDefinition classTypeDef = new ClassTypeDefinition(typeName, typeDesc, typeVersion, attributes, superTypes); TypesDef ret = new TypesDef(null, null, null, Arrays.asList(classTypeDef)); return ret; }