org.apache.atlas.model.typedef.AtlasBaseTypeDef Java Examples

The following examples show how to use org.apache.atlas.model.typedef.AtlasBaseTypeDef. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GraphBackedSearchIndexer.java    From incubator-atlas with Apache License 2.0 6 votes vote down vote up
private void cleanupIndices(AtlasGraphManagement management, AtlasBaseTypeDef typeDef) {
    Preconditions.checkNotNull(typeDef, "Cannot process null typedef");
    if (LOG.isDebugEnabled()) {
        LOG.debug("Cleaning up index for {}", typeDef);
    }

    if (typeDef instanceof AtlasEnumDef) {
        // Only handle complex types like Struct, Classification and Entity
        return;
    }

    if (typeDef instanceof AtlasStructDef) {
        AtlasStructDef structDef = (AtlasStructDef) typeDef;
        List<AtlasAttributeDef> attributeDefs = structDef.getAttributeDefs();
        if (CollectionUtils.isNotEmpty(attributeDefs)) {
            for (AtlasAttributeDef attributeDef : attributeDefs) {
                cleanupIndexForAttribute(management, typeDef.getName(), attributeDef);
            }
        }
    } else if (!AtlasTypeUtil.isBuiltInType(typeDef.getName())){
        throw new IllegalArgumentException("bad data type" + typeDef.getName());
    }
}
 
Example #2
Source File: AtlasExportResult.java    From incubator-atlas with Apache License 2.0 6 votes vote down vote up
public StringBuilder toString(StringBuilder sb) {
    if (sb == null) {
        sb = new StringBuilder();
    }

    sb.append("AtlasExportData{");
    sb.append("typesDef={").append(typesDef).append("}");
    sb.append("entities={");
    AtlasBaseTypeDef.dumpObjects(entities, sb);
    sb.append("}");
    sb.append("entityCreationOrder={");
    AtlasBaseTypeDef.dumpObjects(entityCreationOrder, sb);
    sb.append("}");
    sb.append("}");

    return sb;
}
 
Example #3
Source File: AtlasExportResult.java    From atlas with Apache License 2.0 6 votes vote down vote up
public StringBuilder toString(StringBuilder sb) {
    if (sb == null) {
        sb = new StringBuilder();
    }

    sb.append("AtlasExportData {");
    sb.append(", typesDef={").append(typesDef).append("}");
    sb.append(", entities={");
    sb.append("}");
    sb.append(", entityCreationOrder={");
    AtlasBaseTypeDef.dumpObjects(entityCreationOrder, sb);
    sb.append("}");
    sb.append("}");

    return sb;
}
 
Example #4
Source File: AtlasImportResult.java    From atlas with Apache License 2.0 6 votes vote down vote up
public StringBuilder toString(StringBuilder sb) {
    if (sb == null) {
        sb = new StringBuilder();
    }

    sb.append("AtlasImportResult{");
    sb.append("request={").append(request).append("}");
    sb.append(", userName='").append(userName).append("'");
    sb.append(", clientIpAddress='").append(clientIpAddress).append("'");
    sb.append(", hostName='").append(hostName).append("'");
    sb.append(", timeStamp='").append(timeStamp).append("'");
    sb.append(", metrics={");
    AtlasBaseTypeDef.dumpObjects(metrics, sb);
    sb.append("}");

    sb.append(", operationStatus='").append(operationStatus).append("'");
    sb.append(", processedEntities=[");
    AtlasBaseTypeDef.dumpObjects(processedEntities, sb);
    sb.append("]");
    sb.append("}");

    return sb;
}
 
Example #5
Source File: AtlasTypeRegistry.java    From atlas with Apache License 2.0 6 votes vote down vote up
public void removeTypeByName(String name) throws AtlasBaseException {
    if (LOG.isDebugEnabled()) {
        LOG.debug("==> AtlasTypeRegistry.removeTypeByName({})", name);
    }

    AtlasBaseTypeDef typeDef = getTypeDefByName(name);

    if (name != null) {
        registryData.removeByName(name);
    }

    resolveReferences();

    if (typeDef != null) {
        deletedTypes.add(typeDef);
    }

    if (LOG.isDebugEnabled()) {
        LOG.debug("<== AtlasTypeRegistry.removeEnumDefByName({})", name);
    }
}
 
Example #6
Source File: AtlasTypeRegistry.java    From atlas with Apache License 2.0 6 votes vote down vote up
private void updateTypesWithNoRefResolve(Collection<? extends AtlasBaseTypeDef> typeDefs) {
    if (LOG.isDebugEnabled()) {
        LOG.debug("==> AtlasTypeRegistry.updateTypesWithNoRefResolve(length={})",
                (typeDefs == null ? 0 : typeDefs.size()));
    }

    if (CollectionUtils.isNotEmpty(typeDefs)) {
        for (AtlasBaseTypeDef typeDef : typeDefs) {
            updateTypeWithNoRefResolve(typeDef);
        }
    }

    if (LOG.isDebugEnabled()) {
        LOG.debug("<== AtlasTypeRegistry.updateTypesWithNoRefResolve(length={})",
                (typeDefs == null ? 0 : typeDefs.size()));
    }
}
 
Example #7
Source File: AtlasBuiltInTypes.java    From atlas with Apache License 2.0 6 votes vote down vote up
@Override
public Date getNormalizedValue(Object obj) {
    if (obj != null) {
        if (obj instanceof Date) {
            return (Date) obj;
        } else if (obj instanceof Number) {
            return new Date(((Number) obj).longValue());
        } else {
            try {
                return AtlasBaseTypeDef.getDateFormatter().parse(obj.toString());
            } catch (ParseException excp) {
                try { // try to read it as a number
                    long longDate = Long.valueOf(obj.toString());
                    return new Date(longDate);
                } catch (NumberFormatException e) {
                    // ignore
                }
            }
        }
    }

    return null;
}
 
Example #8
Source File: AtlasTypeRegistry.java    From atlas with Apache License 2.0 6 votes vote down vote up
private void removeTypeByGuidWithNoRefResolve(AtlasBaseTypeDef typeDef) {
    switch (typeDef.getCategory()) {
        case ENUM:
            registryData.enumDefs.removeTypeDefByGuid(typeDef.getGuid());
            break;
        case STRUCT:
            registryData.structDefs.removeTypeDefByGuid(typeDef.getGuid());
            break;
        case CLASSIFICATION:
            registryData.classificationDefs.removeTypeDefByGuid(typeDef.getGuid());
            break;
        case ENTITY:
            registryData.entityDefs.removeTypeDefByGuid(typeDef.getGuid());
            break;
        case RELATIONSHIP:
            registryData.relationshipDefs.removeTypeDefByGuid(typeDef.getGuid());
            break;
        case BUSINESS_METADATA:
            registryData.businessMetadataDefs.removeTypeDefByGuid(typeDef.getGuid());
            break;
    }
    deletedTypes.add(typeDef);
}
 
Example #9
Source File: AtlasTypeRegistry.java    From incubator-atlas with Apache License 2.0 6 votes vote down vote up
private void removeTypeByNameWithNoRefResolve(AtlasBaseTypeDef typeDef) {
    switch (typeDef.getCategory()) {
        case ENUM:
            registryData.enumDefs.removeTypeDefByName(typeDef.getName());
            break;
        case STRUCT:
            registryData.structDefs.removeTypeDefByName(typeDef.getName());
            break;
        case CLASSIFICATION:
            registryData.classificationDefs.removeTypeDefByName(typeDef.getName());
            break;
        case ENTITY:
            registryData.entityDefs.removeTypeDefByName(typeDef.getName());
            break;
        case RELATIONSHIP:
            registryData.relationshipDefs.removeTypeDefByName(typeDef.getName());
            break;
    }
    deletedTypes.add(typeDef);
}
 
Example #10
Source File: AtlasExportRequest.java    From atlas with Apache License 2.0 6 votes vote down vote up
public StringBuilder toString(StringBuilder sb) {
    if (sb == null) {
        sb = new StringBuilder();
    }

    sb.append("AtlasExportRequest{");
    sb.append("itemsToExport={");
    AtlasBaseTypeDef.dumpObjects(itemsToExport, sb);
    sb.append("}");
    sb.append("options={");
    AtlasBaseTypeDef.dumpObjects(options, sb);
    sb.append("}");
    sb.append("}");

    return sb;
}
 
Example #11
Source File: AtlasTypeRegistry.java    From incubator-atlas with Apache License 2.0 6 votes vote down vote up
public void removeTypeByName(String name) throws AtlasBaseException {
    if (LOG.isDebugEnabled()) {
        LOG.debug("==> AtlasTypeRegistry.removeTypeByName({})", name);
    }

    if (name != null) {
        AtlasBaseTypeDef typeDef = getTypeDefByName(name);

        registryData.removeByName(name);

        resolveReferences();

        if (typeDef != null) {
            deletedTypes.add(typeDef);
        }
    }

    if (LOG.isDebugEnabled()) {
        LOG.debug("<== AtlasTypeRegistry.removeEnumDefByName({})", name);
    }
}
 
Example #12
Source File: EntityNotificationV1.java    From atlas with Apache License 2.0 6 votes vote down vote up
@Override
public StringBuilder toString(StringBuilder sb) {
    if (sb == null) {
        sb = new StringBuilder();
    }

    sb.append("EntityNotificationV1{");
    super.toString(sb);
    sb.append(", entity=");
    if (entity != null) {
        entity.toString(sb);
    } else {
        sb.append(entity);
    }
    sb.append(", operationType=").append(operationType);
    sb.append(", traits=[");
    AtlasBaseTypeDef.dumpObjects(traits, sb);
    sb.append("]");
    sb.append("}");

    return sb;
}
 
Example #13
Source File: TypesDef.java    From atlas with Apache License 2.0 6 votes vote down vote up
public StringBuilder toString(StringBuilder sb) {
    if (sb == null) {
        sb = new StringBuilder();
    }

    sb.append("TypesDef{");
    sb.append("enumTypes=[");
    AtlasBaseTypeDef.dumpObjects(enumTypes, sb);
    sb.append("], structTypes=[");
    AtlasBaseTypeDef.dumpObjects(structTypes, sb);
    sb.append("], traitTypes=[");
    AtlasBaseTypeDef.dumpObjects(traitTypes, sb);
    sb.append("], classTypes=[");
    AtlasBaseTypeDef.dumpObjects(classTypes, sb);
    sb.append("]");
    sb.append("}");

    return sb;
}
 
Example #14
Source File: Referenceable.java    From atlas with Apache License 2.0 6 votes vote down vote up
@Override
public StringBuilder toString(StringBuilder sb) {
    if (sb == null) {
        sb = new StringBuilder();
    }

    sb.append("Referenceable{");
    super.toString(sb);
    sb.append(", id=");
    if (id != null) {
        id.asString(sb);
    }
    sb.append(", triats={");
    AtlasBaseTypeDef.dumpObjects(this.traits, sb);
    sb.append("}, traitNames=[");
    AtlasBaseTypeDef.dumpObjects(traitNames, sb);
    sb.append("], systemAttributes=");
    if (systemAttributes != null) {
        systemAttributes.toString(sb);
    }
    sb.append("}");

    return sb;
}
 
Example #15
Source File: AtlasAbstractDefStoreV1.java    From incubator-atlas with Apache License 2.0 6 votes vote down vote up
public void validateType(AtlasBaseTypeDef typeDef) throws AtlasBaseException {
    if (!isValidName(typeDef.getName())) {
        throw new AtlasBaseException(AtlasErrorCode.TYPE_NAME_INVALID_FORMAT, typeDef.getName(), typeDef.getCategory().name());
    }

    try {
        final boolean allowReservedKeywords = ApplicationProperties.get().getBoolean(ALLOW_RESERVED_KEYWORDS, true);

        if (!allowReservedKeywords && typeDef instanceof AtlasStructDef) {
            final List<AtlasStructDef.AtlasAttributeDef> attributeDefs = ((AtlasStructDef) typeDef).getAttributeDefs();
            for (AtlasStructDef.AtlasAttributeDef attrDef : attributeDefs) {
                if (QueryParser.isKeyword(attrDef.getName())) {
                    throw new AtlasBaseException(AtlasErrorCode.ATTRIBUTE_NAME_INVALID, attrDef.getName(), typeDef.getCategory().name());
                }
            }
        }
    } catch (AtlasException e) {
        LOG.error("Exception while loading configuration ", e);
        throw new AtlasBaseException(AtlasErrorCode.INTERNAL_ERROR, "Could not load configuration");
    }
}
 
Example #16
Source File: Id.java    From atlas with Apache License 2.0 6 votes vote down vote up
static Date asDate(Object val) {
    if (val != null) {
        if (val instanceof Date) {
            return (Date) val;
        } else if (val instanceof Number) {
            return new Date(((Number)val).longValue());
        }

        try {
            return AtlasBaseTypeDef.getDateFormatter().parse(val.toString());
        } catch (ParseException excp) {
            // ignore
        }
    }

    return null;
}
 
Example #17
Source File: AtlasTypeUtil.java    From atlas with Apache License 2.0 6 votes vote down vote up
public static AtlasTypesDef getTypesDef(AtlasBaseTypeDef typeDef) {
    AtlasTypesDef ret = new AtlasTypesDef();

    if (typeDef != null) {
        if (typeDef.getClass().equals(AtlasEntityDef.class)) {
            ret.getEntityDefs().add((AtlasEntityDef) typeDef);
        } else if (typeDef.getClass().equals(AtlasRelationshipDef.class)) {
            ret.getRelationshipDefs().add((AtlasRelationshipDef) typeDef);
        } else if (typeDef.getClass().equals(AtlasClassificationDef.class)) {
            ret.getClassificationDefs().add((AtlasClassificationDef) typeDef);
        } else if (typeDef.getClass().equals(AtlasStructDef.class)) {
            ret.getStructDefs().add((AtlasStructDef) typeDef);
        } else if (typeDef.getClass().equals(AtlasEnumDef.class)) {
            ret.getEnumDefs().add((AtlasEnumDef) typeDef);
        }
    }

    return ret;
}
 
Example #18
Source File: AtlasTypeDefGraphStoreV1.java    From incubator-atlas with Apache License 2.0 6 votes vote down vote up
void updateTypeVertex(AtlasBaseTypeDef typeDef, AtlasVertex vertex) {
    if (!isTypeVertex(vertex)) {
        LOG.warn("updateTypeVertex(): not a type-vertex - {}", vertex);

        return;
    }

    updateVertexProperty(vertex, Constants.GUID_PROPERTY_KEY, typeDef.getGuid());
    /*
     * rename of a type is supported yet - as the typename is used to in the name of the edges from this vertex
     * To support rename of types, he edge names should be derived from an internal-name - not directly the typename
     *
    updateVertexProperty(vertex, Constants.TYPENAME_PROPERTY_KEY, typeDef.getName());
     */
    updateVertexProperty(vertex, Constants.TYPEDESCRIPTION_PROPERTY_KEY, typeDef.getDescription());
    updateVertexProperty(vertex, Constants.TYPEVERSION_PROPERTY_KEY, typeDef.getTypeVersion());
    updateVertexProperty(vertex, Constants.TYPEOPTIONS_PROPERTY_KEY, AtlasType.toJson(typeDef.getOptions()));

    markVertexUpdated(vertex);
}
 
Example #19
Source File: GraphBackedSearchIndexer.java    From incubator-atlas with Apache License 2.0 6 votes vote down vote up
private void addIndexForType(AtlasGraphManagement management, AtlasBaseTypeDef typeDef) {
    if (typeDef instanceof AtlasEnumDef) {
        // Only handle complex types like Struct, Classification and Entity
        return;
    }
    if (typeDef instanceof AtlasStructDef) {
        AtlasStructDef structDef = (AtlasStructDef) typeDef;
        List<AtlasAttributeDef> attributeDefs = structDef.getAttributeDefs();
        if (CollectionUtils.isNotEmpty(attributeDefs)) {
            for (AtlasAttributeDef attributeDef : attributeDefs) {
                createIndexForAttribute(management, typeDef.getName(), attributeDef);
            }
        }
    } else if (!AtlasTypeUtil.isBuiltInType(typeDef.getName())){
        throw new IllegalArgumentException("bad data type" + typeDef.getName());
    }
}
 
Example #20
Source File: AtlasImportResult.java    From incubator-atlas with Apache License 2.0 6 votes vote down vote up
public StringBuilder toString(StringBuilder sb) {
    if (sb == null) {
        sb = new StringBuilder();
    }

    sb.append("AtlasImportResult{");
    sb.append("request={").append(request).append("}");
    sb.append(", userName='").append(userName).append("'");
    sb.append(", clientIpAddress='").append(clientIpAddress).append("'");
    sb.append(", hostName='").append(hostName).append("'");
    sb.append(", timeStamp='").append(timeStamp).append("'");
    sb.append(", metrics={");
    AtlasBaseTypeDef.dumpObjects(metrics, sb);
    sb.append("}");

    sb.append(", operationStatus='").append(operationStatus).append("'");
    sb.append(", processedEntities=[");
    AtlasBaseTypeDef.dumpObjects(processedEntities, sb);
    sb.append("]");
    sb.append("}");

    return sb;
}
 
Example #21
Source File: AtlasImportRequest.java    From incubator-atlas with Apache License 2.0 5 votes vote down vote up
public StringBuilder toString(StringBuilder sb) {
    if (sb == null) {
        sb = new StringBuilder();
    }

    sb.append("AtlasImportRequest{");
    sb.append("options={");
    AtlasBaseTypeDef.dumpObjects(options, sb);
    sb.append("}");
    sb.append("}");

    return sb;
}
 
Example #22
Source File: TestUtilsV2.java    From atlas with Apache License 2.0 5 votes vote down vote up
public static AtlasEntityDef createPrimitiveEntityDef() {

        AtlasEntityDef newtestEntityDef = new AtlasEntityDef("newtest");
        AtlasAttributeDef attrName = new AtlasAttributeDef("name", AtlasBaseTypeDef.ATLAS_TYPE_STRING);

        AtlasAttributeDef attrDescription = new AtlasAttributeDef("description", AtlasBaseTypeDef.ATLAS_TYPE_STRING);
        attrDescription.setIsOptional(false);

        AtlasAttributeDef attrcheck = new AtlasAttributeDef("check", AtlasBaseTypeDef.ATLAS_TYPE_STRING);
        attrcheck.setIsOptional(true);

        AtlasAttributeDef attrSourceCode = new AtlasAttributeDef("sourcecode", AtlasBaseTypeDef.ATLAS_TYPE_STRING);
        attrSourceCode.setDefaultValue("Hello World");
        attrSourceCode.setIsOptional(true);

        AtlasAttributeDef attrCost = new AtlasAttributeDef("Cost", AtlasBaseTypeDef.ATLAS_TYPE_INT);
        attrCost.setIsOptional(true);
        attrCost.setDefaultValue("30");

        AtlasAttributeDef attrDiskUsage = new AtlasAttributeDef("diskUsage", AtlasBaseTypeDef.ATLAS_TYPE_FLOAT);
        attrDiskUsage.setIsOptional(true);
        attrDiskUsage.setDefaultValue("70.50");

        AtlasAttributeDef attrisStoreUse = new AtlasAttributeDef("isstoreUse", AtlasBaseTypeDef.ATLAS_TYPE_BOOLEAN);
        attrisStoreUse.setIsOptional(true);
        attrisStoreUse.setDefaultValue("true");

        newtestEntityDef.addAttribute(attrName);
        newtestEntityDef.addAttribute(attrDescription);
        newtestEntityDef.addAttribute(attrcheck);
        newtestEntityDef.addAttribute(attrSourceCode);
        newtestEntityDef.addAttribute(attrCost);
        newtestEntityDef.addAttribute(attrDiskUsage);
        newtestEntityDef.addAttribute(attrisStoreUse);

        populateSystemAttributes(newtestEntityDef);

        return newtestEntityDef;
    }
 
Example #23
Source File: AtlasTypeRegistry.java    From incubator-atlas with Apache License 2.0 5 votes vote down vote up
private void addTypeWithNoRefResolve(AtlasBaseTypeDef typeDef) throws AtlasBaseException{
    if (LOG.isDebugEnabled()) {
        LOG.debug("==> AtlasTypeRegistry.addTypeWithNoRefResolve({})", typeDef);
    }

    if (typeDef != null) {
        if (this.isRegisteredType(typeDef.getName())) {
            throw new AtlasBaseException(AtlasErrorCode.TYPE_ALREADY_EXISTS, typeDef.getName());
        }

        if (typeDef.getClass().equals(AtlasEnumDef.class)) {
            AtlasEnumDef enumDef = (AtlasEnumDef) typeDef;

            registryData.enumDefs.addType(enumDef, new AtlasEnumType(enumDef));
        } else if (typeDef.getClass().equals(AtlasStructDef.class)) {
            AtlasStructDef structDef = (AtlasStructDef) typeDef;

            registryData.structDefs.addType(structDef, new AtlasStructType(structDef));
        } else if (typeDef.getClass().equals(AtlasClassificationDef.class)) {
            AtlasClassificationDef classificationDef = (AtlasClassificationDef) typeDef;

            registryData.classificationDefs.addType(classificationDef,
                    new AtlasClassificationType(classificationDef));
        } else if (typeDef.getClass().equals(AtlasEntityDef.class)) {
            AtlasEntityDef entityDef = (AtlasEntityDef) typeDef;

            registryData.entityDefs.addType(entityDef, new AtlasEntityType(entityDef));
        } else if (typeDef.getClass().equals(AtlasRelationshipDef.class)) {
            AtlasRelationshipDef relationshipDef = (AtlasRelationshipDef) typeDef;

            registryData.relationshipDefs.addType(relationshipDef, new AtlasRelationshipType(relationshipDef));
        }

        addedTypes.add(typeDef);
    }

    if (LOG.isDebugEnabled()) {
        LOG.debug("<== AtlasTypeRegistry.addTypeWithNoRefResolve({})", typeDef);
    }
}
 
Example #24
Source File: AtlasTypeDefGraphStoreV1.java    From incubator-atlas with Apache License 2.0 5 votes vote down vote up
void vertexToTypeDef(AtlasVertex vertex, AtlasBaseTypeDef typeDef) {
    String name        = vertex.getProperty(Constants.TYPENAME_PROPERTY_KEY, String.class);
    String description = vertex.getProperty(Constants.TYPEDESCRIPTION_PROPERTY_KEY, String.class);
    String typeVersion = vertex.getProperty(Constants.TYPEVERSION_PROPERTY_KEY, String.class);
    String guid        = vertex.getProperty(Constants.GUID_PROPERTY_KEY, String.class);
    Long   createTime  = vertex.getProperty(Constants.TIMESTAMP_PROPERTY_KEY, Long.class);
    Long   updateTime  = vertex.getProperty(Constants.MODIFICATION_TIMESTAMP_PROPERTY_KEY, Long.class);
    Long   version     = vertex.getProperty(Constants.VERSION_PROPERTY_KEY, Long.class);
    String options     = vertex.getProperty(Constants.TYPEOPTIONS_PROPERTY_KEY, String.class);

    typeDef.setName(name);
    typeDef.setDescription(description);
    typeDef.setTypeVersion(typeVersion);
    typeDef.setGuid(guid);

    if (createTime != null) {
        typeDef.setCreateTime(new Date(createTime));
    }

    if (updateTime != null) {
        typeDef.setUpdateTime(new Date(updateTime));
    }

    if (version != null) {
        typeDef.setVersion(version);
    }

    if (options != null) {
        typeDef.setOptions(AtlasType.fromJson(options, Map.class));
    }
}
 
Example #25
Source File: AtlasImportRequest.java    From atlas with Apache License 2.0 5 votes vote down vote up
public StringBuilder toString(StringBuilder sb) {
    if (sb == null) {
        sb = new StringBuilder();
    }

    sb.append("AtlasImportRequest{");
    sb.append("options={");
    AtlasBaseTypeDef.dumpObjects(options, sb);
    sb.append("}");
    sb.append("}");

    return sb;
}
 
Example #26
Source File: AtlasArrayType.java    From atlas with Apache License 2.0 5 votes vote down vote up
public AtlasArrayType(AtlasType elementType, int minCount, int maxCount, Cardinality cardinality) {
    super(AtlasBaseTypeDef.getArrayTypeName(elementType.getTypeName()), TypeCategory.ARRAY, SERVICE_TYPE_ATLAS_CORE);

    this.elementTypeName = elementType.getTypeName();
    this.minCount        = minCount;
    this.maxCount        = maxCount;
    this.cardinality     = cardinality;
    this.elementType     = elementType;
}
 
Example #27
Source File: ChangedTypeDefs.java    From atlas with Apache License 2.0 5 votes vote down vote up
private boolean hasEntityDef(List<? extends AtlasBaseTypeDef> typeDefs) {
    boolean ret = false;

    if (CollectionUtils.isNotEmpty(typeDefs)) {
        for (AtlasBaseTypeDef typeDef : typeDefs) {
            if (typeDef instanceof AtlasEntityDef) {
                ret = true;

                break;
            }
        }
    }

    return ret;
}
 
Example #28
Source File: AtlasTypeRegistry.java    From incubator-atlas with Apache License 2.0 5 votes vote down vote up
public void addType(AtlasBaseTypeDef typeDef, AtlasType type) {
    if (typeDef != null && type != null) {
        if (StringUtils.isNotEmpty(typeDef.getGuid())) {
            typeGuidMap.put(typeDef.getGuid(), type);
        }

        if (StringUtils.isNotEmpty(typeDef.getName())) {
            typeNameMap.put(typeDef.getName(), type);
        }
    }
}
 
Example #29
Source File: AtlasTypeRegistry.java    From atlas with Apache License 2.0 5 votes vote down vote up
public void updateType(AtlasBaseTypeDef typeDef) throws AtlasBaseException {
    if (LOG.isDebugEnabled()) {
        LOG.debug("==> AtlasTypeRegistry.updateType({})", typeDef);
    }

    if (typeDef != null) {
        updateTypeWithNoRefResolve(typeDef);
    }

    resolveReferences();

    if (LOG.isDebugEnabled()) {
        LOG.debug("<== AtlasTypeRegistry.updateType({})", typeDef);
    }
}
 
Example #30
Source File: AtlasMapType.java    From atlas with Apache License 2.0 5 votes vote down vote up
public AtlasMapType(AtlasType keyType, AtlasType valueType) {
    super(AtlasBaseTypeDef.getMapTypeName(keyType.getTypeName(), valueType.getTypeName()), TypeCategory.MAP, SERVICE_TYPE_ATLAS_CORE);

    this.keyTypeName   = keyType.getTypeName();
    this.valueTypeName = valueType.getTypeName();
    this.keyType       = keyType;
    this.valueType     = valueType;
}