add lock on created/updated by

This commit is contained in:
Shaun Chyxion 2018-03-25 21:18:43 +08:00
parent ace2e1cd34
commit e61db1f379
2 changed files with 38 additions and 3 deletions

View File

@ -1,7 +1,6 @@
package me.chyxion.tigon.form;
import lombok.Getter;
import lombok.Setter;
import me.chyxion.tigon.validation.annotation.NotNullOrBlank;
/**
@ -12,10 +11,28 @@ import me.chyxion.tigon.validation.annotation.NotNullOrBlank;
* Oct 8, 2016 6:26:19 PM
*/
@Getter
@Setter
public class FC2<CreatorId> extends FC1 {
private static final long serialVersionUID = 1L;
private transient boolean __lock = true;
@NotNullOrBlank
protected CreatorId createdBy;
/**
* set created by
* @param createdBy created by
*/
public void setCreatedBy(final CreatorId createdBy) {
if (!__lock) {
this.createdBy = createdBy;
__lock = true;
}
}
/**
* unlock set created by
*/
public void unlock() {
__lock = false;
}
}

View File

@ -12,11 +12,29 @@ import me.chyxion.tigon.validation.annotation.NotNullOrBlank;
* Oct 8, 2016 6:26:36 PM
*/
@Getter
@Setter
public class FU2<EditorId, Id>
extends FU1<Id> {
private static final long serialVersionUID = 1L;
private transient boolean __lock = true;
@NotNullOrBlank
private EditorId updatedBy;
/**
* set updated by
* @param updatedBy updated by
*/
public void setUpdatedBy(final EditorId updatedBy) {
if (!__lock) {
this.updatedBy = updatedBy;
__lock = true;
}
}
/**
* unlock set created by
*/
public void unlock() {
__lock = false;
}
}