use of org.apache.atlas.v1.model.instance.Referenceable in project atlas by apache.
the class EntityAuditListener method onTraitsUpdated.
@Override
public void onTraitsUpdated(Referenceable entity, Collection<? extends Struct> traits) throws AtlasException {
if (traits != null) {
for (Struct trait : traits) {
EntityAuditEvent event = createEvent(entity, EntityAuditAction.TAG_UPDATE, "Updated trait: " + AtlasType.toV1Json(trait));
auditRepository.putEventsV1(event);
}
}
}
use of org.apache.atlas.v1.model.instance.Referenceable in project atlas by apache.
the class EntityAuditListener method pruneAttributes.
private Map<String, Object> pruneAttributes(Map<String, Object> ret, Referenceable attribute) throws AtlasException {
Referenceable attrInstance = attribute;
Map<String, Object> prunedAttrs = pruneEntityAttributesForAudit(attrInstance);
if (MapUtils.isNotEmpty(prunedAttrs)) {
if (ret == null) {
ret = new HashMap<>();
}
ret.put(attrInstance.getId()._getId(), prunedAttrs);
}
return ret;
}
use of org.apache.atlas.v1.model.instance.Referenceable in project atlas by apache.
the class EntityAuditListener method onTraitsAdded.
@Override
public void onTraitsAdded(Referenceable entity, Collection<? extends Struct> traits) throws AtlasException {
if (traits != null) {
for (Struct trait : traits) {
EntityAuditEvent event = createEvent(entity, EntityAuditAction.TAG_ADD, "Added trait: " + AtlasType.toV1Json(trait));
auditRepository.putEventsV1(event);
}
}
}
use of org.apache.atlas.v1.model.instance.Referenceable in project atlas by apache.
the class EntityAuditListener method onEntitiesAdded.
@Override
public void onEntitiesAdded(Collection<Referenceable> entities, boolean isImport) throws AtlasException {
List<EntityAuditEvent> events = new ArrayList<>();
for (Referenceable entity : entities) {
EntityAuditEvent event = createEvent(entity, isImport ? EntityAuditAction.ENTITY_IMPORT_CREATE : EntityAuditAction.ENTITY_CREATE);
events.add(event);
}
auditRepository.putEventsV1(events);
}
use of org.apache.atlas.v1.model.instance.Referenceable in project atlas by apache.
the class EntityAuditListener method onEntitiesDeleted.
@Override
public void onEntitiesDeleted(Collection<Referenceable> entities, boolean isImport) throws AtlasException {
List<EntityAuditEvent> events = new ArrayList<>();
for (Referenceable entity : entities) {
EntityAuditEvent event = createEvent(entity, isImport ? EntityAuditAction.ENTITY_IMPORT_DELETE : EntityAuditAction.ENTITY_DELETE, "Deleted entity");
events.add(event);
}
auditRepository.putEventsV1(events);
}
Aggregations