Skip to content

Commit

Permalink
Apply fixes (based on review)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamsaghy authored and galovics committed Jul 26, 2022
1 parent 25823a9 commit 7000380
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@

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;
Expand All @@ -38,7 +37,7 @@
*/
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;
Expand Down Expand Up @@ -129,12 +128,12 @@ private <T> T touch(Auditor auditor, T target, boolean isNew) {
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();
Expand Down

0 comments on commit 7000380

Please sign in to comment.