From d4d4260fd9b796cfc97824bb9ec7808e874b6701 Mon Sep 17 00:00:00 2001 From: "1437892690@qq.com" <1437892690@qq.com> Date: Tue, 20 Aug 2024 20:43:23 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96=E9=80=9A=E7=9F=A5=E7=AD=96=E7=95=A5=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E8=A7=A6=E5=8F=91=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1227345283743744]自动化通知策略增加触发点 http://192.168.0.96:8090/demo/rdm.html#/story-detail/939050947543040/939050947543042/1227345283743744 --- .../DeployJobNotifyTriggerType.java | 36 +++++++++++++++---- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/src/main/java/neatlogic/framework/deploy/constvalue/DeployJobNotifyTriggerType.java b/src/main/java/neatlogic/framework/deploy/constvalue/DeployJobNotifyTriggerType.java index 24812be..cef245a 100644 --- a/src/main/java/neatlogic/framework/deploy/constvalue/DeployJobNotifyTriggerType.java +++ b/src/main/java/neatlogic/framework/deploy/constvalue/DeployJobNotifyTriggerType.java @@ -14,8 +14,12 @@ You should have received a copy of the GNU Affero General Public License along with this program. If not, see .*/ package neatlogic.framework.deploy.constvalue; +import neatlogic.framework.autoexec.constvalue.JobStatus; import neatlogic.framework.notify.core.INotifyTriggerType; -import neatlogic.framework.util.I18n; +import neatlogic.framework.util.$; + +import java.util.Arrays; +import java.util.List; /** * @author longrf @@ -24,17 +28,26 @@ import neatlogic.framework.util.I18n; public enum DeployJobNotifyTriggerType implements INotifyTriggerType { - FAILED("failed", new I18n("作业失败"), new I18n("作业失败时触发通知")), + JOB_FAILED("jobfailed", "nfac.autoexecjobnotifytriggertype.text.jobfailed", "nfac.autoexecjobnotifytriggertype.description.jobfailed", + Arrays.asList(JobStatus.FAILED.getValue())), + + JOB_COMPLETED("jobcompleted", "nfac.autoexecjobnotifytriggertype.text.jobcompleted", "nfac.autoexecjobnotifytriggertype.description.jobcompleted", + Arrays.asList(JobStatus.COMPLETED.getValue())), + + JOB_WAIT_INPUT("jobwaitinput", "nfac.autoexecjobnotifytriggertype.text.jobwaitinput", "nfac.autoexecjobnotifytriggertype.description.jobwaitinput", + Arrays.asList(JobStatus.WAIT_INPUT.getValue())), ; private final String trigger; - private final I18n text; - private final I18n description; + private final String text; + private final String description; + private final List jobStatusList; - DeployJobNotifyTriggerType(String _trigger, I18n _text, I18n _description) { + DeployJobNotifyTriggerType(String _trigger, String _text, String _description, List _jobStatusList) { this.trigger = _trigger; this.text = _text; this.description = _description; + this.jobStatusList = _jobStatusList; } @Override @@ -44,12 +57,12 @@ public enum DeployJobNotifyTriggerType implements INotifyTriggerType { @Override public String getText() { - return text.toString(); + return $.t(text); } @Override public String getDescription() { - return description.toString(); + return $.t(description); } public static String getText(String trigger) { @@ -69,4 +82,13 @@ public enum DeployJobNotifyTriggerType implements INotifyTriggerType { } return null; } + + public static DeployJobNotifyTriggerType getTriggerByStatus(String status) { + for (DeployJobNotifyTriggerType n : values()) { + if (n.jobStatusList.contains(status)) { + return n; + } + } + return null; + } } -- Gitee