提交 8aa0cc9b 编写于 作者: O o2null

Merge branch 'feature/java11' into 'develop'

async in route object

See merge request o2oa/o2oa!1560
......@@ -84,7 +84,7 @@ class ActionProcessing extends BaseAction {
Business business = new Business(emc);
init(effectivePerson, business, id, jsonElement);
updateTaskIfNecessary(business);
seeManual(business);
seeManualRoute(business);
}
LinkedBlockingQueue<Wo> responeQueue = new LinkedBlockingQueue<>();
......@@ -193,10 +193,9 @@ class ActionProcessing extends BaseAction {
}
}
private void seeManual(Business business) throws Exception {
private void seeManualRoute(Business business) throws Exception {
Manual manual = business.manual().pick(this.task.getActivity());
if (null != manual) {
this.asyncSupported = BooleanUtils.isNotFalse(manual.getAsyncSupported());
Route route = null;
for (Route o : business.route().pick(manual.getRouteList())) {
if (StringUtils.equals(o.getName(), this.task.getRouteName())) {
......@@ -204,9 +203,12 @@ class ActionProcessing extends BaseAction {
break;
}
}
if ((null != route) && (StringUtils.equals(route.getType(), Route.TYPE_APPENDTASK))
&& StringUtils.equals(manual.getId(), route.getActivity())) {
this.type = TYPE_APPENDTASK;
if (null != route) {
this.asyncSupported = BooleanUtils.isNotFalse(route.getAsyncSupported());
if (StringUtils.equals(route.getType(), Route.TYPE_APPENDTASK)
&& StringUtils.equals(manual.getId(), route.getActivity())) {
this.type = TYPE_APPENDTASK;
}
}
}
}
......
package com.x.processplatform.assemble.surface.jaxrs.task;
public class ProcessingRunnableImpl implements Runnable {
public void run() {
// TODO Auto-generated method stub
}
}
......@@ -6,7 +6,14 @@ public final class PersistenceProperties extends AbstractPersistenceProperties {
public static class Content {
private Content() {
}
public static class Draft {
private Draft() {
}
public static final String table = "PP_C_DRAFT";
}
......@@ -203,8 +210,17 @@ public final class PersistenceProperties extends AbstractPersistenceProperties {
}
public static class Log {
private Log() {
}
public static class SignalStackLog {
private SignalStackLog() {
}
public static final String table = "PP_L_SIGNALSTACKLOG";
}
}
......
......@@ -68,7 +68,7 @@ public class Manual extends Activity {
@PostLoad
public void postLoad() {
this.asyncSupported = this.getProperties().getAsyncSupported();
// this.asyncSupported = this.getProperties().getAsyncSupported();
}
public Manual() {
......@@ -82,17 +82,17 @@ public class Manual extends Activity {
return this.properties;
}
public Boolean getAsyncSupported() {
return asyncSupported;
}
public void setAsyncSupported(Boolean asyncSupported) {
this.asyncSupported = asyncSupported;
this.getProperties().setAsyncSupported(asyncSupported);
}
@Transient
private Boolean asyncSupported;
// public Boolean getAsyncSupported() {
// return asyncSupported;
// }
//
// public void setAsyncSupported(Boolean asyncSupported) {
// this.asyncSupported = asyncSupported;
// this.getProperties().setAsyncSupported(asyncSupported);
// }
//
// @Transient
// private Boolean asyncSupported;
@FieldDescribe("分组")
@CheckPersist(allowEmpty = true)
......
......@@ -5,15 +5,4 @@ import com.x.base.core.project.annotation.FieldDescribe;
public class ManualProperties extends JsonProperties {
@FieldDescribe("是否启用异步返回.")
private Boolean asyncSupported = true;
public Boolean getAsyncSupported() {
return asyncSupported;
}
public void setAsyncSupported(Boolean asyncSupported) {
this.asyncSupported = asyncSupported;
}
}
......@@ -10,11 +10,15 @@ import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Lob;
import javax.persistence.PostLoad;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.persistence.UniqueConstraint;
import org.apache.commons.lang3.StringUtils;
import org.apache.openjpa.persistence.Persistent;
import org.apache.openjpa.persistence.jdbc.Index;
import org.apache.openjpa.persistence.jdbc.Strategy;
import com.x.base.core.entity.AbstractPersistenceProperties;
import com.x.base.core.entity.JpaObject;
......@@ -58,16 +62,44 @@ public class Route extends SliceJpaObject {
@Column(length = length_id, name = ColumnNamePrefix + id_FIELDNAME)
private String id = createId();
/* 以上为 JpaObject 默认字段 */
public void onPersist() throws Exception {
/* 如果脚本为空,添加默认返回true 的脚本 */
// 如果脚本为空,添加默认返回true 的脚本
if (StringUtils.isEmpty(script) && StringUtils.isEmpty(scriptText)) {
this.scriptText = "return true;";
}
}
/* 更新运行方法 */
@PostLoad
public void postLoad() {
this.asyncSupported = this.getProperties().getAsyncSupported();
}
public Route() {
this.properties = new RouteProperties();
}
public RouteProperties getProperties() {
if (null == this.properties) {
this.properties = new RouteProperties();
}
return this.properties;
}
public void setProperties(RouteProperties properties) {
this.properties = properties;
}
public Boolean getAsyncSupported() {
return asyncSupported;
}
public void setAsyncSupported(Boolean asyncSupported) {
this.asyncSupported = asyncSupported;
this.getProperties().setAsyncSupported(asyncSupported);
}
@Transient
private Boolean asyncSupported;
public static final String name_FIELDNAME = "name";
@FieldDescribe("名称.")
......@@ -270,6 +302,14 @@ public class Route extends SliceJpaObject {
@Column(length = JpaObject.length_255B, name = ColumnNamePrefix + edition_FIELDNAME)
private String edition;
public static final String properties_FIELDNAME = "properties";
@FieldDescribe("属性对象存储字段.")
@Persistent(fetch = FetchType.EAGER)
@Strategy(JsonPropertiesValueHandler)
@Column(length = JpaObject.length_10M, name = ColumnNamePrefix + properties_FIELDNAME)
@CheckPersist(allowEmpty = true)
private RouteProperties properties;
public String getAppendTaskIdentityType() {
return appendTaskIdentityType;
}
......
package com.x.processplatform.core.entity.element;
import com.x.base.core.entity.JsonProperties;
import com.x.base.core.project.annotation.FieldDescribe;
public class RouteProperties extends JsonProperties {
@FieldDescribe("是否启用异步返回.")
private Boolean asyncSupported = true;
public Boolean getAsyncSupported() {
return asyncSupported;
}
public void setAsyncSupported(Boolean asyncSupported) {
this.asyncSupported = asyncSupported;
}
}
......@@ -6,7 +6,7 @@ import com.x.base.core.project.annotation.FieldDescribe;
public class SignalStackLogProperties extends JsonProperties {
private static final long serialVersionUID = 5194057760551594662L;
@FieldDescribe("号栈.")
@FieldDescribe("号栈.")
private SignalStack signalStack;
public SignalStack getSignalStack() {
......
package com.x.processplatform.service.processing;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import org.apache.commons.collections4.list.SetUniqueList;
......@@ -10,11 +9,8 @@ import org.apache.commons.lang3.StringUtils;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
import com.x.base.core.entity.annotation.CheckPersistType;
import com.x.base.core.project.config.Config;
import com.x.base.core.project.tools.ListTools;
import com.x.processplatform.core.entity.content.Work;
import com.x.processplatform.core.entity.log.SignalStackLog;
import com.x.processplatform.core.express.ProcessingAttributes;
import com.x.processplatform.service.processing.configurator.ProcessingConfigurator;
......@@ -64,9 +60,9 @@ public class Processing extends BaseProcessing {
if (StringUtils.isEmpty(workId)) {
return;
}
/* workStatus is processing */
// workStatus is processing
List<String> nextLoops = SetUniqueList.setUniqueList(new ArrayList<String>());
/* 强制从arrived开始 */
// 强制从arrived开始
if (BooleanUtils.isTrue(processingAttributes.ifForceJoinAtArrive())) {
workId = this.arrive(workId, processingConfigurator, processingAttributes);
}
......@@ -80,7 +76,7 @@ public class Processing extends BaseProcessing {
if (BooleanUtils.isFalse(processingAttributes.ifForceJoinAtInquire())) {
executed = this.execute(workId, processingConfigurator, processingAttributes);
} else {
/* 强制从inquire开始 */
// 强制从inquire开始
executed = new ArrayList<>();
executed.add(workId);
}
......
......@@ -27,17 +27,4 @@ public class ProcessingToProcessingSignalStack extends ConcurrentHashMap<String,
return work + SPLIT + series;
}
// @Test
// public void test() {
// ProcessingToProcessingSignalMapping m = new ProcessingToProcessingSignalMapping();
// Signal s1 = m.open("111", "222");
// System.out.println(s1);
// Signal s2 = m.open("111", "222");
// System.out.println(s2);
// System.out.println(s2==s1);
// m.close("111", "222");
// m.close("111", "222");
// System.out.println(m.size());
// }
}
......@@ -48,9 +48,8 @@ public class EndProcessor extends AbstractEndProcessor {
aeiObjects.getProcessingAttributes().push(Signal.endExecute());
List<Work> results = new ArrayList<>();
Work other = aeiObjects.getWorks().stream().filter(o -> {
return o != aeiObjects.getWork();
}).sorted(Comparator.comparing(Work::getCreateTime)).findFirst().orElse(null);
Work other = aeiObjects.getWorks().stream().filter(o -> o != aeiObjects.getWork())
.sorted(Comparator.comparing(Work::getCreateTime)).findFirst().orElse(null);
if (null != other) {
aeiObjects.getUpdateWorks().add(other);
......
......@@ -293,7 +293,7 @@ public class ManualProcessor extends AbstractManualProcessor {
logger.info("工作设置的处理人已经全部无效,重新计算当前环节所有处理人进行处理,标题:{}, id:{}, 设置的处理人:{}.", aeiObjects.getWork().getTitle(),
aeiObjects.getWork().getId(), identities);
// 后面进行了identitis.remove()这里必须用一个新对象包装
aeiObjects.getWork().setManualTaskIdentityList(new ArrayList<String>(identities));
aeiObjects.getWork().setManualTaskIdentityList(new ArrayList<>(identities));
}
// 发送ProcessingSignal
......
......@@ -36,7 +36,7 @@ public class MessageProcessor extends AbstractMessageProcessor {
@Override
protected List<Work> executing(AeiObjects aeiObjects, Message message) throws Exception {
// 发送ProcessingSignal
aeiObjects.getProcessingAttributes().push(Signal.embedExecute());
aeiObjects.getProcessingAttributes().push(Signal.messageExecute());
MessageFactory.activity_message(aeiObjects.getWork(), null);
List<Work> results = new ArrayList<>();
results.add(aeiObjects.getWork());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册