diff --git a/src/main/java/neatlogic/framework/autoexec/crossover/IAutoexecJobCrossoverService.java b/src/main/java/neatlogic/framework/autoexec/crossover/IAutoexecJobCrossoverService.java index e5b53e23c98ed50ea0a30cdf9c7b7cf180c555f6..cd0bff51cc5f08e246ee1c68be36c33988552eef 100644 --- a/src/main/java/neatlogic/framework/autoexec/crossover/IAutoexecJobCrossoverService.java +++ b/src/main/java/neatlogic/framework/autoexec/crossover/IAutoexecJobCrossoverService.java @@ -16,6 +16,7 @@ along with this program. If not, see .*/ package neatlogic.framework.autoexec.crossover; import neatlogic.framework.autoexec.dto.job.AutoexecJobVo; +import neatlogic.framework.cmdb.dto.resourcecenter.ResourceVo; import neatlogic.framework.crossover.ICrossoverService; import java.util.List; @@ -29,4 +30,14 @@ public interface IAutoexecJobCrossoverService extends ICrossoverService { List searchJob(AutoexecJobVo jobVo); void saveAutoexecCombopJob(AutoexecJobVo jobVo); + + + /** + * 获取目标节点并入库 + * @param jobVo 作业 + * @param resourceVoList 资产列表 + * @param userName 执行用户 + * @param protocolId 协议id + */ + void updateJobPhaseNode(AutoexecJobVo jobVo, List resourceVoList, String userName, Long protocolId); } diff --git a/src/main/java/neatlogic/framework/autoexec/dto/combop/AutoexecCombopExecuteNodeConfigVo.java b/src/main/java/neatlogic/framework/autoexec/dto/combop/AutoexecCombopExecuteNodeConfigVo.java index ad59f06cf71384cfec6d012d9da63eae168d23d3..c20b015ff8e36927e4c39788857790940d91ad77 100644 --- a/src/main/java/neatlogic/framework/autoexec/dto/combop/AutoexecCombopExecuteNodeConfigVo.java +++ b/src/main/java/neatlogic/framework/autoexec/dto/combop/AutoexecCombopExecuteNodeConfigVo.java @@ -40,6 +40,8 @@ public class AutoexecCombopExecuteNodeConfigVo implements Serializable { private List inputNodeList; @EntityField(name = "过滤器选择条件", type = ApiParamType.JSONOBJECT) private JSONObject filter; // 过滤器 + @EntityField(name = "其他场景过滤器", type = ApiParamType.JSONOBJECT) + private JSONObject otherFilter; @EntityField(name = "上游出参列表", type = ApiParamType.JSONARRAY) private List preOutputList; @@ -75,6 +77,14 @@ public class AutoexecCombopExecuteNodeConfigVo implements Serializable { this.filter = filter; } + public JSONObject getOtherFilter() { + return otherFilter; + } + + public void setOtherFilter(JSONObject otherFilter) { + this.otherFilter = otherFilter; + } + public List getPreOutputList() { return preOutputList; } @@ -85,6 +95,6 @@ public class AutoexecCombopExecuteNodeConfigVo implements Serializable { @JSONField(serialize = false) public boolean isNull(){ - return CollectionUtils.isEmpty(paramList) && CollectionUtils.isEmpty(selectNodeList) && CollectionUtils.isEmpty(inputNodeList) && MapUtils.isEmpty(filter) && CollectionUtils.isEmpty(preOutputList); + return CollectionUtils.isEmpty(paramList) && CollectionUtils.isEmpty(selectNodeList) && CollectionUtils.isEmpty(inputNodeList) && MapUtils.isEmpty(filter) && MapUtils.isEmpty(otherFilter) && CollectionUtils.isEmpty(preOutputList); } } diff --git a/src/main/java/neatlogic/framework/autoexec/job/node/IUpdateNodes.java b/src/main/java/neatlogic/framework/autoexec/job/node/IUpdateNodes.java new file mode 100644 index 0000000000000000000000000000000000000000..1f01a9e98e99eab3e9001676bddb0b783f06a33f --- /dev/null +++ b/src/main/java/neatlogic/framework/autoexec/job/node/IUpdateNodes.java @@ -0,0 +1,32 @@ +/*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.job.node; + +import neatlogic.framework.autoexec.dto.combop.AutoexecCombopExecuteNodeConfigVo; +import neatlogic.framework.autoexec.dto.job.AutoexecJobVo; + +public interface IUpdateNodes { + + /** + * 更新自动化执行目标 + * @param executeNodeConfigVo 执行目标配置 + * @param jobVo 作业 + * @param userName 执行用户 + * @param protocolId 协议id + */ + boolean update(AutoexecCombopExecuteNodeConfigVo executeNodeConfigVo, AutoexecJobVo jobVo, String userName, Long protocolId); + +} diff --git a/src/main/java/neatlogic/framework/autoexec/job/node/UpdateNodesFactory.java b/src/main/java/neatlogic/framework/autoexec/job/node/UpdateNodesFactory.java new file mode 100644 index 0000000000000000000000000000000000000000..6d7c993f877564709921d8b579b1d821f18e2bc1 --- /dev/null +++ b/src/main/java/neatlogic/framework/autoexec/job/node/UpdateNodesFactory.java @@ -0,0 +1,68 @@ +/*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.job.node; + +import neatlogic.framework.applicationlistener.core.ModuleInitializedListenerBase; +import neatlogic.framework.autoexec.dto.combop.AutoexecCombopExecuteNodeConfigVo; +import neatlogic.framework.autoexec.dto.job.AutoexecJobVo; +import neatlogic.framework.bootstrap.NeatLogicWebApplicationContext; +import neatlogic.framework.common.RootComponent; +import org.apache.commons.collections4.CollectionUtils; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +@RootComponent +public class UpdateNodesFactory extends ModuleInitializedListenerBase { + + private static final List updateNodeList = new ArrayList<>(); + + + @Override + protected void onInitialized(NeatLogicWebApplicationContext context) { + Map beansOfTypeMap = context.getBeansOfType(IUpdateNodes.class); + if (beansOfTypeMap.size() == 0) { + return; + } + if(CollectionUtils.isNotEmpty(beansOfTypeMap.values())) { + updateNodeList.addAll(beansOfTypeMap.values()); + } + } + + @Override + protected void myInit() { + //ignored + } + + /** + * 遍历所有获取目标的方式,获取到就退出 + * @param jobVo 作业 + * @param executeNodeConfigVo 执行目标配置 + * @param userName 执行用户 + * @param protocolId 协议id + */ + public static boolean updateNodes(AutoexecCombopExecuteNodeConfigVo executeNodeConfigVo, AutoexecJobVo jobVo,String userName,Long protocolId){ + boolean isHasNode = false; + for (IUpdateNodes updateNode : updateNodeList){ + isHasNode = updateNode.update(executeNodeConfigVo,jobVo,userName,protocolId); + if(isHasNode){ + break; + } + } + return isHasNode; + } +}