一个修复流程节点属性缺失的addons工具
This commit is contained in:
parent
ee0e60f001
commit
969ed256f3
Binary file not shown.
29
com.awspaas.user.apps.coe.pal.attribute.update/manifest.xml
Normal file
29
com.awspaas.user.apps.coe.pal.attribute.update/manifest.xml
Normal file
@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<app xmlns="http://www.actionsoft.com.cn/app">
|
||||
<name>模型图元属性修复</name>
|
||||
<version>1.0</version>
|
||||
<buildNo>2</buildNo>
|
||||
<developer id="00000000000000000000000000000000" tablePrefix="EU" url="http://www.awspaas.com">AWSPaaS-EndUser</developer>
|
||||
<categoryVisible>true</categoryVisible>
|
||||
<description><![CDATA[]]></description>
|
||||
<details><![CDATA[]]></details>
|
||||
<installListener/>
|
||||
<pluginListener>com.awspaas.user.apps.coe.pal.attribute.update.plugin.Plugins</pluginListener>
|
||||
<startListener/>
|
||||
<stopListener/>
|
||||
<upgradeListener/>
|
||||
<uninstallListener/>
|
||||
<reloadable>true</reloadable>
|
||||
<requires/>
|
||||
<properties>
|
||||
<property action="edit" group="默认" name="DEFAULT_REPOSITORY_ID" title="模型ID" type="input" isSystem="false" desc="待修复的模型Id,例如流程Id" ref=""/>
|
||||
</properties>
|
||||
<allowStartup>true</allowStartup>
|
||||
<allowUpgradeByStore>true</allowUpgradeByStore>
|
||||
<depend versions="6.5" env="">com.actionsoft.apps.coe.pal</depend>
|
||||
<modelAdministrator/>
|
||||
<installDate>2025-06-09 11:29:49</installDate>
|
||||
<icon code="&#xe655;" color="#ff9421"/>
|
||||
<productId/>
|
||||
</app>
|
||||
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<mobile-profile xmlns="http://www.actionsoft.com.cn/app">
|
||||
<osType></osType>
|
||||
<deviceType>universal</deviceType>
|
||||
<realAppId></realAppId>
|
||||
<realVersion>1.0</realVersion>
|
||||
<resourceType>common</resourceType>
|
||||
<resourceURI></resourceURI>
|
||||
<ssoType>sid</ssoType>
|
||||
<backupable>false</backupable>
|
||||
<cascadeRemove>true</cascadeRemove>
|
||||
<autoDistribute>false</autoDistribute>
|
||||
<trackId></trackId>
|
||||
</mobile-profile>
|
||||
@ -0,0 +1,87 @@
|
||||
package com.awspaas.user.apps.coe.pal.attribute.update.addons;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Set;
|
||||
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.cache.PALRepositoryCache;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.CoeDesignerShapeAPIManager;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.constant.CoeDesignerConstant;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.manage.CoeDesignerAPIManager;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.model.BPMNModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.model.BaseModel;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.designer.util.CoeDesignerUtil;
|
||||
import com.actionsoft.apps.coe.pal.pal.repository.model.PALRepositoryModel;
|
||||
import com.actionsoft.bpms.commons.addons.AddOnsInterface;
|
||||
import com.actionsoft.bpms.server.UserContext;
|
||||
import com.actionsoft.sdk.local.SDK;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
|
||||
public class ShapeAttributeUpdateAddons implements AddOnsInterface {
|
||||
public String mainPage(UserContext context) {
|
||||
|
||||
String uuid = SDK.getAppAPI().getProperty("com.awspaas.user.apps.coe.pal.attribute.update", "DEFAULT_REPOSITORY_ID");
|
||||
if (uuid == null || uuid.trim().length() == 0) {
|
||||
return "请到应用参数配置模型ID";
|
||||
}
|
||||
PALRepositoryModel plModel = PALRepositoryCache.getCache().get(uuid);
|
||||
if (plModel == null) {
|
||||
return "模型未找到";
|
||||
}
|
||||
String define = "";
|
||||
if ("process.bpmn2".equals(plModel.getMethodId())) {// bpmn模型
|
||||
BPMNModel model = CoeDesignerAPIManager.getInstance().getDefinitionOfBpmn(uuid, 0);
|
||||
if (model == null) {
|
||||
define = CoeDesignerUtil.getTemplateOfDefine(uuid);
|
||||
} else {
|
||||
define = model.getDefinition();
|
||||
}
|
||||
} else {// 其他模型
|
||||
BaseModel model = CoeDesignerAPIManager.getInstance().getDefinition(uuid, 0);
|
||||
if (model == null) {
|
||||
model = CoeDesignerUtil.createModel(uuid, 0);
|
||||
define = model.getDefinition();
|
||||
} else {
|
||||
define = model.getDefinition();
|
||||
}
|
||||
}
|
||||
JSONObject definition = JSONObject.parseObject(define);
|
||||
JSONObject localAttribute = new JSONObject();
|
||||
if (localAttribute.isEmpty()) {
|
||||
//处理流程节点属性配置
|
||||
CoeDesignerShapeAPIManager.getInstance().handlePlShapeAttrConfig(plModel.getWsId(), plModel.getMethodId(), localAttribute);
|
||||
}
|
||||
definition.put("localAttribute", localAttribute);
|
||||
// 更新节点的属性内容
|
||||
CoeDesignerShapeAPIManager.getInstance().updateShapeDataAttributes(definition, localAttribute);
|
||||
|
||||
define = definition.toString();
|
||||
//当前时间
|
||||
String now = new SimpleDateFormat(CoeDesignerConstant.DATE_TIME_STYLE_YYYY_MM_DD_HH_MM_SS).format(new Date());
|
||||
// 修改流程图
|
||||
if (plModel.getMethodId().equals("process.bpmn2")) {
|
||||
BPMNModel defineModel = CoeDesignerAPIManager.getInstance().getDefinitionOfBpmn(uuid, 0);
|
||||
if (defineModel == null) {
|
||||
defineModel = CoeDesignerUtil.createBPMNModel(uuid, 0);
|
||||
defineModel.setCreateHistory(false);
|
||||
}
|
||||
|
||||
defineModel.setUpdateTime(now);
|
||||
defineModel.setDefinition(define);
|
||||
CoeDesignerAPIManager.getInstance().storeDefinitionOfBpmn(defineModel);// 保存文件
|
||||
} else {
|
||||
BaseModel defineModel = CoeDesignerAPIManager.getInstance().getDefinition(uuid, 0);
|
||||
if (defineModel == null) {
|
||||
defineModel = CoeDesignerUtil.createModel(uuid, 0);
|
||||
defineModel.setCreateHistory(false);
|
||||
}
|
||||
defineModel.setUpdateTime(now);
|
||||
defineModel.setDefinition(define);
|
||||
CoeDesignerAPIManager.getInstance().storeDefinition(defineModel);// 保存文件
|
||||
}
|
||||
|
||||
|
||||
return "更新成功";
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package com.awspaas.user.apps.coe.pal.attribute.update.plugin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.actionsoft.apps.listener.PluginListener;
|
||||
import com.actionsoft.apps.resource.AppContext;
|
||||
import com.actionsoft.apps.resource.plugin.profile.AWSPluginProfile;
|
||||
import com.actionsoft.apps.resource.plugin.profile.AddOnsPluginProfile;
|
||||
import com.awspaas.user.apps.coe.pal.attribute.update.addons.ShapeAttributeUpdateAddons;
|
||||
|
||||
public class Plugins implements PluginListener {
|
||||
@Override
|
||||
public List<AWSPluginProfile> register(AppContext appContext) {
|
||||
// 存放本应用的全部插件扩展点描述
|
||||
List<AWSPluginProfile> list = new ArrayList<>();
|
||||
// 注册ADD-ONS
|
||||
list.add(new AddOnsPluginProfile(ShapeAttributeUpdateAddons.class.getName()));
|
||||
return list;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<aws-actions>
|
||||
|
||||
</aws-actions>
|
||||
Loading…
Reference in New Issue
Block a user