ActionDeleteDataPath3.java 1.6 KB
Newer Older
R
roo00 已提交
1 2 3
package com.x.processplatform.service.processing.jaxrs.applicationdict;

import java.util.concurrent.Callable;
O
o2null 已提交
4
import java.util.concurrent.TimeUnit;
R
roo00 已提交
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37

import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
import com.x.base.core.project.exception.ExceptionEntityNotExist;
import com.x.base.core.project.executor.ProcessPlatformExecutorFactory;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.jaxrs.WoId;
import com.x.processplatform.core.entity.element.ApplicationDict;
import com.x.processplatform.service.processing.Business;

class ActionDeleteDataPath3 extends BaseAction {

	ActionResult<Wo> execute(String id, String path0, String path1, String path2, String path3) throws Exception {

		Callable<ActionResult<Wo>> callable = new Callable<ActionResult<Wo>>() {
			public ActionResult<Wo> call() throws Exception {
				try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
					ActionResult<Wo> result = new ActionResult<>();
					Business business = new Business(emc);
					ApplicationDict dict = emc.find(id, ApplicationDict.class);
					if (null == dict) {
						throw new ExceptionEntityNotExist(id, ApplicationDict.class);
					}
					delete(business, dict, path0, path1, path2, path3);
					emc.commit();
					Wo wo = new Wo();
					wo.setId(dict.getId());
					result.setData(wo);
					return result;
				}
			}
		};

O
o2null 已提交
38
		return ProcessPlatformExecutorFactory.get(id).submit(callable).get(300, TimeUnit.SECONDS);
R
roo00 已提交
39 40 41 42 43 44
	}

	public static class Wo extends WoId {

	}
}