Apply fixes (based on review)

This commit is contained in:
Adam Saghy
2022-07-26 09:56:30 +02:00
committed by Arnold Gálovics
parent 25823a9377
commit 700038020e
3 changed files with 14 additions and 19 deletions
@@ -180,14 +180,15 @@ public class Client extends AbstractAuditableWithUTCDateTimeCustom {
@Column(name = "submittedon_date", nullable = true)
private LocalDate submittedOnDate;
// Deprecated since common Auditable fields were introduced. Columns and data left untouched to help migration.
// @Column(name = "updated_on", nullable = true)
// private LocalDate updatedOnDate;
// @ManyToOne(optional = true, fetch = FetchType.LAZY)
// @JoinColumn(name = "updated_by", nullable = true)
// private AppUser updatedBy;
/*
* Deprecated since common Auditable fields were introduced. Columns and data left untouched to help migration.
*
* @Column(name = "updated_on", nullable = true) private LocalDate updatedOnDate;
*
* @ManyToOne(optional = true, fetch = FetchType.LAZY)
*
* @JoinColumn(name = "updated_by", nullable = true) private AppUser updatedBy;
*/
@ManyToOne(optional = true, fetch = FetchType.LAZY)
@JoinColumn(name = "activatedon_userid", nullable = true)
@@ -218,11 +218,6 @@ public class Loan extends AbstractAuditableWithUTCDateTimeCustom {
// loan application states
@Column(name = "submittedon_date")
private LocalDate submittedOnDate;
// @ManyToOne(optional = true, fetch = FetchType.LAZY)
// @JoinColumn(name = "submittedon_userid", nullable = true)
// private AppUser submittedBy;
@Column(name = "rejectedon_date")
private LocalDate rejectedOnDate;
@@ -20,11 +20,10 @@ package org.springframework.data.auditing;
import java.time.temporal.TemporalAccessor;
import java.util.Optional;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.fineract.infrastructure.core.auditing.CustomDateTimeProvider;
import org.apache.fineract.infrastructure.core.domain.AbstractAuditableWithUTCDateTimeCustom;
import org.springframework.core.log.LogMessage;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.AuditorAware;
import org.springframework.data.mapping.PersistentEntity;
import org.springframework.data.mapping.PersistentProperty;
@@ -38,7 +37,7 @@ import org.springframework.util.Assert;
*/
public class CustomAuditingHandler extends AuditingHandler {
private static final Log logger = LogFactory.getLog(CustomAuditingHandler.class);
private static final Logger LOG = LoggerFactory.getLogger(CustomAuditingHandler.class);
private final AuditableBeanWrapperFactory factory;
private boolean dateTimeForNow = true;
private boolean modifyOnCreation = true;
@@ -129,12 +128,12 @@ public class CustomAuditingHandler extends AuditingHandler {
touchAuditor(auditor, it, isNew);
Optional<TemporalAccessor> now = dateTimeForNow ? touchDate(it, isNew) : Optional.empty();
if (logger.isDebugEnabled()) {
if (LOG.isDebugEnabled()) {
Object defaultedNow = now.map(Object::toString).orElse("not set");
Object defaultedAuditor = auditor.isPresent() ? auditor.toString() : "unknown";
logger.debug(LogMessage.format("Touched %s - Last modification at %s by %s", target, defaultedNow, defaultedAuditor));
LOG.debug("Touched {} - Last modification at {} by {}", target, defaultedNow, defaultedAuditor);
}
return it.getBean();