package fr.ekito.example.domain; import org.joda.time.DateTime; import org.springframework.data.annotation.CreatedBy; import org.springframework.data.annotation.CreatedDate; import org.springframework.data.annotation.LastModifiedBy; import org.springframework.data.annotation.LastModifiedDate; import org.springframework.data.mongodb.core.mapping.Field; import javax.validation.constraints.NotNull; /** * Base abstract class for entities which will hold definitions for created, last modified by and created, * last modified by date. */ public abstract class AbstractAuditingEntity { @CreatedBy @Field("created_by") private String createdBy; @CreatedDate @Field("created_date") private DateTime createdDate = DateTime.now(); @LastModifiedBy @Field("last_modified_by") private String lastModifiedBy; @LastModifiedDate @Field("last_modified_date ") private DateTime lastModifiedDate = DateTime.now(); public String getCreatedBy() { return createdBy; } public void setCreatedBy(String createdBy) { this.createdBy = createdBy; } public DateTime getCreatedDate() { return createdDate; } public void setCreatedDate(DateTime createdDate) { this.createdDate = createdDate; } public String getLastModifiedBy() { return lastModifiedBy; } public void setLastModifiedBy(String lastModifiedBy) { this.lastModifiedBy = lastModifiedBy; } public DateTime getLastModifiedDate() { return lastModifiedDate; } public void setLastModifiedDate(DateTime lastModifiedDate) { this.lastModifiedDate = lastModifiedDate; } }