Search in sources :

Example 1 with AtlasBusinessMetadataType

use of org.apache.atlas.type.AtlasBusinessMetadataType in project atlas by apache.

the class SolrIndexHelper method geIndexFieldNamesWithSearchWeights.

private Map<String, Integer> geIndexFieldNamesWithSearchWeights() {
    Map<String, Integer> ret = new HashMap<>();
    // the following properties are specially added manually.
    // as, they don't come in the entity definitions as attributes.
    ret.put(typeRegistry.getIndexFieldName(CLASSIFICATION_TEXT_KEY), SEARCHWEIGHT_FOR_CLASSIFICATIONS);
    ret.put(typeRegistry.getIndexFieldName(LABELS_PROPERTY_KEY), SEARCHWEIGHT_FOR_LABELS);
    ret.put(typeRegistry.getIndexFieldName(CUSTOM_ATTRIBUTES_PROPERTY_KEY), SEARCHWEIGHT_FOR_CUSTOM_ATTRS);
    ret.put(typeRegistry.getIndexFieldName(TYPE_NAME_PROPERTY_KEY), SEARCHWEIGHT_FOR_TYPENAME);
    for (AtlasEntityType entityType : typeRegistry.getAllEntityTypes()) {
        if (entityType.isInternalType()) {
            continue;
        }
        processType(ret, entityType);
    }
    for (AtlasBusinessMetadataType businessMetadataType : typeRegistry.getAllBusinessMetadataTypes()) {
        processType(ret, businessMetadataType);
    }
    return ret;
}
Also used : AtlasBusinessMetadataType(org.apache.atlas.type.AtlasBusinessMetadataType) AtlasEntityType(org.apache.atlas.type.AtlasEntityType)

Example 2 with AtlasBusinessMetadataType

use of org.apache.atlas.type.AtlasBusinessMetadataType in project atlas by apache.

the class AtlasBusinessMetadataDefStoreV2Test method createBusinessMetadataDefMultivaluedAttributes.

@Test
public void createBusinessMetadataDefMultivaluedAttributes() throws AtlasBaseException {
    createEnumTypes();
    createBusinessMetadataTypesMultivaluedAttributes(businessMetadataName);
    AtlasBusinessMetadataType businessMetadataType = typeRegistry.getBusinessMetadataTypeByName(businessMetadataName);
    Assert.assertEquals(businessMetadataType.getAllAttributes().size(), 10);
    Map<String, AtlasStructType.AtlasAttribute> attributeMap = businessMetadataType.getAllAttributes();
    for (Map.Entry<String, AtlasStructType.AtlasAttribute> e : attributeMap.entrySet()) {
        AtlasStructType.AtlasAttribute atlasAttribute = e.getValue();
        AtlasStructDef.AtlasAttributeDef atlasAttributeDef = atlasAttribute.getAttributeDef();
        Assert.assertTrue(atlasAttributeDef.getTypeName().startsWith("array<"));
    }
}
Also used : AtlasStructDef(org.apache.atlas.model.typedef.AtlasStructDef) AtlasBusinessMetadataType(org.apache.atlas.type.AtlasBusinessMetadataType) AtlasStructType(org.apache.atlas.type.AtlasStructType) Test(org.testng.annotations.Test)

Example 3 with AtlasBusinessMetadataType

use of org.apache.atlas.type.AtlasBusinessMetadataType in project atlas by apache.

the class AtlasBusinessMetadataDefStoreV2Test method createBusinessMetadataDefWithoutAttributes.

@Test
public void createBusinessMetadataDefWithoutAttributes() throws AtlasBaseException {
    createBusinessMetadataTypesWithoutAttributes(businessMetadataName);
    AtlasBusinessMetadataType businessMetadataType = typeRegistry.getBusinessMetadataTypeByName(businessMetadataName);
    Assert.assertTrue(businessMetadataType.getAllAttributes() == null ? true : businessMetadataType.getAllAttributes().isEmpty());
}
Also used : AtlasBusinessMetadataType(org.apache.atlas.type.AtlasBusinessMetadataType) Test(org.testng.annotations.Test)

Example 4 with AtlasBusinessMetadataType

use of org.apache.atlas.type.AtlasBusinessMetadataType in project atlas by apache.

the class ExportTypeProcessor method addType.

private void addType(AtlasType type, ExportService.ExportContext context) {
    if (type.getTypeCategory() == TypeCategory.PRIMITIVE) {
        return;
    }
    if (type instanceof AtlasArrayType) {
        AtlasArrayType arrayType = (AtlasArrayType) type;
        addType(arrayType.getElementType(), context);
    } else if (type instanceof AtlasMapType) {
        AtlasMapType mapType = (AtlasMapType) type;
        addType(mapType.getKeyType(), context);
        addType(mapType.getValueType(), context);
    } else if (type instanceof AtlasEntityType) {
        addEntityType((AtlasEntityType) type, context);
    } else if (type instanceof AtlasClassificationType) {
        addClassificationType((AtlasClassificationType) type, context);
    } else if (type instanceof AtlasRelationshipType) {
        addRelationshipType(type.getTypeName(), context);
    } else if (type instanceof AtlasBusinessMetadataType) {
        addBusinessMetadataType((AtlasBusinessMetadataType) type, context);
    } else if (type instanceof AtlasStructType) {
        addStructType((AtlasStructType) type, context);
    } else if (type instanceof AtlasEnumType) {
        addEnumType((AtlasEnumType) type, context);
    }
}
Also used : AtlasRelationshipType(org.apache.atlas.type.AtlasRelationshipType) AtlasArrayType(org.apache.atlas.type.AtlasArrayType) AtlasBusinessMetadataType(org.apache.atlas.type.AtlasBusinessMetadataType) AtlasEnumType(org.apache.atlas.type.AtlasEnumType) AtlasStructType(org.apache.atlas.type.AtlasStructType) AtlasClassificationType(org.apache.atlas.type.AtlasClassificationType) AtlasEntityType(org.apache.atlas.type.AtlasEntityType) AtlasMapType(org.apache.atlas.type.AtlasMapType)

Example 5 with AtlasBusinessMetadataType

use of org.apache.atlas.type.AtlasBusinessMetadataType in project atlas by apache.

the class ExportTypeProcessor method addBusinessMetadataType.

private void addBusinessMetadataType(AtlasEntityType entityType, ExportService.ExportContext context) {
    for (String bmTypeName : entityType.getBusinessAttributes().keySet()) {
        AtlasBusinessMetadataType bmType = typeRegistry.getBusinessMetadataTypeByName(bmTypeName);
        addBusinessMetadataType(bmType, context);
    }
}
Also used : AtlasBusinessMetadataType(org.apache.atlas.type.AtlasBusinessMetadataType)

Aggregations

AtlasBusinessMetadataType (org.apache.atlas.type.AtlasBusinessMetadataType)8 AtlasStructType (org.apache.atlas.type.AtlasStructType)5 Test (org.testng.annotations.Test)3 AtlasBusinessMetadataDef (org.apache.atlas.model.typedef.AtlasBusinessMetadataDef)2 AtlasStructDef (org.apache.atlas.model.typedef.AtlasStructDef)2 AtlasEntityType (org.apache.atlas.type.AtlasEntityType)2 AtlasVertex (org.apache.atlas.repository.graphdb.AtlasVertex)1 AtlasArrayType (org.apache.atlas.type.AtlasArrayType)1 AtlasClassificationType (org.apache.atlas.type.AtlasClassificationType)1 AtlasEnumType (org.apache.atlas.type.AtlasEnumType)1 AtlasMapType (org.apache.atlas.type.AtlasMapType)1 AtlasRelationshipType (org.apache.atlas.type.AtlasRelationshipType)1