Search in sources :

Example 6 with EntityChangeListener

use of org.apache.atlas.listener.EntityChangeListener in project incubator-atlas by apache.

the class AtlasEntityChangeNotifier method onClassificationUpdatedToEntity.

public void onClassificationUpdatedToEntity(String entityId, List<AtlasClassification> classifications) throws AtlasBaseException {
    // Since the classification attributes are updated in the graph, we need to recursively remap the entityText
    doFullTextMapping(entityId);
    ITypedReferenceableInstance entity = toITypedReferenceable(entityId);
    List<ITypedStruct> traits = toITypedStructs(classifications);
    if (entity == null || CollectionUtils.isEmpty(traits)) {
        return;
    }
    for (EntityChangeListener listener : entityChangeListeners) {
        try {
            listener.onTraitsUpdated(entity, traits);
        } catch (AtlasException e) {
            throw new AtlasBaseException(AtlasErrorCode.NOTIFICATION_FAILED, e, getListenerName(listener), "TraitUpdate");
        }
    }
}
Also used : EntityChangeListener(org.apache.atlas.listener.EntityChangeListener) AtlasBaseException(org.apache.atlas.exception.AtlasBaseException) ITypedReferenceableInstance(org.apache.atlas.typesystem.ITypedReferenceableInstance) ITypedStruct(org.apache.atlas.typesystem.ITypedStruct) AtlasException(org.apache.atlas.AtlasException)

Example 7 with EntityChangeListener

use of org.apache.atlas.listener.EntityChangeListener in project incubator-atlas by apache.

the class AtlasEntityChangeNotifier method onClassificationDeletedFromEntity.

public void onClassificationDeletedFromEntity(String entityId, List<String> traitNames) throws AtlasBaseException {
    // Since the entity has already been modified in the graph, we need to recursively remap the entity
    doFullTextMapping(entityId);
    ITypedReferenceableInstance entity = toITypedReferenceable(entityId);
    if (entity == null || CollectionUtils.isEmpty(traitNames)) {
        return;
    }
    for (EntityChangeListener listener : entityChangeListeners) {
        try {
            listener.onTraitsDeleted(entity, traitNames);
        } catch (AtlasException e) {
            throw new AtlasBaseException(AtlasErrorCode.NOTIFICATION_FAILED, e, getListenerName(listener), "TraitDelete");
        }
    }
}
Also used : EntityChangeListener(org.apache.atlas.listener.EntityChangeListener) AtlasBaseException(org.apache.atlas.exception.AtlasBaseException) ITypedReferenceableInstance(org.apache.atlas.typesystem.ITypedReferenceableInstance) AtlasException(org.apache.atlas.AtlasException)

Aggregations

EntityChangeListener (org.apache.atlas.listener.EntityChangeListener)7 AtlasException (org.apache.atlas.AtlasException)6 AtlasBaseException (org.apache.atlas.exception.AtlasBaseException)6 EntityChangeListenerV2 (org.apache.atlas.listener.EntityChangeListenerV2)3 ITypedReferenceableInstance (org.apache.atlas.typesystem.ITypedReferenceableInstance)3 Referenceable (org.apache.atlas.v1.model.instance.Referenceable)3 ITypedStruct (org.apache.atlas.typesystem.ITypedStruct)2 Struct (org.apache.atlas.v1.model.instance.Struct)2 TypesChangeListener (org.apache.atlas.listener.TypesChangeListener)1 InMemoryEntityAuditRepository (org.apache.atlas.repository.audit.InMemoryEntityAuditRepository)1 GraphBackedSearchIndexer (org.apache.atlas.repository.graph.GraphBackedSearchIndexer)1 GraphBackedTypeStore (org.apache.atlas.repository.typestore.GraphBackedTypeStore)1 ITypeStore (org.apache.atlas.repository.typestore.ITypeStore)1 DefaultMetadataService (org.apache.atlas.services.DefaultMetadataService)1 AtlasTypeRegistry (org.apache.atlas.type.AtlasTypeRegistry)1 DefaultTypeCache (org.apache.atlas.typesystem.types.cache.DefaultTypeCache)1 TypeCache (org.apache.atlas.typesystem.types.cache.TypeCache)1 AtlasRepositoryConfiguration (org.apache.atlas.util.AtlasRepositoryConfiguration)1 Configuration (org.apache.commons.configuration.Configuration)1