From e61db1f3791615ca54ad5244721d6bac7a57ac07 Mon Sep 17 00:00:00 2001 From: Shaun Chyxion Date: Sun, 25 Mar 2018 21:18:43 +0800 Subject: [PATCH] add lock on created/updated by --- .../main/java/me/chyxion/tigon/form/FC2.java | 21 +++++++++++++++++-- .../main/java/me/chyxion/tigon/form/FU2.java | 20 +++++++++++++++++- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/tigon-model/src/main/java/me/chyxion/tigon/form/FC2.java b/tigon-model/src/main/java/me/chyxion/tigon/form/FC2.java index b6fa0b3..9586148 100644 --- a/tigon-model/src/main/java/me/chyxion/tigon/form/FC2.java +++ b/tigon-model/src/main/java/me/chyxion/tigon/form/FC2.java @@ -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 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; + } } diff --git a/tigon-model/src/main/java/me/chyxion/tigon/form/FU2.java b/tigon-model/src/main/java/me/chyxion/tigon/form/FU2.java index 2589e84..f63beab 100644 --- a/tigon-model/src/main/java/me/chyxion/tigon/form/FU2.java +++ b/tigon-model/src/main/java/me/chyxion/tigon/form/FU2.java @@ -12,11 +12,29 @@ import me.chyxion.tigon.validation.annotation.NotNullOrBlank; * Oct 8, 2016 6:26:36 PM */ @Getter -@Setter public class FU2 extends FU1 { 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; + } }