diff --git a/src/main/java/neatlogic/framework/autoexec/constvalue/AutoexecJobNotifyTriggerType.java b/src/main/java/neatlogic/framework/autoexec/constvalue/AutoexecJobNotifyTriggerType.java index c748f4faf9bcc859faf830e1af346b85d0663871..0e615b4cb46b54fc8a8cd20682b50319899b45c6 100644 --- a/src/main/java/neatlogic/framework/autoexec/constvalue/AutoexecJobNotifyTriggerType.java +++ b/src/main/java/neatlogic/framework/autoexec/constvalue/AutoexecJobNotifyTriggerType.java @@ -18,19 +18,31 @@ package neatlogic.framework.autoexec.constvalue; import neatlogic.framework.notify.core.INotifyTriggerType; import neatlogic.framework.util.$; +import java.util.Arrays; +import java.util.List; + public enum AutoexecJobNotifyTriggerType implements INotifyTriggerType { - JOB_FAILED("jobfailed", "nfac.autoexecjobnotifytriggertype.text.jobfailed", "nfac.autoexecjobnotifytriggertype.description.jobfailed"), + 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 String text; private final String description; + private final List jobStatusList; - AutoexecJobNotifyTriggerType(String _trigger, String _text, String _description) { + AutoexecJobNotifyTriggerType(String _trigger, String _text, String _description, List _jobStatusList) { this.trigger = _trigger; this.text = _text; this.description = _description; + this.jobStatusList = _jobStatusList; } @Override @@ -65,4 +77,13 @@ public enum AutoexecJobNotifyTriggerType implements INotifyTriggerType { } return null; } + + public static AutoexecJobNotifyTriggerType getTriggerByStatus(String status) { + for (AutoexecJobNotifyTriggerType n : values()) { + if (n.jobStatusList.contains(status)) { + return n; + } + } + return null; + } } diff --git a/src/main/java/neatlogic/framework/autoexec/constvalue/AutoexecNotifyParam.java b/src/main/java/neatlogic/framework/autoexec/constvalue/AutoexecNotifyParam.java new file mode 100644 index 0000000000000000000000000000000000000000..74a510476430d3438bc50542a5fe9b8b946dbf05 --- /dev/null +++ b/src/main/java/neatlogic/framework/autoexec/constvalue/AutoexecNotifyParam.java @@ -0,0 +1,49 @@ +/*Copyright (C) $today.year 深圳极向量科技有限公司 All Rights Reserved. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see .*/ + +package neatlogic.framework.autoexec.constvalue; + +import neatlogic.framework.common.constvalue.ParamType; +import neatlogic.framework.notify.core.INotifyParam; +import neatlogic.framework.util.$; + +public enum AutoexecNotifyParam implements INotifyParam { + CREATE_JOB_FAILED_CONTENT("createjobfailedcontent", "创建作业失败原因", ParamType.STRING), + ; + private final String value; + private final String text; + private final ParamType paramType; + + AutoexecNotifyParam(String value, String text, ParamType paramType) { + this.value = value; + this.text = text; + this.paramType = paramType; + } + + @Override + public String getValue() { + return value; + } + + @Override + public String getText() { + return $.t(text); + } + + @Override + public ParamType getParamType() { + return paramType; + } +} diff --git a/src/main/java/neatlogic/framework/autoexec/constvalue/AutoexecNotifyTriggerType.java b/src/main/java/neatlogic/framework/autoexec/constvalue/AutoexecNotifyTriggerType.java new file mode 100644 index 0000000000000000000000000000000000000000..0f86f365f1f57d9fb86f2a9da2f551fe7ca0ddfd --- /dev/null +++ b/src/main/java/neatlogic/framework/autoexec/constvalue/AutoexecNotifyTriggerType.java @@ -0,0 +1,68 @@ +/*Copyright (C) 2024 深圳极向量科技有限公司 All Rights Reserved. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU Affero General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Affero General Public License for more details. + +You should have received a copy of the GNU Affero General Public License +along with this program. If not, see .*/ + +package neatlogic.framework.autoexec.constvalue; + +import neatlogic.framework.notify.core.INotifyTriggerType; +import neatlogic.framework.util.$; + +public enum AutoexecNotifyTriggerType implements INotifyTriggerType { + + CREATE_JOB_FAILED("createjobfailed", "nfac.autoexecnotifytriggertype.text.createjobfailed", "nfac.autoexecnotifytriggertype.description.createjobfailed"), + ; + + private final String trigger; + private final String text; + private final String description; + + AutoexecNotifyTriggerType(String _trigger, String _text, String _description) { + this.trigger = _trigger; + this.text = _text; + this.description = _description; + } + + @Override + public String getTrigger() { + return trigger; + } + + @Override + public String getText() { + return $.t(text); + } + + @Override + public String getDescription() { + return $.t(description); + } + + public static String getText(String trigger) { + for (AutoexecNotifyTriggerType n : values()) { + if (n.getTrigger().equals(trigger)) { + return n.getText(); + } + } + return ""; + } + + public static AutoexecNotifyTriggerType getTrigger(String trigger) { + for (AutoexecNotifyTriggerType n : values()) { + if (n.getTrigger().equals(trigger)) { + return n; + } + } + return null; + } +}