use of org.hisp.dhis.artemis.audit.AuditableEntity in project dhis2-core by dhis2.
the class AbstractEventAuditPostProcessor method process.
@Override
public void process(final Event event, final WorkContext ctx) {
final AuditManager auditManager = ctx.getServiceDelegator().getAuditManager();
final EventImporterUserService eventImporterUserService = ctx.getServiceDelegator().getEventImporterUserService();
final ProgramStageInstanceMapper programStageInstanceMapper = new ProgramStageInstanceMapper(ctx);
final ProgramStageInstance programStageInstance = programStageInstanceMapper.map(event);
auditManager.send(Audit.builder().auditType(getAuditType()).auditScope(AuditScope.TRACKER).createdAt(LocalDateTime.now()).createdBy(eventImporterUserService.getAuditUsername()).object(programStageInstance).auditableEntity(new AuditableEntity(ProgramStageInstance.class, programStageInstance)).build());
}
use of org.hisp.dhis.artemis.audit.AuditableEntity in project dhis2-core by dhis2.
the class HibernatePotentialDuplicateStore method auditMerge.
@Override
public void auditMerge(DeduplicationMergeParams params) {
TrackedEntityInstance duplicate = params.getDuplicate();
MergeObject mergeObject = params.getMergeObject();
mergeObject.getRelationships().forEach(rel -> {
duplicate.getRelationshipItems().stream().map(RelationshipItem::getRelationship).filter(r -> r.getUid().equals(rel)).findAny().ifPresent(relationship -> auditManager.send(Audit.builder().auditScope(AuditScope.TRACKER).auditType(AuditType.UPDATE).createdAt(LocalDateTime.now()).object(relationship).klass(HibernateProxyUtils.getRealClass(relationship).getCanonicalName()).uid(rel).auditableEntity(new AuditableEntity(Relationship.class, relationship)).build()));
});
}
use of org.hisp.dhis.artemis.audit.AuditableEntity in project dhis2-core by dhis2.
the class JdbcMaintenanceStore method auditHardDeletedEntity.
private void auditHardDeletedEntity(List<String> deletedEnrollments, Class<? extends SoftDeletableObject> entity) {
deletedEnrollments.forEach(enrolment -> {
SoftDeletableObject object = ENTITY_MAPPER.getOrDefault(entity, new SoftDeletableObject());
object.setUid(enrolment);
object.setDeleted(true);
auditManager.send(Audit.builder().auditType(AuditType.DELETE).auditScope(AuditScope.TRACKER).createdAt(LocalDateTime.now()).object(object).uid(enrolment).auditableEntity(new AuditableEntity(entity, object)).build());
});
}
Aggregations