提交 2abf0cec 编写于 作者: chenxiang@lab.ibiz5.com's avatar chenxiang@lab.ibiz5.com

2022.11.09.001 行为附加逻辑

上级 52cf1851
......@@ -33,25 +33,6 @@
<MaxFileSize>100MB</MaxFileSize>
</triggeringPolicy>
</appender>
<!-- <appender name="DB-CLASSIC-MYSQL-POOL" class="ch.qos.logback.classic.db.DBAppender">-->
<!-- <connectionSource class="ch.qos.logback.core.db.DriverManagerConnectionSource">-->
<!-- <dataSource class="com.mchange.v2.c3p0.ComboPooledDataSource">-->
<!-- <driverClass>com.mysql.cj.jdbc.Driver</driverClass>-->
<!-- <url>jdbc:mysql://127.0.0.1:3306/logback</url>-->
<!-- <user>root</user>-->
<!-- <password>root</password>-->
<!-- <sqlDialect class="ch.qos.logback.core.db.dialect.MySQLDialect" />-->
<!-- </dataSource>-->
<!-- </connectionSource>-->
<!-- <sqlDialect class="ch.qos.logback.core.db.dialect.MySQLDialect" />-->
<!-- </appender>-->
<!-- &lt;!&ndash; 异步日志记录 &ndash;&gt;-->
<!-- <appender name="ASYNC_APPENDER" class="ch.qos.logback.classic.AsyncAppender">-->
<!--   <appender-ref ref="DB-CLASSIC-MYSQL-POOL" />-->
<!--   <includeCallerData>true</includeCallerData>-->
<!-- </appender>-->
<!-- 日志输出级别 -->
<root level="INFO">
<appender-ref ref="Console" />
......
package cn.ibizlab.codegen.model;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
import net.ibizsys.model.dataentity.action.IPSDEAction;
import net.ibizsys.model.dataentity.action.IPSDEActionLogic;
import net.ibizsys.model.dataentity.action.IPSDELogicAction;
import net.ibizsys.model.dataentity.action.IPSDEScriptAction;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import java.util.*;
@Getter
@Setter
@NoArgsConstructor
@Accessors(chain = true)
public class ActionLogicModel extends BaseModel {
public ActionLogicModel(ActionModel actionModel, IPSDEActionLogic iPSDEActionLogic, int index) {
this.opt = iPSDEActionLogic;
this.actionModel = actionModel;
this.entityModel = actionModel.getEntity();
this.id = String.format("%s_%s", actionModel.getCodeName(), index);
}
public IPSDEActionLogic getPSDEActionLogic() {
return (IPSDEActionLogic) opt;
}
private ActionModel actionModel;
private EntityModel entityModel;
}
......@@ -5,138 +5,305 @@ import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.experimental.Accessors;
import net.ibizsys.model.dataentity.action.IPSDEAction;
import net.ibizsys.model.dataentity.action.IPSDEActionLogic;
import net.ibizsys.model.dataentity.action.IPSDELogicAction;
import net.ibizsys.model.dataentity.action.IPSDEScriptAction;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import java.util.HashSet;
import java.util.Set;
import java.util.*;
@Getter
@Setter
@NoArgsConstructor
@Accessors(chain = true)
public class ActionModel extends BaseModel{
public class ActionModel extends BaseModel {
public ActionModel(EntityModel entityModel, IPSDEAction action)
{
this.opt=action;
this.entity=entityModel;
public ActionModel(EntityModel entityModel, IPSDEAction action) {
this.opt = action;
this.entity = entityModel;
this.setCodeName(action.getCodeName());
this.setName(action.getName());
this.setId(String.format("%1$s-%2$s",entity.getCodeName(),action.getCodeName()));
this.setId(String.format("%1$s-%2$s", entity.getCodeName(), action.getCodeName()));
if (!CollectionUtils.isEmpty(this.getDEAction().getBeforePSDEActionLogics())) {
for (int i = 0; i < action.getBeforePSDEActionLogics().size(); i++) {
IPSDEActionLogic iPSDEActionLogic = action.getBeforePSDEActionLogics().get(i);
if ((iPSDEActionLogic.getPSDELogic() != null && iPSDEActionLogic.getPSDELogic().isEnableBackend())
|| iPSDEActionLogic.getDstPSDEAction() != null && iPSDEActionLogic.getDstPSDEAction().isEnableBackend()) {
beforeActionLogics.add(new ActionLogicModel(this, iPSDEActionLogic, i));
}
}
}
public IPSDEAction getDEAction()
{
return (IPSDEAction)opt;
if (!CollectionUtils.isEmpty(this.getDEAction().getAfterPSDEActionLogics())) {
for (int i = 0; i < action.getAfterPSDEActionLogics().size(); i++) {
IPSDEActionLogic iPSDEActionLogic = action.getAfterPSDEActionLogics().get(i);
if ((iPSDEActionLogic.getPSDELogic() != null && iPSDEActionLogic.getPSDELogic().isEnableBackend())
|| iPSDEActionLogic.getDstPSDEAction() != null && iPSDEActionLogic.getDstPSDEAction().isEnableBackend()) {
afterActionLogics.add(new ActionLogicModel(this, iPSDEActionLogic, i));
}
}
}
}
private List<ActionLogicModel> beforeActionLogics = new ArrayList<>();
private List<ActionLogicModel> afterActionLogics = new ArrayList<>();
public IPSDEAction getDEAction() {
return (IPSDEAction) opt;
}
private EntityModel entity;
public boolean isGetAction()
{
public boolean isGetAction() {
return codeName.toLowerCase().startsWith("get");
}
public String getInParam()
{
String param=this.getEntity().getCodeName();
if(getDEAction().getPSDEActionInput()==null)
public boolean isEnableBackend() {
return this.getDEAction().isEnableBackend();
}
public boolean hasBeforeLogics() {
return beforeActionLogics.size() > 0;
}
public boolean hasBeforeLogicsDEAction() {
return beforeActionLogics.stream().anyMatch(actionLogicModel -> actionLogicModel.getPSDEActionLogic().getDstPSDEAction() != null);
}
public List<String> getBeforeLogicParams() {
List<String> params = new ArrayList<>();
if (hasBeforeLogics()) {
Map<String, String> map = new HashMap<>();
for (ActionLogicModel actionLogicModel : beforeActionLogics) {
IPSDEActionLogic iPSDEActionLogic = actionLogicModel.getPSDEActionLogic();
if (iPSDEActionLogic.getDstPSDE() != null && iPSDEActionLogic.getDstPSDEAction() != null) {
if (!map.containsKey(iPSDEActionLogic.getDstPSDE().getCodeName())) {
String param = String.format("<tns:metaData express=\"T(cn.ibizlab.util.security.SpringContextHolder).getBean(T(%s.core.%s.service.%sService))\" name=\"%sService\" type=\"service\"/>",
entity.getSystem().getPackageName(),
iPSDEActionLogic.getDstPSDE().getPSSystemModule().getCodeName().toLowerCase(),
iPSDEActionLogic.getDstPSDE().getCodeName(),
iPSDEActionLogic.getDstPSDE().getCodeName().toLowerCase()
);
params.add(param);
map.put(iPSDEActionLogic.getDstPSDE().getCodeName(), "");
}
if (!map.containsKey("srf_entity")) {
params.add("<tns:metaData express=\"\" name=\"et\" type=\"entity\"/>");
map.put("srf_entity", "");
}
}
}
}
return params;
}
public List<String> getBeforeLogicSequenceFlows() {
List<String> params = new ArrayList<>();
if (hasBeforeLogics()) {
String source = "begin";
for (int i = 0; i < beforeActionLogics.size(); i++) {
ActionLogicModel actionLogicModel = beforeActionLogics.get(i);
String target = actionLogicModel.getId();
params.add(String.format("<sequenceFlow id=\"%1$s_%2$s\" sourceRef=\"%1$s\" targetRef=\"%2$s\"/>", source, target));
source = target;
if (i == beforeActionLogics.size() - 1) {
params.add(String.format("<sequenceFlow id=\"%1$s_%2$s\" sourceRef=\"%1$s\" targetRef=\"%2$s\"/>", source, "prepareparam1_end"));
}
}
}
return params;
}
public List<String> getBeforeGlobalParams(){
List<String> params = new ArrayList<>();
if (hasBeforeLogicsDEAction()) {
Map<String, String> map = new HashMap<>();
for (ActionLogicModel actionLogicModel : beforeActionLogics) {
IPSDEActionLogic iPSDEActionLogic = actionLogicModel.getPSDEActionLogic();
if (iPSDEActionLogic.getDstPSDE() != null && iPSDEActionLogic.getDstPSDEAction() != null) {
if (!map.containsKey(iPSDEActionLogic.getDstPSDE().getCodeName())) {
String param = String.format("global %s.core.%s.service.%sService %sService;",
entity.getSystem().getPackageName(),
iPSDEActionLogic.getDstPSDE().getPSSystemModule().getCodeName().toLowerCase(),
iPSDEActionLogic.getDstPSDE().getCodeName(),
iPSDEActionLogic.getDstPSDE().getCodeName().toLowerCase()
);
params.add(param);
map.put(iPSDEActionLogic.getDstPSDE().getCodeName(), "");
}
}
}
}
return params;
}
public boolean hasAfterLogics() {
return afterActionLogics.size() > 0;
}
public boolean hasAfterLogicsDEAction() {
return afterActionLogics.stream().anyMatch(actionLogicModel -> actionLogicModel.getPSDEActionLogic().getDstPSDEAction() != null);
}
public List<String> getAfterLogicParams() {
List<String> params = new ArrayList<>();
if (hasAfterLogics()) {
Map<String, String> map = new HashMap<>();
for (ActionLogicModel actionLogicModel : afterActionLogics) {
IPSDEActionLogic iPSDEActionLogic = actionLogicModel.getPSDEActionLogic();
if (iPSDEActionLogic.getDstPSDE() != null && iPSDEActionLogic.getDstPSDEAction() != null) {
if (!map.containsKey(iPSDEActionLogic.getDstPSDE().getCodeName())) {
String param = String.format("<tns:metaData express=\"T(cn.ibizlab.util.security.SpringContextHolder).getBean(T(%s.core.%s.service.%sService))\" name=\"%sService\" type=\"service\"/>",
entity.getSystem().getPackageName(),
iPSDEActionLogic.getDstPSDE().getPSSystemModule().getCodeName().toLowerCase(),
iPSDEActionLogic.getDstPSDE().getCodeName(),
iPSDEActionLogic.getDstPSDE().getCodeName().toLowerCase()
);
params.add(param);
map.put(iPSDEActionLogic.getDstPSDE().getCodeName(), "");
}
if (!map.containsKey("srf_entity")) {
params.add("<tns:metaData express=\"\" name=\"et\" type=\"entity\"/>");
map.put("srf_entity", "");
}
}
}
}
return params;
}
public List<String> getAfterLogicSequenceFlows() {
List<String> params = new ArrayList<>();
if (hasAfterLogics()) {
String source = "begin";
for (int i = 0; i < afterActionLogics.size(); i++) {
ActionLogicModel actionLogicModel = afterActionLogics.get(i);
String target = actionLogicModel.getId();
params.add(String.format("<sequenceFlow id=\"%1$s_%2$s\" sourceRef=\"%1$s\" targetRef=\"%2$s\"/>", source, target));
source = target;
if (i == afterActionLogics.size() - 1) {
params.add(String.format("<sequenceFlow id=\"%1$s_%2$s\" sourceRef=\"%1$s\" targetRef=\"%2$s\"/>", source, "prepareparam1_end"));
}
}
}
return params;
}
public List<String> getAfterGlobalParams(){
List<String> params = new ArrayList<>();
if (hasAfterLogicsDEAction()) {
Map<String, String> map = new HashMap<>();
for (ActionLogicModel actionLogicModel : afterActionLogics) {
IPSDEActionLogic iPSDEActionLogic = actionLogicModel.getPSDEActionLogic();
if (iPSDEActionLogic.getDstPSDE() != null && iPSDEActionLogic.getDstPSDEAction() != null) {
if (!map.containsKey(iPSDEActionLogic.getDstPSDE().getCodeName())) {
String param = String.format("global %s.core.%s.service.%sService %sService;",
entity.getSystem().getPackageName(),
iPSDEActionLogic.getDstPSDE().getPSSystemModule().getCodeName().toLowerCase(),
iPSDEActionLogic.getDstPSDE().getCodeName(),
iPSDEActionLogic.getDstPSDE().getCodeName().toLowerCase()
);
params.add(param);
map.put(iPSDEActionLogic.getDstPSDE().getCodeName(), "");
}
}
}
}
return params;
}
public String getInParam() {
String param = this.getEntity().getCodeName();
if (getDEAction().getPSDEActionInput() == null)
return param;
if("KEYFIELD".equalsIgnoreCase(getDEAction().getPSDEActionInput().getType()))
param=this.getEntity().getKeyField().getType().java;
else if("KEYFIELDS".equalsIgnoreCase(getDEAction().getPSDEActionInput().getType()))
param="List<"+this.getEntity().getKeyField().getType().java+">";
else if("DTOS".equalsIgnoreCase(getDEAction().getPSDEActionInput().getType()))
param="List<"+param+">";
if ("KEYFIELD".equalsIgnoreCase(getDEAction().getPSDEActionInput().getType()))
param = this.getEntity().getKeyField().getType().java;
else if ("KEYFIELDS".equalsIgnoreCase(getDEAction().getPSDEActionInput().getType()))
param = "List<" + this.getEntity().getKeyField().getType().java + ">";
else if ("DTOS".equalsIgnoreCase(getDEAction().getPSDEActionInput().getType()))
param = "List<" + param + ">";
return param;
}
public String getInParamName()
{
String param="dto";
if(getDEAction().getPSDEActionInput()==null)
public String getInParamName() {
String param = "dto";
if (getDEAction().getPSDEActionInput() == null)
return param;
if("KEYFIELD".equalsIgnoreCase(getDEAction().getPSDEActionInput().getType()))
param="key";
else if("KEYFIELDS".equalsIgnoreCase(getDEAction().getPSDEActionInput().getType()))
param="keys";
if ("KEYFIELD".equalsIgnoreCase(getDEAction().getPSDEActionInput().getType()))
param = "key";
else if ("KEYFIELDS".equalsIgnoreCase(getDEAction().getPSDEActionInput().getType()))
param = "keys";
return param;
}
public boolean isVoidReturn()
{
if(getDEAction().getPSDEActionReturn()==null)
public boolean isVoidReturn() {
if (getDEAction().getPSDEActionReturn() == null)
return true;
if (!"VOID".equalsIgnoreCase(getDEAction().getPSDEActionReturn().getType()))
return false;
return true;
}
public boolean isListReturn()
{
if(getDEAction().getPSDEActionReturn()==null)
public boolean isListReturn() {
if (getDEAction().getPSDEActionReturn() == null)
return false;
if ("DTOS".equalsIgnoreCase(getDEAction().getPSDEActionReturn().getType())
||"OBJECTS".equalsIgnoreCase(getDEAction().getPSDEActionReturn().getType())
||"SIMPLES".equalsIgnoreCase(getDEAction().getPSDEActionReturn().getType()))
|| "OBJECTS".equalsIgnoreCase(getDEAction().getPSDEActionReturn().getType())
|| "SIMPLES".equalsIgnoreCase(getDEAction().getPSDEActionReturn().getType()))
return true;
return false;
}
public String typeReturn()
{
if(isListReturn()) {
public String typeReturn() {
if (isListReturn()) {
if ("SIMPLES".equalsIgnoreCase(getDEAction().getPSDEActionReturn().getType()))
return PropType.findType(this.getDEAction().getPSDEActionReturn().getStdDataType()).java;
else if ("DTOS".equalsIgnoreCase(getDEAction().getPSDEActionReturn().getType())
||"OBJECTS".equalsIgnoreCase(getDEAction().getPSDEActionReturn().getType()))
|| "OBJECTS".equalsIgnoreCase(getDEAction().getPSDEActionReturn().getType()))
return this.getEntity().getCodeName();
}
return "";
}
public String getOutParam()
{
String param=this.getEntity().getCodeName();
if(getDEAction().getPSDEActionReturn()==null)
public String getOutParam() {
String param = this.getEntity().getCodeName();
if (getDEAction().getPSDEActionReturn() == null)
return param;
if ("VOID".equalsIgnoreCase(getDEAction().getPSDEActionReturn().getType()))
return getInParam();
if ("SIMPLE".equalsIgnoreCase(getDEAction().getPSDEActionReturn().getType()))
param=PropType.findType(this.getDEAction().getPSDEActionReturn().getStdDataType()).java;
param = PropType.findType(this.getDEAction().getPSDEActionReturn().getStdDataType()).java;
else if ("SIMPLES".equalsIgnoreCase(getDEAction().getPSDEActionReturn().getType()))
param="List<"+PropType.findType(this.getDEAction().getPSDEActionReturn().getStdDataType()).java+">";
param = "List<" + PropType.findType(this.getDEAction().getPSDEActionReturn().getStdDataType()).java + ">";
else if ("DTOS".equalsIgnoreCase(getDEAction().getPSDEActionReturn().getType())
||"OBJECTS".equalsIgnoreCase(getDEAction().getPSDEActionReturn().getType()))
param="List<"+param+">";
|| "OBJECTS".equalsIgnoreCase(getDEAction().getPSDEActionReturn().getType()))
param = "List<" + param + ">";
return param;
}
public Set<String> getLogics()
{
Set<String> validLogic=new HashSet<>();
if(!ObjectUtils.isEmpty(getDEAction().getBeforePSDEActionLogics()))
{
getDEAction().getBeforePSDEActionLogics().forEach(logic->{
public Set<String> getLogics() {
Set<String> validLogic = new HashSet<>();
if (!ObjectUtils.isEmpty(getDEAction().getBeforePSDEActionLogics())) {
getDEAction().getBeforePSDEActionLogics().forEach(logic -> {
if ((logic.isValid() && logic.isInternalLogic() && logic.getPSDELogic().isEnableBackend()) ||
(logic.getDstPSDE()!=null && logic.getDstPSDEAction()!=null && (!(logic.getDstPSDEAction() instanceof IPSDEScriptAction))))
validLogic.add((entity.codeName+this.codeName).toLowerCase()+"before.bpmn");
(logic.getDstPSDE() != null && logic.getDstPSDEAction() != null && (!(logic.getDstPSDEAction() instanceof IPSDEScriptAction))))
validLogic.add((entity.codeName + this.codeName).toLowerCase() + "before.bpmn");
});
}
if(!ObjectUtils.isEmpty(getDEAction().getAfterPSDEActionLogics()))
{
getDEAction().getAfterPSDEActionLogics().forEach(logic->{
if (!ObjectUtils.isEmpty(getDEAction().getAfterPSDEActionLogics())) {
getDEAction().getAfterPSDEActionLogics().forEach(logic -> {
if ((logic.isValid() && logic.isInternalLogic() && logic.getPSDELogic().isEnableBackend()) ||
(logic.getDstPSDE()!=null && logic.getDstPSDEAction()!=null && (!(logic.getDstPSDEAction() instanceof IPSDEScriptAction))))
validLogic.add((entity.codeName+this.codeName).toLowerCase()+"after.bpmn");
(logic.getDstPSDE() != null && logic.getDstPSDEAction() != null && (!(logic.getDstPSDEAction() instanceof IPSDEScriptAction))))
validLogic.add((entity.codeName + this.codeName).toLowerCase() + "after.bpmn");
});
}
if("DELOGIC".equalsIgnoreCase(getDEAction().getActionType())&&getDEAction() instanceof IPSDELogicAction)
{
validLogic.add((entity.codeName+this.codeName).toLowerCase()+"exec.bpmn");
if ("DELOGIC".equalsIgnoreCase(getDEAction().getActionType()) && getDEAction() instanceof IPSDELogicAction) {
validLogic.add((entity.codeName + this.codeName).toLowerCase() + "exec.bpmn");
}
return validLogic;
}
......
......@@ -588,10 +588,6 @@ public class EntityModel extends BaseModel {
if (dataEntity.getMinorPSDERs() != null) {
for (IPSDERBase der : dataEntity.getMinorPSDERs()) {
if (dataEntity.getName().equals("IBIZCUSTOMERMG")
|| dataEntity.getName().equals("IBIZCUSTOMER")) {
System.out.println(dataEntity.getName());
}
RelationshipModel rel = new RelationshipModel(this, der);
rel.setRelationType("reference").setCodeName(der.getCodeName()).setEntityId(der.getMajorPSDataEntity().getId())
.setEntityCodeName(der.getMajorPSDataEntity().getCodeName()).setEntityName(der.getMajorPSDataEntity().getName())
......@@ -759,8 +755,6 @@ public class EntityModel extends BaseModel {
//处理逻辑
if (!CollectionUtils.isEmpty(dataEntity.getAllPSDELogics())) {
for (IPSDELogic logic : dataEntity.getAllPSDELogics()) {
if (!logic.isEnableBackend())
continue;
LogicModel logicModel = new LogicModel(this, logic);
this.addLogic(logicModel);
}
......
......@@ -41,7 +41,7 @@ public class LogicModel extends BaseModel {
iPSDELogicParam.getParamPSDataEntity().getPSSystemModule().getCodeName().toLowerCase(),
iPSDELogicParam.getParamPSDataEntity().getCodeName()
);
ruleGlobalParams.add(String.format("global %s %s;", strDataType, strParamName));
ruleGlobalParams.add(String.format("global %s %s;", strDataType, "param_" + strParamName));
String bpmnGlobalIdentifier = String.format("<tns:global identifier=\"%s\" type=\"%s.core.%s.domain.%s\" />",
strParamName,
entityModel.getSystem().getPackageName(),
......@@ -50,7 +50,7 @@ public class LogicModel extends BaseModel {
bpmnTnsParams.add(bpmnGlobalIdentifier);
} else {
String strDataType = "java.util.Map";
ruleGlobalParams.add(String.format("global %s %s;", strDataType, "param_"+strParamName));
ruleGlobalParams.add(String.format("global %s %s;", strDataType, "param_" + strParamName));
}
}
}
......@@ -99,7 +99,7 @@ public class LogicModel extends BaseModel {
ruleGlobalParams.add(String.format("global %s %s;", strDataType, "wfClient"));
}
if (true) {
String strDataType = String.format("%s.core.%s.service.I%sService",
String strDataType = String.format("%s.core.%s.service.%sService",
entityModel.getSystem().getPackageName(),
entityModel.getDataEntity().getPSSystemModule().getCodeName().toLowerCase(),
entityModel.getDataEntity().getCodeName()
......@@ -107,7 +107,7 @@ public class LogicModel extends BaseModel {
ruleGlobalParams.add(String.format("global %s %s;", strDataType, String.format("iBzSys%sDefaultService", entityModel.getCodeName())));
String strBpmnService = String.format("<tns:metaData express=\"T(cn.ibizlab.util.security.SpringContextHolder).getBean(T(%s.core.%s.service.I%sService))\" name=\"iBzSys%sDefaultService\" type=\"service\"/>",
String strBpmnService = String.format("<tns:metaData express=\"T(cn.ibizlab.util.security.SpringContextHolder).getBean(T(%s.core.%s.service.%sService))\" name=\"iBzSys%sDefaultService\" type=\"service\"/>",
entityModel.getSystem().getPackageName(),
entityModel.getDataEntity().getPSSystemModule().getCodeName().toLowerCase(),
entityModel.getDataEntity().getCodeName(),
......@@ -122,6 +122,10 @@ public class LogicModel extends BaseModel {
return (IPSDELogic) opt;
}
public boolean isEnableBackend(){
return this.getPSDELogic().isEnableBackend();
}
public EntityModel getEntity() {
return entity;
}
......
......@@ -173,6 +173,13 @@ public class ModelStorage {
rt.addOption(opt);
});
}
else if (type.equals(TemplateFileType.entityAction)) {
getSystemModel().getEntities().forEach(item -> item.getActions().values().forEach(actionModel -> {
CliOption opt = newCliOption(TemplateFileType.entityAction).baseData(actionModel, actionModel.getCodeName())
.set("entities", item.getCodeName());
rt.addOption(opt);
}));
}
else if (type.equals(TemplateFileType.entityLogic)) {
getSystemModel().getEntities().forEach(item -> item.getLogics().forEach(logicModel -> {
CliOption opt = newCliOption(TemplateFileType.entityLogic).baseData(logicModel, logicModel.getCodeName())
......
......@@ -8,6 +8,7 @@ public enum TemplateFileType {
apiEntity(Constants.API_ENTITIES),
apiDto(Constants.API_DTOS),
entity(Constants.ENTITIES),
entityAction(Constants.ENTITIY_ACTIONS),
entityLogic(Constants.ENTITIY_LOGICS),
module(Constants.MODULES),
workflow(Constants.WORKFLOWS),
......@@ -55,6 +56,7 @@ public enum TemplateFileType {
public static final String APPS = "apps";
public static final String DICTS = "dicts";
public static final String ENTITIES = "entities";
public static final String ENTITIY_ACTIONS = "entityActions";
public static final String ENTITIY_LOGICS = "entityLogics";
public static final String WORKFLOWS = "workflows";
public static final String SYSUTILS = "syUtils";
......
{{#if (eq logicNodeModel.pSDELogicNode.dstPSDEAction.codeName 'Get')}}
cn.ibizlab.util.helper.CachedBeanCopier.copy({{lowerCase logicNodeModel.pSDELogicNode.dstPSDataEntity.codeName}}service.get(param_{{lowerCase logicNodeModel.pSDELogicNode.dstPSDELogicParam.codeName}}.get{{logicNodeModel.pSDELogicNode.dstPSDataEntity.keyPSDEField.codeName}}()),param_{{lowerCase logicNodeModel.pSDELogicNode.dstPSDELogicParam.codeName}});
cn.ibizlab.util.helper.CachedBeanCopier.copy({{lowerCase logicNodeModel.pSDELogicNode.dstPSDataEntity.codeName}}service.get(param_{{lowerCase logicNodeModel.pSDELogicNode.dstPSDELogicParam.codeName}}.get{{pascalCase logicNodeModel.pSDELogicNode.dstPSDataEntity.keyPSDEField.codeName}}()),param_{{lowerCase logicNodeModel.pSDELogicNode.dstPSDELogicParam.codeName}});
{{else}}
{{#if (eq logicNodeModel.pSDELogicNode.dstPSDEAction.codeName 'Remove')}}
{{lowerCase logicNodeModel.pSDELogicNode.dstPSDataEntity.codeName}}service.remove(param_{{lowerCase logicNodeModel.pSDELogicNode.dstPSDELogicParam.codeName}}.get{{logicNodeModel.pSDELogicNode.dstPSDataEntity.keyPSDEField.codeName}}());
{{lowerCase logicNodeModel.pSDELogicNode.dstPSDataEntity.codeName}}service.remove(param_{{lowerCase logicNodeModel.pSDELogicNode.dstPSDELogicParam.codeName}}.get{{pascalCase logicNodeModel.pSDELogicNode.dstPSDataEntity.keyPSDEField.codeName}}());
{{else}}
{{lowerCase logicNodeModel.pSDELogicNode.dstPSDataEntity.codeName}}service.{{camelCase logicNodeModel.pSDELogicNode.dstPSDEAction.codeName}}(param_{{lowerCase logicNodeModel.pSDELogicNode.dstPSDELogicParam.codeName}});
{{/if}}
......
{{#if entityLogic.isEnableBackend}}
package {{packageName}}.{{entityLogic.entity.module}}.logic.{{lowerCase entityLogic.entity.codeName}}logic.{{lowerCase entityLogic.codeName}};
import java.util.Map;
......@@ -25,8 +26,8 @@ ruleflow-group "{{lowerCase logicNodeModel.codeName}}group"
{{#eq logicNodeModel.logicNodeType "RAWSQLANDLOOPCALL"}}{{> @macro/logic/drl/RawSQLAndLoopCall.hbs logicNodeModel=logicNodeModel}}{{/eq}}
{{#eq logicNodeModel.logicNodeType "STARTWF"}}{{> @macro/logic/drl/StartWF.hbs logicNodeModel=logicNodeModel}}{{/eq}}
{{#each entityLogic.pSDELogicParams as |logicParam|}}
update({{lowerCase logicParam.codeName}});//更新fact中变量值
update(param_{{lowerCase logicParam.codeName}});//更新fact中变量值
{{/each}}
end
{{/each}}
{{/if}}
\ No newline at end of file
{{#if entityLogic.isEnableBackend}}
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:g="http://www.jboss.org/drools/flow/gpd" xmlns:tns="http://www.jboss.org/drools" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" expressionLanguage="http://www.mvel.org/2.0" id="Definition" name="" targetNamespace="http://www.jboss.org/drools" typeLanguage="http://www.java.com/javaTypes">
<process id="{{packageName}}.core.{{entityLogic.entity.module}}.service.logic.{{lowerCase entityLogic.entity.codeName}}{{lowerCase entityLogic.codeName}}" isClosed="false" isExecutable="true"
......@@ -67,3 +68,4 @@
{{/each}}
</process>
</definitions>
{{/if}}
\ No newline at end of file
{{#if entityAction.hasAfterLogics}}
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:g="http://www.jboss.org/drools/flow/gpd" xmlns:tns="http://www.jboss.org/drools" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" expressionLanguage="http://www.mvel.org/2.0" id="Definition" name="" targetNamespace="http://www.jboss.org/drools" typeLanguage="http://www.java.com/javaTypes">
<process id="{{packageName}}.core.{{entityAction.entity.module}}.{{lowerCase entityAction.entity.codeName}}.{{lowerCase entityAction.codeName}}.afterLogic" isClosed="false" isExecutable="true"
name="{{entityAction.entity.module}}_{{lowerCase entityAction.entity.codeName}}_{{lowerCase entityAction.codeName}}_afterLogic" processType="Private"
tns:packageName="{{packageName}}.core.{{entityAction.entity.module}}.{{lowerCase entityAction.entity.codeName}}.{{lowerCase entityAction.codeName}}.afterLogic">
<extensionElements>
<tns:import name="java.util.Map"/>
<tns:import name="org.springframework.util.StringUtils"/>
<tns:import name="cn.ibizlab.util.helper.RuleUtils"/>
<tns:import name="{{packageName}}.core.{{entityAction.entity.module}}.domain.{{entityAction.entity.codeName}}"/>
{{#each entityAction.afterLogicParams as |afterLogicParam|}}
{{afterLogicParam}}
{{/each}}
</extensionElements>
<startEvent id="begin" isInterrupting="true"/>
<endEvent id="prepareparam1_end" name="end"/>
{{#each entityAction.afterActionLogics as |logicModel|}}
{{#if logicModel.pSDEActionLogic.pSDELogic}}
<callActivity activiti:exclusive="true" calledElement="{{packageName}}.core.{{entityAction.entity.module}}.service.logic.{{lowerCase entityAction.entity.codeName}}{{lowerCase logicModel.pSDEActionLogic.pSDELogic.codeName}}" id="{{logicModel.id}}" name="{{entityAction.entity.codeName}}/{{logicModel.pSDEActionLogic.pSDELogic.codeName}}RuleFlow.bpmn"/>
{{/if}}
{{#if logicModel.pSDEActionLogic.dstPSDEAction}}
<businessRuleTask activiti:exclusive="true" g:ruleFlowGroup="{{logicModel.id}}" id="{{logicModel.id}}" implementation="http://www.jboss.org/drools/rule" name="{{lowerCase logicModel.pSDEActionLogic.dstPSDE.codeName}}{{lowerCase logicModel.pSDEActionLogic.dstPSDEAction.codeName}}"/>
{{/if}}
{{/each}}
{{#each entityAction.afterLogicSequenceFlows as |afterLogicSequenceFlow|}}
{{afterLogicSequenceFlow}}
{{/each}}
</process>
</definitions>
{{/if}}
\ No newline at end of file
{{#if entityAction.hasAfterLogicsDEAction}}
import cn.ibizlab.util.helper.CachedBeanCopier;
global {{packageName}}.core.{{entityAction.entity.module}}.domain.{{entityAction.entity.codeName}} et;
{{#each entityAction.afterGlobalParams as |afterGlobalParam|}}
{{afterGlobalParam}}
{{/each}}
no-loop
{{#each entityAction.afterActionLogics as |logicModel|}}
{{#if logicModel.pSDEActionLogic.dstPSDEAction}}
rule "{{lowerCase logicModel.pSDEActionLogic.dstPSDE.codeName}}{{lowerCase logicModel.pSDEActionLogic.dstPSDEAction.codeName}}"
ruleflow-group "{{logicModel.id}}"
when
then
{{#if ogicModel.pSDEActionLogic.isIgnoreException}}
try{
{{/if}}
{{#if (or (eq logicModel.pSDEActionLogic.dstPSDEAction.actionType 'USERCUSTOM') (eq logicModel.pSDEActionLogic.dstPSDEAction.actionType 'DELOGIC') (eq logicModel.pSDEActionLogic.dstPSDEAction.codeName 'Create') (eq logicModel.pSDEActionLogic.dstPSDEAction.codeName 'Update') (eq logicModel.pSDEActionLogic.dstPSDEAction.codeName 'Save') (eq logicModel.pSDEActionLogic.dstPSDEAction.codeName 'GetDraft') (eq logicModel.pSDEActionLogic.dstPSDEAction.codeName 'CheckKey'))}}
{{packageName}}.core.{{lowerCase logicModel.pSDEActionLogic.dstPSDE.pSSystemModule.codeName}}.domain.{{logicModel.pSDEActionLogic.dstPSDE.codeName}} actionLogicDE =new {{packageName}}.core.{{lowerCase logicModel.pSDEActionLogic.dstPSDE.pSSystemModule.codeName}}.domain.{{logicModel.pSDEActionLogic.dstPSDE.codeName}}();
CachedBeanCopier.copy(et, actionLogicDE);
{{lowerCase logicModel.pSDEActionLogic.dstPSDE.codeName}}Service.{{camelCase logicModel.pSDEActionLogic.dstPSDEAction.codeName}}(actionLogicDE);
{{else}}
{{#if (eq logicModel.pSDEActionLogic.dstPSDEAction.codeName 'Remove')}}
{{lowerCase logicModel.pSDEActionLogic.dstPSDE.codeName}}Service.remove(et.get{{pascalCase logicModel.pSDEActionLogic.dstPSDE.keyPSDEField.codeName}}());
{{/if}}
{{/if}}
{{#if ogicModel.pSDEActionLogic.isIgnoreException}}
}catch(Exception e) {
log.error("执行[{{logicModel.pSDEActionLogic.dstPSDEAction}}]行为附加逻辑发生异常");
}
{{/if}}
end
{{/if}}
{{/each}}
{{/if}}
\ No newline at end of file
{{#if entityAction.hasBeforeLogics}}
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:g="http://www.jboss.org/drools/flow/gpd" xmlns:tns="http://www.jboss.org/drools" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" expressionLanguage="http://www.mvel.org/2.0" id="Definition" name="" targetNamespace="http://www.jboss.org/drools" typeLanguage="http://www.java.com/javaTypes">
<process id="{{packageName}}.core.{{entityAction.entity.module}}.{{lowerCase entityAction.entity.codeName}}.{{lowerCase entityAction.codeName}}.beforeLogic" isClosed="false" isExecutable="true"
name="{{entityAction.entity.module}}_{{lowerCase entityAction.entity.codeName}}_{{lowerCase entityAction.codeName}}_beforeLogic" processType="Private"
tns:packageName="{{packageName}}.core.{{entityAction.entity.module}}.{{lowerCase entityAction.entity.codeName}}.{{lowerCase entityAction.codeName}}.beforeLogic">
<extensionElements>
<tns:import name="java.util.Map"/>
<tns:import name="org.springframework.util.StringUtils"/>
<tns:import name="cn.ibizlab.util.helper.RuleUtils"/>
<tns:import name="{{packageName}}.core.{{entityAction.entity.module}}.domain.{{entityAction.entity.codeName}}"/>
{{#each entityAction.beforeLogicParams as |beforeLogicParam|}}
{{beforeLogicParam}}
{{/each}}
</extensionElements>
<startEvent id="begin" isInterrupting="true"/>
<endEvent id="prepareparam1_end" name="end"/>
{{#each entityAction.beforeActionLogics as |logicModel|}}
{{#if logicModel.pSDEActionLogic.pSDELogic}}
<callActivity activiti:exclusive="true" calledElement="{{packageName}}.core.{{entityAction.entity.module}}.service.logic.{{lowerCase entityAction.entity.codeName}}{{lowerCase logicModel.pSDEActionLogic.pSDELogic.codeName}}" id="{{logicModel.id}}" name="{{entityAction.entity.codeName}}/{{logicModel.pSDEActionLogic.pSDELogic.codeName}}RuleFlow.bpmn"/>
{{/if}}
{{#if logicModel.pSDEActionLogic.dstPSDEAction}}
<businessRuleTask activiti:exclusive="true" g:ruleFlowGroup="{{logicModel.id}}" id="{{logicModel.id}}" implementation="http://www.jboss.org/drools/rule" name="{{lowerCase logicModel.pSDEActionLogic.dstPSDE.codeName}}{{lowerCase logicModel.pSDEActionLogic.dstPSDEAction.codeName}}"/>
{{/if}}
{{/each}}
{{#each entityAction.beforeLogicSequenceFlows as |beforeLogicSequenceFlow|}}
{{beforeLogicSequenceFlow}}
{{/each}}
</process>
</definitions>
{{/if}}
\ No newline at end of file
{{#if entityAction.hasBeforeLogicsDEAction}}
import cn.ibizlab.util.helper.CachedBeanCopier;
global {{packageName}}.core.{{entityAction.entity.module}}.domain.{{entityAction.entity.codeName}} et;
{{#each entityAction.beforeGlobalParams as |beforeGlobalParam|}}
{{beforeGlobalParam}}
{{/each}}
no-loop
{{#each entityAction.beforeActionLogics as |logicModel|}}
{{#if logicModel.pSDEActionLogic.dstPSDEAction}}
rule "{{lowerCase logicModel.pSDEActionLogic.dstPSDE.codeName}}{{lowerCase logicModel.pSDEActionLogic.dstPSDEAction.codeName}}"
ruleflow-group "{{logicModel.id}}"
when
then
{{#if ogicModel.pSDEActionLogic.isIgnoreException}}
try{
{{/if}}
{{#if (or (eq logicModel.pSDEActionLogic.dstPSDEAction.actionType 'USERCUSTOM') (eq logicModel.pSDEActionLogic.dstPSDEAction.actionType 'DELOGIC') (eq logicModel.pSDEActionLogic.dstPSDEAction.codeName 'Create') (eq logicModel.pSDEActionLogic.dstPSDEAction.codeName 'Update') (eq logicModel.pSDEActionLogic.dstPSDEAction.codeName 'Save') (eq logicModel.pSDEActionLogic.dstPSDEAction.codeName 'GetDraft') (eq logicModel.pSDEActionLogic.dstPSDEAction.codeName 'CheckKey'))}}
{{packageName}}.core.{{lowerCase logicModel.pSDEActionLogic.dstPSDE.pSSystemModule.codeName}}.domain.{{logicModel.pSDEActionLogic.dstPSDE.codeName}} actionLogicDE =new {{packageName}}.core.{{lowerCase logicModel.pSDEActionLogic.dstPSDE.pSSystemModule.codeName}}.domain.{{logicModel.pSDEActionLogic.dstPSDE.codeName}}();
CachedBeanCopier.copy(et, actionLogicDE);
{{lowerCase logicModel.pSDEActionLogic.dstPSDE.codeName}}Service.{{camelCase logicModel.pSDEActionLogic.dstPSDEAction.codeName}}(actionLogicDE);
{{else}}
{{#if (eq logicModel.pSDEActionLogic.dstPSDEAction.codeName 'Remove')}}
{{lowerCase logicModel.pSDEActionLogic.dstPSDE.codeName}}Service.remove(et.get{{pascalCase logicModel.pSDEActionLogic.dstPSDE.keyPSDEField.codeName}}());
{{/if}}
{{/if}}
{{#if ogicModel.pSDEActionLogic.isIgnoreException}}
}catch(Exception e) {
log.error("执行[{{logicModel.pSDEActionLogic.dstPSDEAction}}]行为附加逻辑发生异常");
}
{{/if}}
end
{{/if}}
{{/each}}
{{/if}}
\ No newline at end of file
{{#if (and (eq entityAction.dEAction.actionType 'DELOGIC') (entityAction.isEnableBackend) (entityAction.pSDELogic.isEnableBackend))}}
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:g="http://www.jboss.org/drools/flow/gpd" xmlns:tns="http://www.jboss.org/drools" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" expressionLanguage="http://www.mvel.org/2.0" id="Definition" name="" targetNamespace="http://www.jboss.org/drools" typeLanguage="http://www.java.com/javaTypes">
<process id="{{packageName}}.core.extensions.service.logic.execute" isClosed="false" isExecutable="true" name="{{entityAction.entity.module}}_{{lowerCase entityAction.entity.module}}_{{lowerCase entityAction.codeName}}.execLogic" processType="Private" tns:packageName="{{packageName}}.core.extensions.service.logic.execute">
<extensionElements>
<tns:import name="java.util.Map"/>
<tns:import name="org.springframework.util.StringUtils"/>
<tns:import name="cn.ibizlab.util.helper.RuleUtils"/>
</extensionElements>
<startEvent id="begin" isInterrupting="true"/>
<endEvent id="prepareparam1_end" name="end"/>
<callActivity activiti:exclusive="true" calledElement="{{packageName}}.core.{{lowerCase entityAction.entity.module}}service.logic.{{lowerCase entityAction.entity.codeName}}{{lowerCase entityAction.pSDELogic.codeName}}" id="{{entityAction.pSDELogic.codeName}}" name="{{entityAction.entity.codeName}}/{{entityAction.pSDELogic.codeName}}RuleFlow.bpmn"/>
<sequenceFlow id="begin_{{entityAction.pSDELogic.codeName}}" sourceRef="begin" targetRef="{{entityAction.pSDELogic.codeName}}"/>
<sequenceFlow id="{{entityAction.pSDELogic.codeName}}_prepareparam1_end" sourceRef="{{entityAction.pSDELogic.codeName}}" targetRef="prepareparam1_end"/>
</process>
</definitions>
{{/if}}
\ No newline at end of file
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册