ActionComplex.java 2.0 KB
Newer Older
Z
zhourui 已提交
1 2 3 4 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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
//package com.x.processplatform.assemble.surface.jaxrs.work;
//
//import org.apache.commons.lang3.BooleanUtils;
//
//import com.x.base.core.container.EntityManagerContainer;
//import com.x.base.core.container.factory.EntityManagerContainerFactory;
//import com.x.base.core.project.http.ActionResult;
//import com.x.base.core.project.http.EffectivePerson;
//import com.x.base.core.project.logger.Logger;
//import com.x.base.core.project.logger.LoggerFactory;
//import com.x.processplatform.assemble.surface.Business;
//import com.x.processplatform.core.entity.content.Work;
//import com.x.processplatform.core.entity.element.Form;
//
//class ActionComplex extends BaseAction {
//
//	private static Logger logger = LoggerFactory.getLogger(ActionComplex.class);
//
//	ActionResult<Wo> execute(EffectivePerson effectivePerson, String id) throws Exception {
//		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
//			ActionResult<Wo> result = new ActionResult<>();
//			Business business = new Business(emc);
//			Work work = emc.find(id, Work.class);
//			if (null == work) {
//				throw new ExceptionWorkNotExist(id);
//			}
//			Wo wo = this.get(business, effectivePerson, work, Wo.class);
//			WoControl control = wo.getControl();
//			if (BooleanUtils.isNotTrue(control.getAllowVisit())) {
//				throw new ExceptionWorkAccessDenied(effectivePerson.getDistinguishedName(), work.getTitle(),
//						work.getId());
//			}
//			wo.setForm(this.referenceForm(business, work));
//			result.setData(wo);
//			return result;
//		}
//	}
//
//	private WoForm referenceForm(Business business, Work work) throws Exception {
//		Form form = business.form().pick(work.getForm());
//		if (null == form) {
//			logger.info("work title:{}, id:{}, can not find form:{}.", work.getTitle(), work.getId(), work.getForm());
//			return null;
//		}
//		WoForm woForm = new WoForm();
//		form.copyTo(woForm, "data", "mobileData");
//		woForm.setData(form.getDataOrMobileData());
//		return woForm;
//	}
//
//	public static class Wo extends AbstractWo {
//	}
//
//}