提交 c1cb4ede 编写于 作者: O o2null

Merge branch 'feature/documentVersionWithData' into 'develop'

documentVersion输出Data

See merge request o2oa/o2oa!183
......@@ -3,7 +3,7 @@
"consumers": [],
"consumersV2": {
"qiyeweixin": "excute",
"describe": "excute表示脚本messageRule.js中的方法名称,该js文件需放在与messages.json同目录下,更改脚本需重启服务"
"describe": "excute表示脚本messageSendRule.js中的方法名称,该js文件需放在与messages.json同目录下,更改脚本需重启服务"
}
},
"attachment_editor": {
......
......@@ -451,14 +451,13 @@ public class Config {
if (null == instance().version) {
synchronized (Config.class) {
if (null == instance().version) {
String text = BaseTools.readCfg(PATH_VERSION);
if (XGsonBuilder.isJson(text)) {
String text = BaseTools.readString(PATH_VERSION);
if (XGsonBuilder.isJsonObject(text)) {
JsonObject obj = XGsonBuilder.instance().fromJson(text, JsonObject.class);
instance().version = obj.get("version").getAsString();
} else {
instance().version = text;
}
}
}
}
......
......@@ -151,13 +151,33 @@ public class XGsonBuilder {
return instance().fromJson(element, cls);
}
public static boolean isJson(String json) {
public static boolean isJsonObject(String json) {
if (StringUtils.isBlank(json)) {
return false;
}
try {
new JsonParser().parse(json);
return true;
JsonElement jsonElement = new JsonParser().parse(json);
if (jsonElement.isJsonObject()){
return true;
} else {
return false;
}
} catch (JsonParseException e) {
return false;
}
}
public static boolean isJsonArray(String json) {
if (StringUtils.isBlank(json)) {
return false;
}
try {
JsonElement jsonElement = new JsonParser().parse(json);
if (jsonElement.isJsonArray()){
return true;
} else {
return false;
}
} catch (JsonParseException e) {
return false;
}
......
......@@ -45,7 +45,7 @@ public class ProjectionExecuteQueue extends AbstractQueue<String> {
if (null == process) {
throw new ExceptionEntityNotExist(id, Process.class);
}
if (StringUtils.isNotEmpty(process.getProjection()) && XGsonBuilder.isJson(process.getProjection())) {
if (XGsonBuilder.isJsonArray(process.getProjection())) {
List<Projection> projections = XGsonBuilder.instance().fromJson(process.getProjection(),
new TypeToken<List<Projection>>() {
}.getType());
......
......@@ -35,7 +35,7 @@ class ActionExecuteProjection extends BaseAction {
throw new ExceptionAccessDenied(effectivePerson.getDistinguishedName());
}
Wo wo = new Wo();
if (StringUtils.isNotEmpty(process.getProjection()) && XGsonBuilder.isJson(process.getProjection())) {
if (XGsonBuilder.isJsonArray(process.getProjection())) {
if (!ThisApplication.projectionExecuteQueue.contains(process.getId())) {
ThisApplication.projectionExecuteQueue.send(process.getId());
wo.setValue(true);
......
//package com.x.processplatform.assemble.designer.jaxrs.projection;
//
//import com.x.base.core.container.EntityManagerContainer;
//import com.x.base.core.container.factory.EntityManagerContainerFactory;
//import com.x.base.core.project.exception.ExceptionAccessDenied;
//import com.x.base.core.project.exception.ExceptionEntityNotExist;
//import com.x.base.core.project.http.ActionResult;
//import com.x.base.core.project.http.EffectivePerson;
//import com.x.base.core.project.jaxrs.WrapBoolean;
//import com.x.processplatform.assemble.designer.Business;
//import com.x.processplatform.assemble.designer.ThisApplication;
//import com.x.processplatform.core.entity.element.Application;
//import com.x.processplatform.core.entity.element.Process;
//import com.x.processplatform.core.entity.element.Projection;
//
//class ActionExecute extends BaseAction {
//
// ActionResult<Wo> execute(EffectivePerson effectivePerson, String flag) throws Exception {
// try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
// ActionResult<Wo> result = new ActionResult<>();
// Business business = new Business(emc);
// Projection projection = emc.flag(flag, Projection.class);
// if (null == projection) {
// throw new ExceptionEntityNotExist(flag, Projection.class);
// }
// Application application = emc.flag(projection.getApplication(), Application.class);
// if (null == application) {
// throw new ExceptionEntityNotExist(projection.getApplication(), Application.class);
// }
// if (!business.editable(effectivePerson, application)) {
// throw new ExceptionAccessDenied(effectivePerson.getDistinguishedName());
// }
// if (!ThisApplication.projectionExecuteQueue.contains(projection.getId())) {
// ThisApplication.projectionExecuteQueue.send(projection.getId());
// } else {
// throw new ExceptionAlreadyAddQueue();
// }
// Wo wo = new Wo();
// wo.setValue(true);
// result.setData(wo);
// return result;
// }
// }
//
// public static class Wo extends WrapBoolean {
//
// }
//
//}
\ No newline at end of file
......@@ -45,7 +45,7 @@ public class ProjectionExecuteQueue extends AbstractQueue<String> {
if (null == process) {
throw new ExceptionEntityNotExist(id, Process.class);
}
if (StringUtils.isNotEmpty(process.getProjection()) && XGsonBuilder.isJson(process.getProjection())) {
if (XGsonBuilder.isJsonArray(process.getProjection())) {
List<Projection> projections = XGsonBuilder.instance().fromJson(process.getProjection(),
new TypeToken<List<Projection>>() {
}.getType());
......
......@@ -35,7 +35,7 @@ class ActionExecuteProjection extends BaseAction {
throw new ExceptionAccessDenied(effectivePerson.getDistinguishedName());
}
Wo wo = new Wo();
if (StringUtils.isNotEmpty(process.getProjection()) && XGsonBuilder.isJson(process.getProjection())) {
if (XGsonBuilder.isJsonArray(process.getProjection())) {
if (!ThisApplication.projectionExecuteQueue.contains(process.getId())) {
ThisApplication.projectionExecuteQueue.send(process.getId());
wo.setValue(true);
......
......@@ -9,7 +9,6 @@ import com.x.base.core.container.factory.EntityManagerContainerFactory;
import com.x.base.core.entity.JpaObject;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
import com.x.base.core.project.exception.ExceptionAccessDenied;
import com.x.base.core.project.exception.ExceptionAccessDeniedOrEntityNotExist;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
......@@ -57,7 +56,7 @@ class ActionListWithJob extends BaseAction {
static final long serialVersionUID = 5610132069178497370L;
static WrapCopier<DocumentVersion, Wo> copier = WrapCopierFactory.wo(DocumentVersion.class, Wo.class,
JpaObject.singularAttributeField(DocumentVersion.class, true, true), null);
JpaObject.singularAttributeField(DocumentVersion.class, true, false), null);
}
......
......@@ -56,7 +56,7 @@ class ActionListWithJobCategory extends BaseAction {
static final long serialVersionUID = 5610132069178497370L;
static WrapCopier<DocumentVersion, Wo> copier = WrapCopierFactory.wo(DocumentVersion.class, Wo.class,
JpaObject.singularAttributeField(DocumentVersion.class, true, true), null);
JpaObject.singularAttributeField(DocumentVersion.class, true, false), null);
}
......
......@@ -57,7 +57,7 @@ class ActionListWithWorkOrWorkCompleted extends BaseAction {
static final long serialVersionUID = 5610132069178497370L;
static WrapCopier<DocumentVersion, Wo> copier = WrapCopierFactory.wo(DocumentVersion.class, Wo.class,
JpaObject.singularAttributeField(DocumentVersion.class, true, true), null);
JpaObject.singularAttributeField(DocumentVersion.class, true, false), null);
}
......
......@@ -58,7 +58,7 @@ class ActionListWithWorkOrWorkCompletedCategory extends BaseAction {
static final long serialVersionUID = 5610132069178497370L;
static WrapCopier<DocumentVersion, Wo> copier = WrapCopierFactory.wo(DocumentVersion.class, Wo.class,
JpaObject.singularAttributeField(DocumentVersion.class, true, true), null);
JpaObject.singularAttributeField(DocumentVersion.class, true, false), null);
}
......
......@@ -105,7 +105,7 @@ class ActionProjection extends BaseAction {
private List<Projection> listProjections(Process process) {
String text = process.getProjection();
if (StringUtils.isNotEmpty(text) && XGsonBuilder.isJson(text)) {
if (XGsonBuilder.isJsonArray(text)) {
return XGsonBuilder.instance().fromJson(text, new TypeToken<List<Projection>>() {
}.getType());
}
......
......@@ -228,7 +228,7 @@ public class AeiObjects extends GsonPropertyObject {
if (null == this.projections) {
if (null != this.getProcess()) {
String text = this.getProcess().getProjection();
if (StringUtils.isNotEmpty(text) && XGsonBuilder.isJson(text)) {
if (XGsonBuilder.isJsonArray(text)) {
this.projections = XGsonBuilder.instance().fromJson(text, new TypeToken<List<Projection>>() {
}.getType());
}
......
......@@ -166,7 +166,6 @@ public class EndProcessor extends AbstractEndProcessor {
formMobileString = form.getMobileData();
}
}
WorkCompleted workCompleted = new WorkCompleted(work, completedTime, duration, formString, formMobileString);
return workCompleted;
return new WorkCompleted(work, completedTime, duration, formString, formMobileString);
}
}
\ No newline at end of file
......@@ -4,8 +4,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.collections4.list.TreeList;
import com.google.gson.JsonElement;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
......@@ -18,13 +16,14 @@ import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.jaxrs.WoId;
import com.x.query.assemble.surface.Business;
import com.x.query.assemble.surface.jaxrs.view.ActionBundle.Wi;
import com.x.query.core.entity.Query;
import com.x.query.core.entity.View;
import com.x.query.core.express.plan.FilterEntry;
import com.x.query.core.express.plan.Plan;
import com.x.query.core.express.plan.Runtime;
import org.apache.commons.collections4.list.TreeList;
class ActionExecuteWithQuery extends BaseAction {
ActionResult<Plan> execute(EffectivePerson effectivePerson, String flag, String queryFlag, JsonElement jsonElement)
......
......@@ -4,8 +4,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.collections4.list.TreeList;
import com.google.gson.JsonElement;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
......@@ -18,13 +16,14 @@ import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.jaxrs.WoId;
import com.x.query.assemble.surface.Business;
import com.x.query.assemble.surface.jaxrs.view.ActionBundle.Wi;
import com.x.query.core.entity.Query;
import com.x.query.core.entity.View;
import com.x.query.core.express.plan.FilterEntry;
import com.x.query.core.express.plan.Plan;
import com.x.query.core.express.plan.Runtime;
import org.apache.commons.collections4.list.TreeList;
class ActionExecuteWithQuery extends BaseAction {
ActionResult<Plan> execute(EffectivePerson effectivePerson, String flag, String queryFlag, JsonElement jsonElement)
......
......@@ -232,7 +232,6 @@ public abstract class Plan extends GsonPropertyObject {
ScriptEngine engine = this.getScriptEngine();
engine.put("gird", table);
engine.eval(Config.mooToolsScriptText());
// engine.put("organization", new Organization(emc));
for (SelectEntry selectEntry : this.selectList) {
if (StringUtils.isNotBlank(selectEntry.code)) {
List<ExtractObject> extractObjects = new TreeList<>();
......@@ -254,9 +253,6 @@ public abstract class Plan extends GsonPropertyObject {
text.append("var o= {\n");
text.append("'value':extractObject.getValue(),\n");
text.append("'entry':extractObject.getEntry(),\n");
// text.append(
// "'entry':com.x.base.core.project.gson.XGsonBuilder.toJson(extractObject.getEntry()),\n");
// text.append("'girdData':gird,\n");
text.append("'columnName':extractObject.getColumn()\n");
text.append("}\n");
text.append("extractObject.setValue(executeScript.apply(o));\n");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册