提交 791c250c 编写于 作者: O o2null

Merge branch 'fix/getform' into 'wrdp'

Fix/getform

See merge request o2oa/o2oa!1984
//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;
}
}
}
//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;
}
}
}
//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;
}
}
}
//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;
}
}
}
......@@ -66,79 +66,79 @@ public class FormAction extends StandardJaxrsAction {
// 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)
@GET
......
......@@ -15,22 +15,20 @@ import javax.persistence.OrderColumn;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import org.apache.openjpa.persistence.PersistentCollection;
import org.apache.openjpa.persistence.jdbc.ContainerTable;
import org.apache.openjpa.persistence.jdbc.ElementColumn;
import org.apache.openjpa.persistence.jdbc.ElementIndex;
import org.apache.openjpa.persistence.jdbc.Index;
import com.x.base.core.entity.JpaObject;
import com.x.base.core.entity.annotation.CheckPersist;
import com.x.base.core.entity.annotation.ContainerEntity;
import com.x.base.core.entity.annotation.Flag;
import com.x.base.core.entity.annotation.IdReference;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.tools.ListTools;
import com.x.processplatform.core.entity.PersistenceProperties;
import org.apache.commons.lang3.StringUtils;
import org.apache.openjpa.persistence.PersistentCollection;
import org.apache.openjpa.persistence.jdbc.ContainerTable;
import org.apache.openjpa.persistence.jdbc.ElementColumn;
import org.apache.openjpa.persistence.jdbc.ElementIndex;
import org.apache.openjpa.persistence.jdbc.Index;
@Entity
@ContainerEntity(dumpSize = 5, type = ContainerEntity.Type.element, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.Element.End.table, uniqueConstraints = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册