Search in sources :

Example 6 with ClassTypeDefinition

use of org.apache.atlas.v1.model.typedef.ClassTypeDefinition in project atlas by apache.

the class AtlasTypeUtil method toClassTypeDefinition.

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;
}
Also used : AtlasAttributeDef(org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef) AtlasStruct(org.apache.atlas.model.instance.AtlasStruct) StringUtils(org.apache.commons.lang.StringUtils) java.util(java.util) Multiplicity(org.apache.atlas.v1.model.typedef.Multiplicity) AtlasEnumElementDef(org.apache.atlas.model.typedef.AtlasEnumDef.AtlasEnumElementDef) AtlasTypeDefHeader(org.apache.atlas.model.typedef.AtlasTypeDefHeader) AttributeDefinition(org.apache.atlas.v1.model.typedef.AttributeDefinition) Matcher(java.util.regex.Matcher) CollectionUtils(org.apache.commons.collections.CollectionUtils) AtlasObjectId(org.apache.atlas.model.instance.AtlasObjectId) AtlasTypesDef(org.apache.atlas.model.typedef.AtlasTypesDef) AtlasEntityHeader(org.apache.atlas.model.instance.AtlasEntityHeader) AtlasEntity(org.apache.atlas.model.instance.AtlasEntity) AtlasEntityDef(org.apache.atlas.model.typedef.AtlasEntityDef) AtlasStructDef(org.apache.atlas.model.typedef.AtlasStructDef) AtlasRelationshipDef(org.apache.atlas.model.typedef.AtlasRelationshipDef) PropagateTags(org.apache.atlas.model.typedef.AtlasRelationshipDef.PropagateTags) MapUtils(org.apache.commons.collections.MapUtils) Collectors(java.util.stream.Collectors) AtlasBaseTypeDef(org.apache.atlas.model.typedef.AtlasBaseTypeDef) AtlasRelationshipEndDef(org.apache.atlas.model.typedef.AtlasRelationshipEndDef) AtlasConstraintDef(org.apache.atlas.model.typedef.AtlasStructDef.AtlasConstraintDef) Cardinality(org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef.Cardinality) AtlasEnumDef(org.apache.atlas.model.typedef.AtlasEnumDef) ClassTypeDefinition(org.apache.atlas.v1.model.typedef.ClassTypeDefinition) AtlasClassification(org.apache.atlas.model.instance.AtlasClassification) Pattern(java.util.regex.Pattern) RelationshipCategory(org.apache.atlas.model.typedef.AtlasRelationshipDef.RelationshipCategory) AtlasClassificationDef(org.apache.atlas.model.typedef.AtlasClassificationDef) AtlasEntityDef(org.apache.atlas.model.typedef.AtlasEntityDef) AttributeDefinition(org.apache.atlas.v1.model.typedef.AttributeDefinition) ClassTypeDefinition(org.apache.atlas.v1.model.typedef.ClassTypeDefinition)

Aggregations

AttributeDefinition (org.apache.atlas.v1.model.typedef.AttributeDefinition)3 ClassTypeDefinition (org.apache.atlas.v1.model.typedef.ClassTypeDefinition)3 AtlasEntityDef (org.apache.atlas.model.typedef.AtlasEntityDef)2 AtlasAttributeDef (org.apache.atlas.model.typedef.AtlasStructDef.AtlasAttributeDef)2 AtlasTypesDef (org.apache.atlas.model.typedef.AtlasTypesDef)2 Referenceable (org.apache.atlas.v1.model.instance.Referenceable)2 Test (org.testng.annotations.Test)2 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1 java.util (java.util)1 Matcher (java.util.regex.Matcher)1 Pattern (java.util.regex.Pattern)1 Collectors (java.util.stream.Collectors)1 AtlasClassification (org.apache.atlas.model.instance.AtlasClassification)1 AtlasEntity (org.apache.atlas.model.instance.AtlasEntity)1 AtlasEntityHeader (org.apache.atlas.model.instance.AtlasEntityHeader)1 AtlasObjectId (org.apache.atlas.model.instance.AtlasObjectId)1 AtlasStruct (org.apache.atlas.model.instance.AtlasStruct)1 AtlasBaseTypeDef (org.apache.atlas.model.typedef.AtlasBaseTypeDef)1 AtlasClassificationDef (org.apache.atlas.model.typedef.AtlasClassificationDef)1 AtlasEnumDef (org.apache.atlas.model.typedef.AtlasEnumDef)1