ソースを参照

恢复getForm,getFormMobile

zhourui 5 年 前
コミット
d729f5b292

+ 44 - 43
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGet.java

@@ -1,43 +1,44 @@
-//package com.x.processplatform.assemble.surface.jaxrs.form;
-//
-//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.gson.GsonPropertyObject;
-//import com.x.base.core.project.http.ActionResult;
-//import com.x.base.core.project.http.EffectivePerson;
-//import com.x.processplatform.assemble.surface.Business;
-//import com.x.processplatform.core.entity.element.Form;
-//
-//class ActionGet 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);
-//			Form form = business.form().pick(flag);
-//			if (null == form) {
-//				throw new ExceptionEntityNotExist(flag, Form.class);
-//			}
-//			Wo wo = new Wo();
-//			wo.setData(form.getDataOrMobileData());
-//			result.setData(wo);
-//			return result;
-//		}
-//	}
-//
-//	public static class Wo extends GsonPropertyObject {
-//
-//		private String data;
-//
-//		public String getData() {
-//			return data;
-//		}
-//
-//		public void setData(String data) {
-//			this.data = data;
-//		}
-//
-//	}
-//
-//}
+package com.x.processplatform.assemble.surface.jaxrs.form;
+
+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.http.ActionResult;
+import com.x.base.core.project.http.EffectivePerson;
+import com.x.base.core.project.jaxrs.WoFastETag;
+import com.x.processplatform.assemble.surface.Business;
+import com.x.processplatform.core.entity.element.Form;
+
+class ActionGet 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);
+			Form form = business.form().pick(flag);
+			if (null == form) {
+				throw new ExceptionEntityNotExist(flag, Form.class);
+			}
+			Wo wo = new Wo();
+			wo.setData(form.getDataOrMobileData());
+			wo.setFastETag(form.getId() + form.getUpdateTime().getTime());
+			result.setData(wo);
+			return result;
+		}
+	}
+
+	public static class Wo extends WoFastETag {
+
+		private String data;
+
+		public String getData() {
+			return data;
+		}
+
+		public void setData(String data) {
+			this.data = data;
+		}
+
+	}
+
+}

+ 45 - 43
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGetMobile.java

@@ -1,43 +1,45 @@
-//package com.x.processplatform.assemble.surface.jaxrs.form;
-//
-//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.gson.GsonPropertyObject;
-//import com.x.base.core.project.http.ActionResult;
-//import com.x.base.core.project.http.EffectivePerson;
-//import com.x.processplatform.assemble.surface.Business;
-//import com.x.processplatform.core.entity.element.Form;
-//
-//class ActionGetMobile 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);
-//			Form form = business.form().pick(flag);
-//			if (null == form) {
-//				throw new ExceptionEntityNotExist(flag, Form.class);
-//			}
-//			Wo wo = new Wo();
-//			wo.setData(form.getMobileDataOrData());
-//			result.setData(wo);
-//			return result;
-//		}
-//	}
-//
-//	public static class Wo extends GsonPropertyObject {
-//
-//		private String data;
-//
-//		public String getData() {
-//			return data;
-//		}
-//
-//		public void setData(String data) {
-//			this.data = data;
-//		}
-//
-//	}
-//
-//}
+package com.x.processplatform.assemble.surface.jaxrs.form;
+
+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.gson.GsonPropertyObject;
+import com.x.base.core.project.http.ActionResult;
+import com.x.base.core.project.http.EffectivePerson;
+import com.x.base.core.project.jaxrs.WoFastETag;
+import com.x.processplatform.assemble.surface.Business;
+import com.x.processplatform.core.entity.element.Form;
+
+class ActionGetMobile 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);
+			Form form = business.form().pick(flag);
+			if (null == form) {
+				throw new ExceptionEntityNotExist(flag, Form.class);
+			}
+			Wo wo = new Wo();
+			wo.setData(form.getMobileDataOrData());
+			wo.setFastETag(form.getId() + form.getUpdateTime().getTime());
+			result.setData(wo);
+			return result;
+		}
+	}
+
+	public static class Wo extends WoFastETag {
+
+		private String data;
+
+		public String getData() {
+			return data;
+		}
+
+		public void setData(String data) {
+			this.data = data;
+		}
+
+	}
+
+}

+ 46 - 53
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGetWithApplication.java

@@ -1,53 +1,46 @@
-//package com.x.processplatform.assemble.surface.jaxrs.form;
-//
-//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.gson.GsonPropertyObject;
-//import com.x.base.core.project.http.ActionResult;
-//import com.x.base.core.project.http.EffectivePerson;
-//import com.x.processplatform.assemble.surface.Business;
-//import com.x.processplatform.core.entity.element.Application;
-//import com.x.processplatform.core.entity.element.Form;
-//
-//class ActionGetWithApplication extends BaseAction {
-//
-//	ActionResult<Wo> execute(EffectivePerson effectivePerson, String applicationFlag, String flag) throws Exception {
-//		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
-//			ActionResult<Wo> result = new ActionResult<>();
-//			Business business = new Business(emc);
-//			Application application = business.application().pick(applicationFlag);
-//			if (null == application) {
-//				throw new ExceptionEntityNotExist(applicationFlag, Application.class);
-//			}
-//			Form form = business.form().pick(application, flag);
-//			// Wo wo = Wo.copier.copy(form);
-//			Wo wo = new Wo();
-//			wo.setData(form.getDataOrMobileData());
-//			result.setData(wo);
-//			return result;
-//		}
-//	}
-//
-////	public static class Wo extends Form {
-////
-////		private static final long serialVersionUID = 1541438199059150837L;
-////
-////		static WrapCopier<Form, Wo> copier = WrapCopierFactory.wo(Form.class, Wo.class, null,
-////				JpaObject.FieldsInvisible);
-////
-////	}
-//	public static class Wo extends GsonPropertyObject {
-//
-//		private String data;
-//
-//		public String getData() {
-//			return data;
-//		}
-//
-//		public void setData(String data) {
-//			this.data = data;
-//		}
-//
-//	}
-//}
+package com.x.processplatform.assemble.surface.jaxrs.form;
+
+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.gson.GsonPropertyObject;
+import com.x.base.core.project.http.ActionResult;
+import com.x.base.core.project.http.EffectivePerson;
+import com.x.base.core.project.jaxrs.WoFastETag;
+import com.x.processplatform.assemble.surface.Business;
+import com.x.processplatform.core.entity.element.Application;
+import com.x.processplatform.core.entity.element.Form;
+
+class ActionGetWithApplication extends BaseAction {
+
+	ActionResult<Wo> execute(EffectivePerson effectivePerson, String applicationFlag, String flag) throws Exception {
+		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
+			ActionResult<Wo> result = new ActionResult<>();
+			Business business = new Business(emc);
+			Application application = business.application().pick(applicationFlag);
+			if (null == application) {
+				throw new ExceptionEntityNotExist(applicationFlag, Application.class);
+			}
+			Form form = business.form().pick(application, flag);
+			Wo wo = new Wo();
+			wo.setData(form.getDataOrMobileData());
+			wo.setFastETag(form.getId() + form.getUpdateTime().getTime());
+			result.setData(wo);
+			return result;
+		}
+	}
+
+	public static class Wo extends WoFastETag {
+
+		private String data;
+
+		public String getData() {
+			return data;
+		}
+
+		public void setData(String data) {
+			this.data = data;
+		}
+
+	}
+}

+ 50 - 49
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/ActionGetWithApplicationMobile.java

@@ -1,49 +1,50 @@
-//package com.x.processplatform.assemble.surface.jaxrs.form;
-//
-//import com.x.base.core.container.EntityManagerContainer;
-//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.ExceptionEntityNotExist;
-//import com.x.base.core.project.gson.GsonPropertyObject;
-//import com.x.base.core.project.http.ActionResult;
-//import com.x.base.core.project.http.EffectivePerson;
-//import com.x.processplatform.assemble.surface.Business;
-//import com.x.processplatform.core.entity.element.Application;
-//import com.x.processplatform.core.entity.element.Form;
-//
-//class ActionGetWithApplicationMobile extends BaseAction {
-//
-//	ActionResult<Wo> execute(EffectivePerson effectivePerson, String applicationFlag, String flag) throws Exception {
-//		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
-//			ActionResult<Wo> result = new ActionResult<>();
-//			Business business = new Business(emc);
-//			Application application = business.application().pick(applicationFlag);
-//			if (null == application) {
-//				throw new ExceptionEntityNotExist(applicationFlag, Application.class);
-//			}
-//			Form form = business.form().pick(application, flag);
-//			//Wo wo = Wo.copier.copy(form);
-//			Wo wo = new Wo();
-//			wo.setData(form.getMobileDataOrData());
-//			result.setData(wo);
-//			return result;
-//		}
-//	}
-//
-//	public static class Wo extends GsonPropertyObject {
-//
-//		private String data;
-//
-//		public String getData() {
-//			return data;
-//		}
-//
-//		public void setData(String data) {
-//			this.data = data;
-//		}
-//
-//	}
-//
-//}
+package com.x.processplatform.assemble.surface.jaxrs.form;
+
+import com.x.base.core.container.EntityManagerContainer;
+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.ExceptionEntityNotExist;
+import com.x.base.core.project.gson.GsonPropertyObject;
+import com.x.base.core.project.http.ActionResult;
+import com.x.base.core.project.http.EffectivePerson;
+import com.x.base.core.project.jaxrs.WoFastETag;
+import com.x.processplatform.assemble.surface.Business;
+import com.x.processplatform.core.entity.element.Application;
+import com.x.processplatform.core.entity.element.Form;
+
+class ActionGetWithApplicationMobile extends BaseAction {
+
+	ActionResult<Wo> execute(EffectivePerson effectivePerson, String applicationFlag, String flag) throws Exception {
+		try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
+			ActionResult<Wo> result = new ActionResult<>();
+			Business business = new Business(emc);
+			Application application = business.application().pick(applicationFlag);
+			if (null == application) {
+				throw new ExceptionEntityNotExist(applicationFlag, Application.class);
+			}
+			Form form = business.form().pick(application, flag);
+			Wo wo = new Wo();
+			wo.setData(form.getMobileDataOrData());
+			wo.setFastETag(form.getId() + form.getUpdateTime().getTime());
+			result.setData(wo);
+			return result;
+		}
+	}
+
+	public static class Wo extends WoFastETag {
+
+		private String data;
+
+		public String getData() {
+			return data;
+		}
+
+		public void setData(String data) {
+			this.data = data;
+		}
+
+	}
+
+}

+ 70 - 70
o2server/x_processplatform_assemble_surface/src/main/java/com/x/processplatform/assemble/surface/jaxrs/form/FormAction.java

@@ -66,79 +66,79 @@ public class FormAction extends StandardJaxrsAction {
 //		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
 //		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
 //	}
 //	}
 
 
-//	@JaxrsMethodDescribe(value = "获取表单.", action = ActionGet.class)
-//	@GET
-//	@Path("{flag}")
-//	@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
-//	@Consumes(MediaType.APPLICATION_JSON)
-//	public void get(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
-//			@JaxrsParameterDescribe("表单标识") @PathParam("flag") String flag) {
-//		ActionResult<ActionGet.Wo> result = new ActionResult<>();
-//		EffectivePerson effectivePerson = this.effectivePerson(request);
-//		try {
-//			result = new ActionGet().execute(effectivePerson, flag);
-//		} catch (Exception e) {
-//			logger.error(e, effectivePerson, request, null);
-//			result.error(e);
-//		}
-//		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
-//	}
+	@JaxrsMethodDescribe(value = "获取表单内容.", action = ActionGet.class)
+	@GET
+	@Path("{flag}")
+	@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
+	@Consumes(MediaType.APPLICATION_JSON)
+	public void get(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
+			@JaxrsParameterDescribe("表单标识") @PathParam("flag") String flag) {
+		ActionResult<ActionGet.Wo> result = new ActionResult<>();
+		EffectivePerson effectivePerson = this.effectivePerson(request);
+		try {
+			result = new ActionGet().execute(effectivePerson, flag);
+		} catch (Exception e) {
+			logger.error(e, effectivePerson, request, null);
+			result.error(e);
+		}
+		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
+	}
 
 
-//	@JaxrsMethodDescribe(value = "获取移动端表单.", action = ActionGetMobile.class)
-//	@GET
-//	@Path("{flag}/mobile")
-//	@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
-//	@Consumes(MediaType.APPLICATION_JSON)
-//	public void getMobile(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
-//			@JaxrsParameterDescribe("表单标识") @PathParam("flag") String flag) {
-//		ActionResult<ActionGetMobile.Wo> result = new ActionResult<>();
-//		EffectivePerson effectivePerson = this.effectivePerson(request);
-//		try {
-//			result = new ActionGetMobile().execute(effectivePerson, flag);
-//		} catch (Exception e) {
-//			logger.error(e, effectivePerson, request, null);
-//			result.error(e);
-//		}
-//		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
-//	}
+	@JaxrsMethodDescribe(value = "获取移动端表单内容.", action = ActionGetMobile.class)
+	@GET
+	@Path("{flag}/mobile")
+	@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
+	@Consumes(MediaType.APPLICATION_JSON)
+	public void getMobile(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
+			@JaxrsParameterDescribe("表单标识") @PathParam("flag") String flag) {
+		ActionResult<ActionGetMobile.Wo> result = new ActionResult<>();
+		EffectivePerson effectivePerson = this.effectivePerson(request);
+		try {
+			result = new ActionGetMobile().execute(effectivePerson, flag);
+		} catch (Exception e) {
+			logger.error(e, effectivePerson, request, null);
+			result.error(e);
+		}
+		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
+	}
 
 
-//	@JaxrsMethodDescribe(value = "根据标识和应用标识获取表单.", action = ActionGetWithApplication.class)
-//	@GET
-//	@Path("{flag}/application/{applicationFlag}")
-//	@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
-//	@Consumes(MediaType.APPLICATION_JSON)
-//	public void getWithApplication(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
-//			@JaxrsParameterDescribe("表单标识") @PathParam("flag") String flag,
-//			@JaxrsParameterDescribe("应用标识") @PathParam("applicationFlag") String applicationFlag) {
-//		ActionResult<ActionGetWithApplication.Wo> result = new ActionResult<>();
-//		EffectivePerson effectivePerson = this.effectivePerson(request);
-//		try {
-//			result = new ActionGetWithApplication().execute(effectivePerson, applicationFlag, flag);
-//		} catch (Exception e) {
-//			logger.error(e, effectivePerson, request, null);
-//			result.error(e);
-//		}
-//		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
-//	}
+	@JaxrsMethodDescribe(value = "根据标识和应用标识获取表单.", action = ActionGetWithApplication.class)
+	@GET
+	@Path("{flag}/application/{applicationFlag}")
+	@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
+	@Consumes(MediaType.APPLICATION_JSON)
+	public void getWithApplication(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
+			@JaxrsParameterDescribe("表单标识") @PathParam("flag") String flag,
+			@JaxrsParameterDescribe("应用标识") @PathParam("applicationFlag") String applicationFlag) {
+		ActionResult<ActionGetWithApplication.Wo> result = new ActionResult<>();
+		EffectivePerson effectivePerson = this.effectivePerson(request);
+		try {
+			result = new ActionGetWithApplication().execute(effectivePerson, applicationFlag, flag);
+		} catch (Exception e) {
+			logger.error(e, effectivePerson, request, null);
+			result.error(e);
+		}
+		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
+	}
 
 
-//	@JaxrsMethodDescribe(value = "根据标识和应用标识获取移动端表单.", action = ActionGetWithApplicationMobile.class)
-//	@GET
-//	@Path("{flag}/application/{applicationFlag}/mobile")
-//	@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
-//	@Consumes(MediaType.APPLICATION_JSON)
-//	public void getWithApplicationMobile(@Suspended final AsyncResponse asyncResponse,
-//			@Context HttpServletRequest request, @JaxrsParameterDescribe("表单标识") @PathParam("flag") String flag,
-//			@JaxrsParameterDescribe("应用标识") @PathParam("applicationFlag") String applicationFlag) {
-//		ActionResult<ActionGetWithApplicationMobile.Wo> result = new ActionResult<>();
-//		EffectivePerson effectivePerson = this.effectivePerson(request);
-//		try {
-//			result = new ActionGetWithApplicationMobile().execute(effectivePerson, applicationFlag, flag);
-//		} catch (Exception e) {
-//			logger.error(e, effectivePerson, request, null);
-//			result.error(e);
-//		}
-//		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
-//	}
+	@JaxrsMethodDescribe(value = "根据标识和应用标识获取移动端表单.", action = ActionGetWithApplicationMobile.class)
+	@GET
+	@Path("{flag}/application/{applicationFlag}/mobile")
+	@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
+	@Consumes(MediaType.APPLICATION_JSON)
+	public void getWithApplicationMobile(@Suspended final AsyncResponse asyncResponse,
+			@Context HttpServletRequest request, @JaxrsParameterDescribe("表单标识") @PathParam("flag") String flag,
+			@JaxrsParameterDescribe("应用标识") @PathParam("applicationFlag") String applicationFlag) {
+		ActionResult<ActionGetWithApplicationMobile.Wo> result = new ActionResult<>();
+		EffectivePerson effectivePerson = this.effectivePerson(request);
+		try {
+			result = new ActionGetWithApplicationMobile().execute(effectivePerson, applicationFlag, flag);
+		} catch (Exception e) {
+			logger.error(e, effectivePerson, request, null);
+			result.error(e);
+		}
+		asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
+	}
 
 
 	@JaxrsMethodDescribe(value = "查询表单,如果有表单那么返回表单id,如果表单不存在且是已完成工作,那么返回storeForm.", action = V2LookupWorkOrWorkCompleted.class)
 	@JaxrsMethodDescribe(value = "查询表单,如果有表单那么返回表单id,如果表单不存在且是已完成工作,那么返回storeForm.", action = V2LookupWorkOrWorkCompleted.class)
 	@GET
 	@GET