io.zenwave360.sdk.mongodb2jdl.AbstractAuditingEntity Maven / Gradle / Ivy
package io.zenwave360.sdk.mongodb2jdl;
import java.io.Serializable;
import java.time.Instant;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.mongodb.core.mapping.Field;
import com.fasterxml.jackson.annotation.JsonIgnore;
/**
* Base abstract class for entities which will hold definitions for created, last modified, created by, last modified by attributes.
*/
public abstract class AbstractAuditingEntity implements Serializable {
private static final long serialVersionUID = 1L;
@Field("created_by")
@JsonIgnore
private String createdBy;
@CreatedDate
@Field("created_date")
@JsonIgnore
private Instant createdDate = Instant.now();
@Field("last_modified_by")
@JsonIgnore
private String lastModifiedBy;
@LastModifiedDate
@Field("last_modified_date")
@JsonIgnore
private Instant lastModifiedDate = Instant.now();
public String getCreatedBy() {
return createdBy;
}
public void setCreatedBy(String createdBy) {
this.createdBy = createdBy;
}
public Instant getCreatedDate() {
return createdDate;
}
public void setCreatedDate(Instant createdDate) {
this.createdDate = createdDate;
}
public String getLastModifiedBy() {
return lastModifiedBy;
}
public void setLastModifiedBy(String lastModifiedBy) {
this.lastModifiedBy = lastModifiedBy;
}
public Instant getLastModifiedDate() {
return lastModifiedDate;
}
public void setLastModifiedDate(Instant lastModifiedDate) {
this.lastModifiedDate = lastModifiedDate;
}
}