Search in sources :

Example 1 with EventImporterUserService

use of org.hisp.dhis.dxf2.events.importer.EventImporterUserService 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());
}
Also used : EventImporterUserService(org.hisp.dhis.dxf2.events.importer.EventImporterUserService) AuditableEntity(org.hisp.dhis.artemis.audit.AuditableEntity) AuditManager(org.hisp.dhis.artemis.audit.AuditManager) ProgramStageInstanceMapper(org.hisp.dhis.dxf2.events.importer.mapper.ProgramStageInstanceMapper) ProgramStageInstance(org.hisp.dhis.program.ProgramStageInstance)

Aggregations

AuditManager (org.hisp.dhis.artemis.audit.AuditManager)1 AuditableEntity (org.hisp.dhis.artemis.audit.AuditableEntity)1 EventImporterUserService (org.hisp.dhis.dxf2.events.importer.EventImporterUserService)1 ProgramStageInstanceMapper (org.hisp.dhis.dxf2.events.importer.mapper.ProgramStageInstanceMapper)1 ProgramStageInstance (org.hisp.dhis.program.ProgramStageInstance)1