package com.pollex.pam.aop.logging.audit.strategy; import com.pollex.pam.aop.logging.audit.AuditLoggingType; import com.pollex.pam.domain.AuditLogging; import com.pollex.pam.repository.AuditLoggingRepository; import com.pollex.pam.security.SecurityUtils; import org.aspectj.lang.ProceedingJoinPoint; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; import static com.pollex.pam.aop.logging.audit.AuditLoggingType.CONSULTANT_SEND_FILL_SATISFACTION_NOTICE; @Component @Transactional public class LoggingSendFillSatisfactionNoticeStrategy implements AuditLoggingStrategy{ @Autowired AuditLoggingRepository auditLoggingRepository; @Override public AuditLoggingType getType() { return CONSULTANT_SEND_FILL_SATISFACTION_NOTICE; } @Override public void auditLogging(ProceedingJoinPoint joinPoint) { AuditLogging auditLogging = new AuditLogging(); auditLogging.setFunctionalType(getType()); auditLogging.setCreatedBy(SecurityUtils.getCurrentUserLogin().orElse(null)); auditLoggingRepository.save(auditLogging); } }