提交 9ecee8c7 编写于 作者: O o2null

Merge branch 'feature/java11' into 'develop'

Feature/java11

See merge request o2oa/o2oa!1530
......@@ -81,8 +81,8 @@
"dentyList": []
},
{
"name": "AppMarket",
"path": "AppMarket",
"name": "AppMarketV2",
"path": "AppMarketV2",
"title": "应用市场",
"iconPath": "appicon.png",
"orderNumber": 8.0,
......
......@@ -26,6 +26,7 @@ import com.x.base.core.project.config.StorageMapping;
import com.x.base.core.project.config.StorageMappings;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
import com.x.base.core.project.tools.ClassLoaderTools;
import com.x.base.core.project.tools.DateTools;
import com.x.base.core.project.tools.ListTools;
......@@ -58,32 +59,42 @@ public abstract class EraseContent {
}
protected void run() throws Exception {
logger.print("erase {} content data: start at {}.", name, DateTools.format(start));
this.classNames = ListUtils.intersection(this.classNames,
(List<String>) Config.resource(Config.RESOURCE_CONTAINERENTITYNAMES));
StorageMappings storageMappings = Config.storageMappings();
File persistence = new File(Config.dir_local_temp_classes(),
DateTools.compact(this.start) + "_eraseContent.xml");
PersistenceXmlHelper.write(persistence.getAbsolutePath(), classNames);
for (int i = 0; i < classNames.size(); i++) {
Class<? extends JpaObject> cls = (Class<? extends JpaObject>) Class.forName(classNames.get(i));
EntityManagerFactory emf = OpenJPAPersistence.createEntityManagerFactory(cls.getName(),
persistence.getName(), PersistenceXmlHelper.properties(cls.getName(), Config.slice().getEnable()));
EntityManager em = emf.createEntityManager();
if (DataItem.class.isAssignableFrom(cls)) {
Long total = this.estimateItemCount(em, cls);
logger.print("erase {} content data:{}, total {}.", name, cls.getName(), total);
this.eraseItem(cls, em, total);
} else {
Long total = this.estimateCount(em, cls);
logger.print("erase {} content data:{}, total {}.", name, cls.getName(), total);
this.erase(cls, em, storageMappings, total);
new Thread(() -> {
try {
Thread.currentThread().setContextClassLoader(ClassLoaderTools.urlClassLoader(false, true, true, true,
true, Config.dir_local_temp_classes().toPath()));
logger.print("erase {} content data: start at {}.", name, DateTools.format(start));
this.classNames = ListUtils.intersection(this.classNames,
(List<String>) Config.resource(Config.RESOURCE_CONTAINERENTITYNAMES));
StorageMappings storageMappings = Config.storageMappings();
File persistence = new File(Config.dir_local_temp_classes(),
DateTools.compact(this.start) + "_eraseContent.xml");
PersistenceXmlHelper.write(persistence.getAbsolutePath(), classNames);
for (int i = 0; i < classNames.size(); i++) {
Class<? extends JpaObject> cls = (Class<? extends JpaObject>) Thread.currentThread()
.getContextClassLoader().loadClass(classNames.get(i));
EntityManagerFactory emf = OpenJPAPersistence.createEntityManagerFactory(cls.getName(),
persistence.getName(),
PersistenceXmlHelper.properties(cls.getName(), Config.slice().getEnable()));
EntityManager em = emf.createEntityManager();
if (DataItem.class.isAssignableFrom(cls)) {
Long total = this.estimateItemCount(em, cls);
logger.print("erase {} content data:{}, total {}.", name, cls.getName(), total);
this.eraseItem(cls, em, total);
} else {
Long total = this.estimateCount(em, cls);
logger.print("erase {} content data:{}, total {}.", name, cls.getName(), total);
this.erase(cls, em, storageMappings, total);
}
}
Date end = new Date();
logger.print("erase {} content data: completed at {}, elapsed {} ms.", name, DateTools.format(end),
(end.getTime() - start.getTime()));
} catch (Exception e) {
logger.error(e);
}
}
Date end = new Date();
logger.print("erase {} content data: completed at {}, elapsed {} ms.", name, DateTools.format(end),
(end.getTime() - start.getTime()));
}, "eraseContentThread").start();
}
private <T extends JpaObject> long estimateCount(EntityManager em, Class<T> cls) {
......@@ -108,7 +119,6 @@ public abstract class EraseContent {
Long count = 0L;
List<T> list = null;
ContainerEntity containerEntity = cls.getAnnotation(ContainerEntity.class);
do {
if (ListTools.isNotEmpty(list)) {
em.getTransaction().begin();
......
package com.x.processplatform.assemble.surface.jaxrs.form;
import com.x.base.core.project.logger.Audit;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import com.google.gson.JsonElement;
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.ExceptionAccessDenied;
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.logger.Audit;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
import com.x.base.core.project.tools.ListTools;
import com.x.base.core.project.tools.PropertyTools;
import com.x.processplatform.assemble.surface.Business;
import com.x.processplatform.core.entity.content.Work;
import com.x.processplatform.core.entity.content.WorkCompleted;
import com.x.processplatform.core.entity.element.Activity;
import com.x.processplatform.core.entity.element.Form;
import com.x.processplatform.core.entity.element.Script;
class ActionGetWithWorkOrWorkCompleted extends BaseAction {
......@@ -55,8 +55,8 @@ class ActionGetWithWorkOrWorkCompleted extends BaseAction {
}
}
private WoWorkForm work(Business business, Work work) throws Exception {
WoWorkForm wo = new WoWorkForm();
private Wo work(Business business, Work work) throws Exception {
Wo wo = new Wo();
String id = work.getForm();
if (StringUtils.isEmpty(id)) {
Activity activity = business.getActivity(work);
......@@ -65,50 +65,123 @@ class ActionGetWithWorkOrWorkCompleted extends BaseAction {
if (StringUtils.isNotEmpty(id)) {
Form form = business.form().pick(id);
if (null != form) {
wo = WoWorkForm.copier.copy(form);
if (StringUtils.isEmpty(wo.getData()) && StringUtils.isNotEmpty(wo.getMobileData())) {
wo.setData(wo.getMobileData());
}
/* 清空移动端表单,减少传输量 */
wo.setMobileData("");
wo.setForm(toWoForm(form));
related(business, wo, form);
}
}
return wo;
}
private WoWorkCompletedForm workCompleted(Business business, WorkCompleted workCompleted) throws Exception {
WoWorkCompletedForm wo = new WoWorkCompletedForm();
/* 先使用当前库的表单,如果不存在使用储存的表单. */
private void related(Business business, Wo wo, Form form) throws Exception {
if (StringUtils.isNotBlank(form.getData())) {
for (String relatedFormId : form.getRelatedFormList()) {
Form relatedForm = business.form().pick(relatedFormId);
if (null != relatedForm) {
wo.getRelatedFormMap().put(relatedFormId, toWoForm(relatedForm));
}
}
} else {
for (String relatedFormId : form.getMobileRelatedFormList()) {
Form relatedForm = business.form().pick(relatedFormId);
if (null != relatedForm) {
wo.getRelatedFormMap().put(relatedFormId, toWoMobileForm(relatedForm));
}
}
}
for (String relatedScriptId : form.getRelatedScriptList()) {
Script relatedScript = business.script().pick(relatedScriptId);
if (null != relatedScript) {
wo.getRelatedScriptMap().put(relatedScriptId, toWoScript(relatedScript));
}
}
}
private Wo workCompleted(Business business, WorkCompleted workCompleted) throws Exception {
Wo wo = new Wo();
// 先使用当前库的表单,如果不存在使用储存的表单.
if (StringUtils.isNotEmpty(workCompleted.getForm())) {
Form form = business.form().pick(workCompleted.getForm());
if (null != form) {
if (StringUtils.isNotEmpty(form.getData())) {
wo.setData(form.getData());
} else if (StringUtils.isNotEmpty(form.getMobileData())) {
wo.setData(workCompleted.getFormMobileData());
wo.setForm(toWoForm(form));
related(business, wo, form);
}
} else {
if (null != workCompleted.getProperties().getForm()) {
wo.form = toWoForm(workCompleted.getProperties().getForm());
}
if (StringUtils.isNotBlank(workCompleted.getProperties().getForm().getData())) {
for (Form f : workCompleted.getProperties().getRelatedFormList()) {
wo.getRelatedFormMap().put(f.getId(), toWoForm(f));
}
} else {
for (Form f : workCompleted.getProperties().getRelatedFormList()) {
wo.getRelatedFormMap().put(f.getId(), toWoMobileForm(f));
}
}
} else if (StringUtils.isNotEmpty(workCompleted.getFormData())) {
wo.setData(workCompleted.getFormData());
} else if (StringUtils.isNotEmpty(workCompleted.getFormMobileData())) {
wo.setData(workCompleted.getFormMobileData());
for (Script s : workCompleted.getProperties().getRelatedScriptList()) {
wo.getRelatedScriptMap().put(s.getId(), toWoScript(s));
}
}
return wo;
}
public static class WoWorkForm extends Form {
private static final long serialVersionUID = 1303951663975390089L;
static WrapCopier<Form, WoWorkForm> copier = WrapCopierFactory.wo(Form.class, WoWorkForm.class, null,
ListTools.toList(JpaObject.FieldsInvisible));
private WoForm toWoForm(Form form) {
WoForm wo = new WoForm();
wo.setId(form.getId());
wo.setName(form.getName());
wo.setAlias(form.getAlias());
wo.setData(form.getDataOrMobileData());
return wo;
}
private WoForm toWoMobileForm(Form form) {
WoForm wo = new WoForm();
wo.setId(form.getId());
wo.setName(form.getName());
wo.setAlias(form.getAlias());
wo.setData(form.getMobileDataOrData());
return wo;
}
public static class WoWorkCompletedForm extends GsonPropertyObject {
private WoScript toWoScript(Script script) {
WoScript wo = new WoScript();
wo.setId(script.getId());
wo.setName(script.getName());
wo.setAlias(script.getAlias());
wo.setText(script.getText());
return wo;
}
public static class WoForm extends GsonPropertyObject {
private String id;
private String alias;
private String name;
private String data;
public String getAlias() {
return alias;
}
public void setAlias(String alias) {
this.alias = alias;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getData() {
return data;
}
......@@ -116,6 +189,80 @@ class ActionGetWithWorkOrWorkCompleted extends BaseAction {
public void setData(String data) {
this.data = data;
}
}
public static class WoScript extends GsonPropertyObject {
private String id;
private String alias;
private String name;
private String text;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public String getAlias() {
return alias;
}
public void setAlias(String alias) {
this.alias = alias;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
public static class Wo extends GsonPropertyObject {
private WoForm form;
private Map<String, WoForm> relatedFormMap = new HashMap<>();
private Map<String, WoScript> relatedScriptMap = new HashMap<>();
public WoForm getForm() {
return form;
}
public void setForm(WoForm form) {
this.form = form;
}
public Map<String, WoForm> getRelatedFormMap() {
return relatedFormMap;
}
public void setRelatedFormMap(Map<String, WoForm> relatedFormMap) {
this.relatedFormMap = relatedFormMap;
}
public Map<String, WoScript> getRelatedScriptMap() {
return relatedScriptMap;
}
public void setRelatedScriptMap(Map<String, WoScript> relatedScriptMap) {
this.relatedScriptMap = relatedScriptMap;
}
}
......
package com.x.processplatform.assemble.surface.jaxrs.form;
import com.x.base.core.project.logger.Audit;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.lang3.StringUtils;
import com.google.gson.JsonElement;
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.ExceptionAccessDenied;
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.logger.Audit;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
import com.x.base.core.project.tools.ListTools;
import com.x.base.core.project.tools.PropertyTools;
import com.x.processplatform.assemble.surface.Business;
import com.x.processplatform.assemble.surface.jaxrs.form.ActionGetWithWorkOrWorkCompleted.WoWorkCompletedForm;
import com.x.processplatform.core.entity.content.Work;
import com.x.processplatform.core.entity.content.WorkCompleted;
import com.x.processplatform.core.entity.element.Activity;
import com.x.processplatform.core.entity.element.Form;
import com.x.processplatform.core.entity.element.Script;
class ActionGetWithWorkOrWorkCompletedMobile extends BaseAction {
......@@ -56,8 +55,8 @@ class ActionGetWithWorkOrWorkCompletedMobile extends BaseAction {
}
}
private WoWorkForm work(Business business, Work work) throws Exception {
WoWorkForm wo = new WoWorkForm();
private Wo work(Business business, Work work) throws Exception {
Wo wo = new Wo();
String id = work.getForm();
if (StringUtils.isEmpty(id)) {
Activity activity = business.getActivity(work);
......@@ -66,49 +65,123 @@ class ActionGetWithWorkOrWorkCompletedMobile extends BaseAction {
if (StringUtils.isNotEmpty(id)) {
Form form = business.form().pick(id);
if (null != form) {
wo = WoWorkForm.copier.copy(form);
if (StringUtils.isNotEmpty(wo.getMobileData())) {
wo.setData(wo.getMobileData());
}
/* 清空移动端表单,减少传输量 */
wo.setMobileData("");
wo.setForm(toWoMobileForm(form));
related(business, wo, form);
}
}
return wo;
}
private WoWorkCompletedForm workCompleted(Business business, WorkCompleted workCompleted) throws Exception {
WoWorkCompletedForm wo = new WoWorkCompletedForm();
if (StringUtils.isNotEmpty(workCompleted.getFormMobileData())) {
wo.setData(workCompleted.getFormMobileData());
} else if (StringUtils.isNotEmpty(workCompleted.getFormData())) {
wo.setData(workCompleted.getFormData());
} else if (StringUtils.isNotEmpty(workCompleted.getForm())) {
private void related(Business business, Wo wo, Form form) throws Exception {
if (StringUtils.isNotBlank(form.getMobileData())) {
for (String relatedFormId : form.getMobileRelatedFormList()) {
Form relatedForm = business.form().pick(relatedFormId);
if (null != relatedForm) {
wo.getRelatedFormMap().put(relatedFormId, toWoMobileForm(relatedForm));
}
}
} else {
for (String relatedFormId : form.getRelatedFormList()) {
Form relatedForm = business.form().pick(relatedFormId);
if (null != relatedForm) {
wo.getRelatedFormMap().put(relatedFormId, toWoForm(relatedForm));
}
}
}
for (String relatedScriptId : form.getRelatedScriptList()) {
Script relatedScript = business.script().pick(relatedScriptId);
if (null != relatedScript) {
wo.getRelatedScriptMap().put(relatedScriptId, toWoScript(relatedScript));
}
}
}
private Wo workCompleted(Business business, WorkCompleted workCompleted) throws Exception {
Wo wo = new Wo();
// 先使用当前库的表单,如果不存在使用储存的表单.
if (StringUtils.isNotEmpty(workCompleted.getForm())) {
Form form = business.form().pick(workCompleted.getForm());
if (null != form) {
if (StringUtils.isNotEmpty(form.getMobileData())) {
wo.setData(form.getMobileData());
} else if (StringUtils.isNotEmpty(form.getData())) {
wo.setData(workCompleted.getFormData());
wo.setForm(toWoMobileForm(form));
related(business, wo, form);
}
} else {
if (null != workCompleted.getProperties().getForm()) {
wo.form = toWoMobileForm(workCompleted.getProperties().getForm());
}
if (StringUtils.isNotBlank(workCompleted.getProperties().getForm().getMobileData())) {
for (Form f : workCompleted.getProperties().getMobileRelatedFormList()) {
wo.getRelatedFormMap().put(f.getId(), toWoMobileForm(f));
}
} else {
for (Form f : workCompleted.getProperties().getRelatedFormList()) {
wo.getRelatedFormMap().put(f.getId(), toWoForm(f));
}
}
for (Script s : workCompleted.getProperties().getRelatedScriptList()) {
wo.getRelatedScriptMap().put(s.getId(), toWoScript(s));
}
}
return wo;
}
public static class WoWorkForm extends Form {
private static final long serialVersionUID = 1303951663975390089L;
static WrapCopier<Form, WoWorkForm> copier = WrapCopierFactory.wo(Form.class, WoWorkForm.class, null,
ListTools.toList(JpaObject.FieldsInvisible));
private WoForm toWoForm(Form form) {
WoForm wo = new WoForm();
wo.setId(form.getId());
wo.setName(form.getName());
wo.setAlias(form.getAlias());
wo.setData(form.getDataOrMobileData());
return wo;
}
private WoForm toWoMobileForm(Form form) {
WoForm wo = new WoForm();
wo.setId(form.getId());
wo.setName(form.getName());
wo.setAlias(form.getAlias());
wo.setData(form.getMobileDataOrData());
return wo;
}
public static class WoWorkCompletedForm extends GsonPropertyObject {
private WoScript toWoScript(Script script) {
WoScript wo = new WoScript();
wo.setId(script.getId());
wo.setName(script.getName());
wo.setAlias(script.getAlias());
wo.setText(script.getText());
return wo;
}
public static class WoForm extends GsonPropertyObject {
private String id;
private String alias;
private String name;
private String data;
public String getAlias() {
return alias;
}
public void setAlias(String alias) {
this.alias = alias;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getData() {
return data;
}
......@@ -116,6 +189,80 @@ class ActionGetWithWorkOrWorkCompletedMobile extends BaseAction {
public void setData(String data) {
this.data = data;
}
}
public static class WoScript extends GsonPropertyObject {
private String id;
private String alias;
private String name;
private String text;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public String getAlias() {
return alias;
}
public void setAlias(String alias) {
this.alias = alias;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}
public static class Wo extends GsonPropertyObject {
private WoForm form;
private Map<String, WoForm> relatedFormMap = new HashMap<>();
private Map<String, WoScript> relatedScriptMap = new HashMap<>();
public WoForm getForm() {
return form;
}
public void setForm(WoForm form) {
this.form = form;
}
public Map<String, WoForm> getRelatedFormMap() {
return relatedFormMap;
}
public void setRelatedFormMap(Map<String, WoForm> relatedFormMap) {
this.relatedFormMap = relatedFormMap;
}
public Map<String, WoScript> getRelatedScriptMap() {
return relatedScriptMap;
}
public void setRelatedScriptMap(Map<String, WoScript> relatedScriptMap) {
this.relatedScriptMap = relatedScriptMap;
}
}
......
package com.x.processplatform.assemble.surface.jaxrs.form;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import org.apache.commons.lang3.StringUtils;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
import com.x.base.core.project.cache.Cache.CacheCategory;
import com.x.base.core.project.cache.Cache.CacheKey;
import com.x.base.core.project.cache.CacheManager;
import com.x.base.core.project.exception.ExceptionAccessDenied;
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.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
import com.x.base.core.project.tools.PropertyTools;
import com.x.processplatform.assemble.surface.Business;
import com.x.processplatform.core.entity.content.Work;
import com.x.processplatform.core.entity.content.WorkCompleted;
import com.x.processplatform.core.entity.element.Activity;
import com.x.processplatform.core.entity.element.Form;
import com.x.processplatform.core.entity.element.Script;
import net.sf.ehcache.Element;
class V2GetWithWorkOrWorkCompleted extends BaseAction {
private static Logger logger = LoggerFactory.getLogger(V2GetWithWorkOrWorkCompleted.class);
ActionResult<Wo> execute(EffectivePerson effectivePerson, String workOrWorkCompleted) throws Exception {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
ActionResult<Wo> result = new ActionResult<>();
Business business = new Business(emc);
if (!business.readableWithWorkOrWorkCompleted(effectivePerson, workOrWorkCompleted,
new ExceptionEntityNotExist(workOrWorkCompleted))) {
throw new ExceptionAccessDenied(effectivePerson);
}
Wo wo = null;
CacheCategory cacheCategory = new CacheCategory(Form.class, Script.class);
CacheKey cacheKey = new CacheKey(this.getClass(), workOrWorkCompleted);
Optional<?> optional = CacheManager.get(cacheCategory, cacheKey);
if (optional.isPresent()) {
wo = (Wo) optional.get();
} else {
Work work = emc.find(workOrWorkCompleted, Work.class);
if (null != work) {
wo = this.work(business, work);
} else {
wo = this.workCompleted(business, emc.flag(workOrWorkCompleted, WorkCompleted.class));
}
CacheManager.put(cacheCategory, cacheKey, wo);
result.setData(wo);
}
return result;
}
}
private Wo work(Business business, Work work) throws Exception {
Wo wo = new Wo();
String id = work.getForm();
if (StringUtils.isEmpty(id)) {
Activity activity = business.getActivity(work);
id = PropertyTools.getOrElse(activity, Activity.form_FIELDNAME, String.class, "");
}
if (StringUtils.isNotEmpty(id)) {
Form form = business.form().pick(id);
if (null != form) {
wo.setForm(toWoForm(form));
related(business, wo, form);
}
}
return wo;
}
private void related(Business business, Wo wo, Form form) throws Exception {
for (String relatedFormId : form.getRelatedFormList()) {
Form relatedForm = business.form().pick(relatedFormId);
if (null != relatedForm) {
wo.getRelatedFormMap().put(relatedFormId, toWoForm(relatedForm));
}
}
for (String relatedScriptId : form.getRelatedScriptList()) {
Script relatedScript = business.script().pick(relatedScriptId);
if (null != relatedScript) {
wo.getRelatedScriptMap().put(relatedScriptId, toWoScript(relatedScript));
}
}
}
private Wo workCompleted(Business business, WorkCompleted workCompleted) throws Exception {
Wo wo = new Wo();
// 先使用当前库的表单,如果不存在使用储存的表单.
if (StringUtils.isNotEmpty(workCompleted.getForm())) {
Form form = business.form().pick(workCompleted.getForm());
if (null != form) {
wo.setForm(toWoForm(form));
related(business, wo, form);
}
} else {
if (null != workCompleted.getProperties().getForm()) {
wo.form = toWoForm(workCompleted.getProperties().getForm());
}
for (Form f : workCompleted.getProperties().getRelatedFormList()) {
wo.getRelatedFormMap().put(f.getId(), toWoForm(f));
}
for (Script s : workCompleted.getProperties().getRelatedScriptList()) {
wo.getRelatedScriptMap().put(s.getId(), toWoScript(s));
}
}
return wo;
}
private WoForm toWoForm(Form form) {
WoForm wo = new WoForm();
wo.setId(form.getId());
wo.setData(form.getDataOrMobileData());
return wo;
}
private WoScript toWoScript(Script script) {
WoScript wo = new WoScript();
wo.setId(script.getId());
wo.setText(script.getText());
return wo;
}
public static class WoForm extends GsonPropertyObject {
private String id;
private String data;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getData() {
return data;
}
public void setData(String data) {
this.data = data;
}
}
public static class WoScript extends GsonPropertyObject {
private String id;
private String text;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
}
public static class Wo extends GsonPropertyObject {
private WoForm form;
private Map<String, WoForm> relatedFormMap = new HashMap<>();
private Map<String, WoScript> relatedScriptMap = new HashMap<>();
public WoForm getForm() {
return form;
}
public void setForm(WoForm form) {
this.form = form;
}
public Map<String, WoForm> getRelatedFormMap() {
return relatedFormMap;
}
public void setRelatedFormMap(Map<String, WoForm> relatedFormMap) {
this.relatedFormMap = relatedFormMap;
}
public Map<String, WoScript> getRelatedScriptMap() {
return relatedScriptMap;
}
public void setRelatedScriptMap(Map<String, WoScript> relatedScriptMap) {
this.relatedScriptMap = relatedScriptMap;
}
}
}
\ No newline at end of file
......@@ -28,6 +28,12 @@ public class WorkCompletedProperties extends JsonProperties {
@FieldDescribe("合并工作relatedScriptList")
private List<Script> relatedScriptList = new ArrayList<>();
@FieldDescribe("合并工作mobileRelatedFormList")
private List<Form> mobileRelatedFormList = new ArrayList<>();
@FieldDescribe("合并工作relatedScriptList")
private List<Script> mobileRelatedScriptList = new ArrayList<>();
@FieldDescribe("标题")
private String title;
......@@ -87,4 +93,20 @@ public class WorkCompletedProperties extends JsonProperties {
this.relatedScriptList = relatedScriptList;
}
public List<Form> getMobileRelatedFormList() {
return mobileRelatedFormList;
}
public void setMobileRelatedFormList(List<Form> mobileRelatedFormList) {
this.mobileRelatedFormList = mobileRelatedFormList;
}
public List<Script> getMobileRelatedScriptList() {
return mobileRelatedScriptList;
}
public void setMobileRelatedScriptList(List<Script> mobileRelatedScriptList) {
this.mobileRelatedScriptList = mobileRelatedScriptList;
}
}
......@@ -16,6 +16,13 @@ import javax.persistence.OrderColumn;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
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;
import com.x.base.core.entity.AbstractPersistenceProperties;
import com.x.base.core.entity.JpaObject;
import com.x.base.core.entity.SliceJpaObject;
......@@ -31,13 +38,6 @@ import com.x.base.core.entity.annotation.RestrictFlag;
import com.x.base.core.project.annotation.FieldDescribe;
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.Form.table, uniqueConstraints = {
......@@ -229,6 +229,46 @@ public class Form extends SliceJpaObject {
@CheckPersist(allowEmpty = true)
private List<String> relatedScriptList;
public static final String mobileRelatedFormList_FIELDNAME = "mobileRelatedFormList";
@FieldDescribe("关联移动表单.")
@PersistentCollection(fetch = FetchType.EAGER)
@ContainerTable(name = TABLE + ContainerTableNameMiddle
+ mobileRelatedFormList_FIELDNAME, joinIndex = @Index(name = TABLE + IndexNameMiddle
+ mobileRelatedFormList_FIELDNAME + JoinIndexNameSuffix))
@OrderColumn(name = ORDERCOLUMNCOLUMN)
@ElementColumn(length = length_255B, name = ColumnNamePrefix + mobileRelatedFormList_FIELDNAME)
@ElementIndex(name = TABLE + IndexNameMiddle + mobileRelatedFormList_FIELDNAME + ElementIndexNameSuffix)
@CheckPersist(allowEmpty = true)
private List<String> mobileRelatedFormList;
public static final String mobileRelatedScriptList_FIELDNAME = "mobileRelatedScriptList";
@FieldDescribe("关联移动脚本.")
@PersistentCollection(fetch = FetchType.EAGER)
@ContainerTable(name = TABLE + ContainerTableNameMiddle
+ mobileRelatedScriptList_FIELDNAME, joinIndex = @Index(name = TABLE + IndexNameMiddle
+ mobileRelatedScriptList_FIELDNAME + JoinIndexNameSuffix))
@OrderColumn(name = ORDERCOLUMNCOLUMN)
@ElementColumn(length = length_255B, name = ColumnNamePrefix + mobileRelatedScriptList_FIELDNAME)
@ElementIndex(name = TABLE + IndexNameMiddle + mobileRelatedScriptList_FIELDNAME + ElementIndexNameSuffix)
@CheckPersist(allowEmpty = true)
private List<String> mobileRelatedScriptList;
public List<String> getMobileRelatedFormList() {
return mobileRelatedFormList;
}
public void setMobileRelatedFormList(List<String> mobileRelatedFormList) {
this.mobileRelatedFormList = mobileRelatedFormList;
}
public List<String> getMobileRelatedScriptList() {
return mobileRelatedScriptList;
}
public void setMobileRelatedScriptList(List<String> mobileRelatedScriptList) {
this.mobileRelatedScriptList = mobileRelatedScriptList;
}
public void setCategory(String category) {
this.category = category;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册