提交 04dead06 编写于 作者: O o2sword

修改视图执行过程事务嵌套的问题

上级 8f42bac0
......@@ -31,10 +31,13 @@ class ActionBundle extends BaseAction {
ActionResult<Wo> execute(EffectivePerson effectivePerson, String id, JsonElement jsonElement) throws Exception {
logger.debug("jsonElement:{}.", jsonElement);
ActionResult<Wo> result = new ActionResult<>();
View view;
Runtime runtime;
Business business;
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
ActionResult<Wo> result = new ActionResult<>();
Business business = new Business(emc);
View view = business.pick(id, View.class);
business = new Business(emc);
view = business.pick(id, View.class);
if (null == view) {
throw new ExceptionEntityNotExist(id, View.class);
}
......@@ -52,14 +55,14 @@ class ActionBundle extends BaseAction {
if (null == wi) {
wi = new Wi();
}
Runtime runtime = this.runtime(effectivePerson, business, view, wi.getFilterList(), wi.getParameter(),
runtime = this.runtime(effectivePerson, business, view, wi.getFilterList(), wi.getParameter(),
wi.getCount(), true);
List<String> os = this.fetchBundle(business, view, runtime);
Wo wo = new Wo();
wo.setValueList(os);
result.setData(wo);
return result;
}
List<String> os = this.fetchBundle(business, view, runtime);
Wo wo = new Wo();
wo.setValueList(os);
result.setData(wo);
return result;
}
public static class Wi extends GsonPropertyObject {
......@@ -107,4 +110,4 @@ class ActionBundle extends BaseAction {
}
}
\ No newline at end of file
}
......@@ -27,9 +27,12 @@ class ActionBundleWithQuery extends BaseAction {
ActionResult<Wo> execute(EffectivePerson effectivePerson, String flag, String queryFlag, JsonElement jsonElement)
throws Exception {
ActionResult<Wo> result = new ActionResult<>();
View view;
Runtime runtime;
Business business;
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
ActionResult<Wo> result = new ActionResult<>();
Business business = new Business(emc);
business = new Business(emc);
Query query = business.pick(queryFlag, Query.class);
if (null == query) {
throw new ExceptionEntityNotExist(queryFlag, Query.class);
......@@ -38,7 +41,7 @@ class ActionBundleWithQuery extends BaseAction {
throw new ExceptionAccessDenied(effectivePerson, query);
}
String id = business.view().getWithQuery(flag, query);
View view = business.pick(id, View.class);
view = business.pick(id, View.class);
if (null == view) {
throw new ExceptionEntityNotExist(flag, View.class);
}
......@@ -49,13 +52,13 @@ class ActionBundleWithQuery extends BaseAction {
if (null == wi) {
wi = new Wi();
}
Runtime runtime = this.runtime(effectivePerson, business, view, wi.getFilterList(), wi.getParameter(),
runtime = this.runtime(effectivePerson, business, view, wi.getFilterList(), wi.getParameter(),
wi.getCount(), true);
Wo wo = new Wo();
wo.setValueList(this.fetchBundle(business, view, runtime));
result.setData(wo);
return result;
}
Wo wo = new Wo();
wo.setValueList(this.fetchBundle(business, view, runtime));
result.setData(wo);
return result;
}
public static class Wo extends WrapStringList {
......@@ -102,4 +105,4 @@ class ActionBundleWithQuery extends BaseAction {
}
}
\ No newline at end of file
}
......@@ -31,10 +31,13 @@ class ActionExcel extends BaseAction {
private static Logger logger = LoggerFactory.getLogger(ActionExcel.class);
ActionResult<Wo> execute(EffectivePerson effectivePerson, String id, JsonElement jsonElement) throws Exception {
ActionResult<Wo> result = new ActionResult<>();
View view;
Runtime runtime;
Business business;
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
ActionResult<Wo> result = new ActionResult<>();
Business business = new Business(emc);
View view = business.pick(id, View.class);
business = new Business(emc);
view = business.pick(id, View.class);
if (null == view) {
throw new ExceptionEntityNotExist(id, View.class);
}
......@@ -49,16 +52,16 @@ class ActionExcel extends BaseAction {
throw new ExceptionAccessDenied(effectivePerson, view);
}
Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
Runtime runtime = this.runtime(effectivePerson, business, view, wi.getFilterList(), wi.getParameter(),
runtime = this.runtime(effectivePerson, business, view, wi.getFilterList(), wi.getParameter(),
wi.getCount(), false);
runtime.bundleList = wi.getBundleList();
Plan plan = this.accessPlan(business, view, runtime);
String excelFlag = this.girdWriteToExcel(effectivePerson, business, plan, view);
Wo wo = new Wo();
wo.setId(excelFlag);
result.setData(wo);
return result;
}
Plan plan = this.accessPlan(business, view, runtime);
String excelFlag = this.girdWriteToExcel(effectivePerson, business, plan, view);
Wo wo = new Wo();
wo.setId(excelFlag);
result.setData(wo);
return result;
}
public static class Wo extends WoId {
......@@ -112,4 +115,4 @@ class ActionExcel extends BaseAction {
}
}
}
\ No newline at end of file
}
......@@ -28,9 +28,12 @@ class ActionExcelWithQuery extends BaseAction {
ActionResult<Wo> execute(EffectivePerson effectivePerson, String flag, String queryFlag, JsonElement jsonElement)
throws Exception {
ActionResult<Wo> result = new ActionResult<>();
View view;
Runtime runtime;
Business business;
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
ActionResult<Wo> result = new ActionResult<>();
Business business = new Business(emc);
business = new Business(emc);
Query query = business.pick(queryFlag, Query.class);
if (null == query) {
throw new ExceptionEntityNotExist(queryFlag, Query.class);
......@@ -39,7 +42,7 @@ class ActionExcelWithQuery extends BaseAction {
throw new ExceptionAccessDenied(effectivePerson, query);
}
String id = business.view().getWithQuery(flag, query);
View view = business.pick(id, View.class);
view = business.pick(id, View.class);
if (null == view) {
throw new ExceptionEntityNotExist(flag, View.class);
}
......@@ -47,16 +50,16 @@ class ActionExcelWithQuery extends BaseAction {
throw new ExceptionAccessDenied(effectivePerson, view);
}
Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
Runtime runtime = this.runtime(effectivePerson, business, view, wi.getFilterList(), wi.getParameter(),
runtime = this.runtime(effectivePerson, business, view, wi.getFilterList(), wi.getParameter(),
wi.getCount(), false);
runtime.bundleList = wi.getBundleList();
Plan plan = this.accessPlan(business, view, runtime);
String excelFlag = this.girdWriteToExcel(effectivePerson, business, plan, view);
Wo wo = new Wo();
wo.setId(excelFlag);
result.setData(wo);
return result;
}
Plan plan = this.accessPlan(business, view, runtime);
String excelFlag = this.girdWriteToExcel(effectivePerson, business, plan, view);
Wo wo = new Wo();
wo.setId(excelFlag);
result.setData(wo);
return result;
}
public static class Wo extends WoId {
......@@ -113,4 +116,4 @@ class ActionExcelWithQuery extends BaseAction {
}
}
\ No newline at end of file
}
......@@ -31,11 +31,13 @@ class ActionExecute extends BaseAction {
ActionResult<Plan> execute(EffectivePerson effectivePerson, String id, JsonElement jsonElement) throws Exception {
logger.debug("jsonElement:{}.", jsonElement);
ActionResult<Plan> result = new ActionResult<>();
View view;
Runtime runtime;
Business business;
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
ActionResult<Plan> result = new ActionResult<>();
Business business = new Business(emc);
View view = business.pick(id, View.class);
business = new Business(emc);
view = business.pick(id, View.class);
if (null == view) {
throw new ExceptionEntityNotExist(id, View.class);
}
......@@ -53,13 +55,13 @@ class ActionExecute extends BaseAction {
if (null == wi) {
wi = new Wi();
}
Runtime runtime = this.runtime(effectivePerson, business, view, wi.getFilterList(), wi.getParameter(),
runtime = this.runtime(effectivePerson, business, view, wi.getFilterList(), wi.getParameter(),
wi.getCount(), false);
runtime.bundleList = wi.getBundleList();
Plan plan = this.accessPlan(business, view, runtime);
result.setData(plan);
return result;
}
Plan plan = this.accessPlan(business, view, runtime);
result.setData(plan);
return result;
}
public static class Wi extends GsonPropertyObject {
......@@ -112,4 +114,4 @@ class ActionExecute extends BaseAction {
}
}
}
\ No newline at end of file
}
......@@ -28,9 +28,12 @@ class ActionExecuteWithQuery extends BaseAction {
ActionResult<Plan> execute(EffectivePerson effectivePerson, String flag, String queryFlag, JsonElement jsonElement)
throws Exception {
ActionResult<Plan> result = new ActionResult<>();
View view;
Runtime runtime;
Business business;
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
ActionResult<Plan> result = new ActionResult<>();
Business business = new Business(emc);
business = new Business(emc);
Query query = business.pick(queryFlag, Query.class);
if (null == query) {
throw new ExceptionEntityNotExist(queryFlag, Query.class);
......@@ -39,7 +42,7 @@ class ActionExecuteWithQuery extends BaseAction {
throw new ExceptionAccessDenied(effectivePerson, query);
}
String id = business.view().getWithQuery(flag, query);
View view = business.pick(id, View.class);
view = business.pick(id, View.class);
if (null == view) {
throw new ExceptionEntityNotExist(flag, View.class);
}
......@@ -50,13 +53,13 @@ class ActionExecuteWithQuery extends BaseAction {
if (null == wi) {
wi = new Wi();
}
Runtime runtime = this.runtime(effectivePerson, business, view, wi.getFilterList(), wi.getParameter(),
runtime = this.runtime(effectivePerson, business, view, wi.getFilterList(), wi.getParameter(),
wi.getCount(), false);
runtime.bundleList = wi.getBundleList();
Plan plan = this.accessPlan(business, view, runtime);
result.setData(plan);
return result;
}
Plan plan = this.accessPlan(business, view, runtime);
result.setData(plan);
return result;
}
public static class Wo extends WoId {
......@@ -112,4 +115,4 @@ class ActionExecuteWithQuery extends BaseAction {
}
}
}
\ No newline at end of file
}
......@@ -9,6 +9,8 @@ import java.util.Map;
import java.util.Objects;
import com.google.gson.reflect.TypeToken;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
import com.x.processplatform.core.entity.element.Process;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
......@@ -47,16 +49,16 @@ abstract class BaseAction extends StandardJaxrsAction {
if (optional.isPresent()) {
plan = (Plan) optional.get();
} else {
plan = this.dealPlan(business, view, runtime);
plan = this.dealPlan(view, runtime);
CacheManager.put(business.cache(), cacheKey, plan);
}
} else {
plan = this.dealPlan(business, view, runtime);
plan = this.dealPlan(view, runtime);
}
return plan;
}
private Plan dealPlan(Business business, View view, Runtime runtime) throws Exception {
private Plan dealPlan(View view, Runtime runtime) throws Exception {
Plan plan = null;
switch (StringUtils.trimToEmpty(view.getType())) {
case View.TYPE_CMS:
......@@ -67,7 +69,7 @@ abstract class BaseAction extends StandardJaxrsAction {
break;
default:
ProcessPlatformPlan processPlatformPlan = gson.fromJson(view.getData(), ProcessPlatformPlan.class);
this.setProcessEdition(business, processPlatformPlan);
this.setProcessEdition(processPlatformPlan);
processPlatformPlan.runtime = runtime;
processPlatformPlan.access();
plan = processPlatformPlan;
......@@ -79,11 +81,15 @@ abstract class BaseAction extends StandardJaxrsAction {
return plan;
}
private void setProcessEdition(Business business, ProcessPlatformPlan processPlatformPlan) throws Exception {
private void setProcessEdition(ProcessPlatformPlan processPlatformPlan) throws Exception {
if(!processPlatformPlan.where.processList.isEmpty()){
List<String> _process_ids = ListTools.extractField(processPlatformPlan.where.processList, Process.id_FIELDNAME, String.class,
true, true);
List<Process> processList = business.process().listObjectWithProcess(_process_ids, true);
List<Process> processList;
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Business business = new Business(emc);
processList = business.process().listObjectWithProcess(_process_ids, true);
}
List<ProcessPlatformPlan.WhereEntry.ProcessEntry> listProcessEntry = gson.fromJson(gson.toJson(processList),
new TypeToken<List<ProcessPlatformPlan.WhereEntry.ProcessEntry>>(){}.getType());
if(!listProcessEntry.isEmpty()) {
......@@ -102,7 +108,7 @@ abstract class BaseAction extends StandardJaxrsAction {
break;
default:
ProcessPlatformPlan processPlatformPlan = gson.fromJson(view.getData(), ProcessPlatformPlan.class);
this.setProcessEdition(business, processPlatformPlan);
this.setProcessEdition(processPlatformPlan);
processPlatformPlan.runtime = runtime;
os = processPlatformPlan.fetchBundles();
break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册