use of org.apache.atlas.notification.entity.EntityNotificationImpl in project incubator-atlas by apache.
the class NotificationEntityChangeListener method notifyOfEntityEvent.
// send notification of entity change
private void notifyOfEntityEvent(Collection<ITypedReferenceableInstance> entityDefinitions, EntityNotification.OperationType operationType) throws AtlasException {
List<EntityNotification> messages = new LinkedList<>();
for (IReferenceableInstance entityDefinition : entityDefinitions) {
Referenceable entity = new Referenceable(entityDefinition);
Map<String, Object> attributesMap = entity.getValuesMap();
List<String> entityNotificationAttrs = getNotificationAttributes(entity.getTypeName());
if (MapUtils.isNotEmpty(attributesMap) && CollectionUtils.isNotEmpty(entityNotificationAttrs)) {
for (String entityAttr : attributesMap.keySet()) {
if (!entityNotificationAttrs.contains(entityAttr)) {
entity.setNull(entityAttr);
}
}
}
EntityNotificationImpl notification = new EntityNotificationImpl(entity, operationType, getAllTraits(entity, typeSystem));
messages.add(notification);
}
notificationInterface.send(NotificationInterface.NotificationType.ENTITIES, messages);
}
Aggregations