提交 542d54d1 编写于 作者: O o2null

Merge branch 'feature/java11' into 'develop'

snap

See merge request o2oa/o2oa!1631
......@@ -82,6 +82,8 @@ public abstract class JpaObject extends GsonPropertyObject implements Serializab
public static final String scratchInteger_FIELDNAME = "scratchInteger";
public static final String properties_FIELDNAME = "properties";
public static final String JsonPropertiesValueHandler = "com.x.base.core.entity.annotation.JsonPropertiesValueHandler";
public static final List<String> FieldsUnmodify = ListUtils.unmodifiableList(Arrays.asList(id_FIELDNAME,
......@@ -96,6 +98,10 @@ public abstract class JpaObject extends GsonPropertyObject implements Serializab
Arrays.asList(distributeFactor_FIELDNAME, sequence_FIELDNAME, password_FIELDNAME, scratchString_FIELDNAME,
scratchBoolean_FIELDNAME, scratchDate_FIELDNAME, scratchInteger_FIELDNAME));
public static final List<String> FieldsInvisibleIncludeProperites = ListUtils.unmodifiableList(
Arrays.asList(distributeFactor_FIELDNAME, sequence_FIELDNAME, password_FIELDNAME, scratchString_FIELDNAME,
scratchBoolean_FIELDNAME, scratchDate_FIELDNAME, scratchInteger_FIELDNAME, properties_FIELDNAME));
public static final List<String> FieldsDefault = ListUtils
.unmodifiableList(Arrays.asList(id_FIELDNAME, key_FIELDNAME, createTime_FIELDNAME, updateTime_FIELDNAME,
sequence_FIELDNAME, distributeFactor_FIELDNAME, password_FIELDNAME, scratchString_FIELDNAME,
......
......@@ -6,17 +6,18 @@ import com.x.base.core.project.annotation.ModuleCategory;
import com.x.base.core.project.annotation.ModuleType;
@Module(type = ModuleType.ASSEMBLE, category = ModuleCategory.OFFICIAL, name = "流程设计", packageName = "com.x.processplatform.assemble.designer", containerEntities = {
"com.x.processplatform.core.entity.content.DocumentVersion", "com.x.processplatform.core.entity.content.Draft",
"com.x.processplatform.core.entity.content.Attachment", "com.x.processplatform.core.entity.content.Read",
"com.x.processplatform.core.entity.content.ReadCompleted", "com.x.processplatform.core.entity.content.Review",
"com.x.processplatform.core.entity.content.Record", "com.x.processplatform.core.entity.content.SerialNumber",
"com.x.processplatform.core.entity.content.Task", "com.x.processplatform.core.entity.content.TaskCompleted",
"com.x.processplatform.core.entity.content.Work", "com.x.processplatform.core.entity.content.WorkCompleted",
"com.x.processplatform.core.entity.content.WorkLog", "com.x.processplatform.core.entity.content.Record",
"com.x.processplatform.core.entity.element.Invoke", "com.x.processplatform.core.entity.element.Message",
"com.x.processplatform.core.entity.element.Split", "com.x.processplatform.core.entity.element.File",
"com.x.processplatform.core.entity.element.Form", "com.x.processplatform.core.entity.element.FormVersion",
"com.x.processplatform.core.entity.element.FormField", "com.x.processplatform.core.entity.element.TemplateForm",
"com.x.processplatform.core.entity.content.Snap", "com.x.processplatform.core.entity.content.DocumentVersion",
"com.x.processplatform.core.entity.content.Draft", "com.x.processplatform.core.entity.content.Attachment",
"com.x.processplatform.core.entity.content.Read", "com.x.processplatform.core.entity.content.ReadCompleted",
"com.x.processplatform.core.entity.content.Review", "com.x.processplatform.core.entity.content.Record",
"com.x.processplatform.core.entity.content.SerialNumber", "com.x.processplatform.core.entity.content.Task",
"com.x.processplatform.core.entity.content.TaskCompleted", "com.x.processplatform.core.entity.content.Work",
"com.x.processplatform.core.entity.content.WorkCompleted", "com.x.processplatform.core.entity.content.WorkLog",
"com.x.processplatform.core.entity.content.Record", "com.x.processplatform.core.entity.element.Invoke",
"com.x.processplatform.core.entity.element.Message", "com.x.processplatform.core.entity.element.Split",
"com.x.processplatform.core.entity.element.File", "com.x.processplatform.core.entity.element.Form",
"com.x.processplatform.core.entity.element.FormVersion", "com.x.processplatform.core.entity.element.FormField",
"com.x.processplatform.core.entity.element.TemplateForm",
"com.x.processplatform.core.entity.element.Application", "com.x.processplatform.core.entity.element.Script",
"com.x.processplatform.core.entity.element.ScriptVersion", "com.x.processplatform.core.entity.element.Merge",
"com.x.processplatform.core.entity.element.Agent", "com.x.processplatform.core.entity.element.Process",
......
......@@ -6,13 +6,14 @@ import com.x.base.core.project.annotation.ModuleCategory;
import com.x.base.core.project.annotation.ModuleType;
@Module(type = ModuleType.ASSEMBLE, category = ModuleCategory.OFFICIAL, name = "流程", packageName = "com.x.processplatform.assemble.surface", containerEntities = {
"com.x.processplatform.core.entity.content.Draft", "com.x.processplatform.core.entity.content.Attachment",
"com.x.processplatform.core.entity.content.Read", "com.x.processplatform.core.entity.content.ReadCompleted",
"com.x.processplatform.core.entity.content.Review", "com.x.processplatform.core.entity.content.Record",
"com.x.processplatform.core.entity.content.SerialNumber", "com.x.processplatform.core.entity.content.Task",
"com.x.processplatform.core.entity.content.TaskCompleted", "com.x.processplatform.core.entity.content.Work",
"com.x.processplatform.core.entity.content.WorkCompleted", "com.x.processplatform.core.entity.content.WorkLog",
"com.x.processplatform.core.entity.content.Record", "com.x.processplatform.core.entity.content.KeyLock",
"com.x.processplatform.core.entity.content.Snap", "com.x.processplatform.core.entity.content.Draft",
"com.x.processplatform.core.entity.content.Attachment", "com.x.processplatform.core.entity.content.Read",
"com.x.processplatform.core.entity.content.ReadCompleted", "com.x.processplatform.core.entity.content.Review",
"com.x.processplatform.core.entity.content.Record", "com.x.processplatform.core.entity.content.SerialNumber",
"com.x.processplatform.core.entity.content.Task", "com.x.processplatform.core.entity.content.TaskCompleted",
"com.x.processplatform.core.entity.content.Work", "com.x.processplatform.core.entity.content.WorkCompleted",
"com.x.processplatform.core.entity.content.WorkLog", "com.x.processplatform.core.entity.content.Record",
"com.x.processplatform.core.entity.content.KeyLock",
"com.x.processplatform.core.entity.content.DocumentVersion", "com.x.processplatform.core.entity.element.Agent",
"com.x.processplatform.core.entity.element.Application",
"com.x.processplatform.core.entity.element.ApplicationDict",
......
......@@ -6,7 +6,8 @@ import com.x.base.core.project.annotation.ModuleCategory;
import com.x.base.core.project.annotation.ModuleType;
@Module(type = ModuleType.SERVICE, category = ModuleCategory.OFFICIAL, name = "流程服务", packageName = "com.x.processplatform.service.processing", containerEntities = {
"com.x.processplatform.core.entity.content.Draft", "com.x.processplatform.core.entity.content.Attachment",
"com.x.processplatform.core.entity.content.Draft", "com.x.processplatform.core.entity.content.Snap",
"com.x.processplatform.core.entity.content.Attachment",
"com.x.processplatform.core.entity.content.TaskCompleted",
"com.x.processplatform.core.entity.content.ReadCompleted", "com.x.processplatform.core.entity.content.Review",
"com.x.processplatform.core.entity.content.Record", "com.x.processplatform.core.entity.content.WorkCompleted",
......
......@@ -25,6 +25,7 @@ import com.x.processplatform.assemble.surface.jaxrs.route.RouteAction;
import com.x.processplatform.assemble.surface.jaxrs.script.ScriptAction;
import com.x.processplatform.assemble.surface.jaxrs.serialnumber.SerialNumberAction;
import com.x.processplatform.assemble.surface.jaxrs.service.ServiceAction;
import com.x.processplatform.assemble.surface.jaxrs.snap.SnapAction;
import com.x.processplatform.assemble.surface.jaxrs.task.TaskAction;
import com.x.processplatform.assemble.surface.jaxrs.taskcompleted.TaskCompletedAction;
import com.x.processplatform.assemble.surface.jaxrs.work.WorkAction;
......@@ -61,6 +62,7 @@ public class ActionApplication extends AbstractActionApplication {
classes.add(RecordAction.class);
classes.add(ServiceAction.class);
classes.add(DraftAction.class);
classes.add(SnapAction.class);
return classes;
}
}
package com.x.processplatform.assemble.surface.jaxrs;
import javax.servlet.annotation.WebFilter;
import com.x.base.core.project.jaxrs.CipherManagerUserJaxrsFilter;
@WebFilter(urlPatterns = "/jaxrs/snap/*", asyncSupported = true)
public class SnapJaxrsFilter extends CipherManagerUserJaxrsFilter {
}
package com.x.processplatform.assemble.surface.jaxrs.snap;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
import com.x.base.core.project.Applications;
import com.x.base.core.project.x_processplatform_service_processing;
import com.x.base.core.project.exception.ExceptionAccessDenied;
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.WoId;
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.assemble.surface.ThisApplication;
import com.x.processplatform.core.entity.content.Snap;
class ActionDelete extends BaseAction {
private static Logger logger = LoggerFactory.getLogger(ActionDelete.class);
ActionResult<Wo> execute(EffectivePerson effectivePerson, String id) throws Exception {
String job = null;
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Business business = new Business(emc);
Snap snap = emc.find(id, Snap.class);
if (null == snap) {
throw new ExceptionEntityNotExist(id, Snap.class);
}
if (!allow(effectivePerson, business, snap)) {
throw new ExceptionAccessDenied(effectivePerson, snap);
}
job = snap.getJob();
}
ActionResult<Wo> result = new ActionResult<>();
Wo wo = ThisApplication
.context().applications().deleteQuery(effectivePerson.getDebugger(),
x_processplatform_service_processing.class, Applications.joinQueryUri("snap", id), job)
.getData(Wo.class);
result.setData(wo);
return result;
}
private boolean allow(EffectivePerson effectivePerson, Business business, Snap snap) throws Exception {
return (business.canManageApplicationOrProcess(effectivePerson, snap.getApplication(), snap.getProcess())
|| effectivePerson.isNotPerson(snap.getPerson()));
}
public static class Wo extends WoId {
private static final long serialVersionUID = -2577413577740827608L;
}
}
package com.x.processplatform.assemble.surface.jaxrs.snap;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
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.entity.JpaObject_;
import com.x.base.core.project.bean.WrapCopier;
import com.x.base.core.project.bean.WrapCopierFactory;
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.content.Snap;
class ActionListMyFilterPaging extends BaseAction {
ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, Integer page, Integer size, JsonElement jsonElement)
throws Exception {
Predicate p = null;
Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
ActionResult<List<Wo>> result = new ActionResult<>();
Business business = new Business(emc);
p = this.filter(effectivePerson, business, wi);
Integer adjustPage = this.adjustPage(page);
Integer adjustPageSize = this.adjustSize(size);
List<Snap> os = this.list(business, adjustPage, adjustPageSize, p);
List<Wo> wos = Wo.copier.copy(os);
result.setData(wos);
result.setCount(this.count(business, p));
return result;
}
}
private List<Snap> list(Business business, Integer adjustPage, Integer adjustPageSize, Predicate p)
throws Exception {
EntityManager em = business.entityManagerContainer().get(Snap.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Snap> cq = cb.createQuery(Snap.class);
Root<Snap> root = cq.from(Snap.class);
cq.select(root).where(p).orderBy(cb.desc(root.get(JpaObject_.sequence)));
return em.createQuery(cq).setFirstResult((adjustPage - 1) * adjustPageSize).setMaxResults(adjustPageSize)
.getResultList();
}
private Long count(Business business, Predicate p) throws Exception {
EntityManager em = business.entityManagerContainer().get(Snap.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Long> cq = cb.createQuery(Long.class);
Root<Snap> root = cq.from(Snap.class);
return em.createQuery(cq.select(cb.count(root)).where(p)).getSingleResult();
}
public class Wi extends FilterWi {
}
public static class Wo extends RankWo {
private static final long serialVersionUID = 2279846765261247910L;
static WrapCopier<Snap, Wo> copier = WrapCopierFactory.wo(Snap.class, Wo.class,
JpaObject.singularAttributeField(Snap.class, true, true), null);
}
}
package com.x.processplatform.assemble.surface.jaxrs.snap;
import java.util.List;
import javax.persistence.criteria.Predicate;
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.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.processplatform.assemble.surface.Business;
import com.x.processplatform.core.entity.content.Snap;
class ActionListMyPaging extends BaseAction {
ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, Integer page, Integer size) throws Exception {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Business business = new Business(emc);
Predicate p = this.myFilter(effectivePerson, business);
ActionResult<List<Wo>> result = new ActionResult<>();
result.setData(emc.fetchDescPaging(Snap.class, Wo.copier, p, page, size, JpaObject.sequence_FIELDNAME));
result.setCount(emc.count(Snap.class, p));
return result;
}
}
public static class Wo extends RankWo {
private static final long serialVersionUID = 2279846765261247910L;
static WrapCopier<Snap, Wo> copier = WrapCopierFactory.wo(Snap.class, Wo.class, null,
JpaObject.FieldsInvisibleIncludeProperites);
}
}
package com.x.processplatform.assemble.surface.jaxrs.snap;
import java.util.List;
import javax.persistence.criteria.Predicate;
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.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.processplatform.assemble.surface.Business;
import com.x.processplatform.core.entity.content.Snap;
class ActionListNext extends BaseAction {
ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, String id, Integer count) throws Exception {
Predicate p = null;
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Business business = new Business(emc);
p = myFilter(effectivePerson, business);
}
return this.standardListNext(Wo.copier, id, count, JpaObject.sequence_FIELDNAME, DESC, p);
}
public static class Wo extends RankWo {
private static final long serialVersionUID = 6502735971303449356L;
static WrapCopier<Snap, Wo> copier = WrapCopierFactory.wo(Snap.class, Wo.class, null,
JpaObject.FieldsInvisibleIncludeProperites);
}
}
package com.x.processplatform.assemble.surface.jaxrs.snap;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
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.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.processplatform.assemble.surface.Business;
import com.x.processplatform.core.entity.content.Snap;
import com.x.processplatform.core.entity.content.Snap_;
import com.x.processplatform.core.entity.element.Application;
class ActionListNextWithApplication extends BaseAction {
ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, String id, Integer count, String applicationFlag)
throws Exception {
Predicate p = null;
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Business business = new Business(emc);
Application application = business.application().pick(applicationFlag);
if (null == application) {
throw new ExceptionEntityNotExist(applicationFlag, Application.class);
}
p = myApplicationFilter(effectivePerson, business, application);
}
return this.standardListNext(Wo.copier, id, count, JpaObject.sequence_FIELDNAME, DESC, p);
}
public static class Wo extends RankWo {
private static final long serialVersionUID = 3075270584151179370L;
static WrapCopier<Snap, Wo> copier = WrapCopierFactory.wo(Snap.class, Wo.class, null,
JpaObject.FieldsInvisibleIncludeProperites);
}
}
\ No newline at end of file
package com.x.processplatform.assemble.surface.jaxrs.snap;
import java.util.List;
import javax.persistence.criteria.Predicate;
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.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.processplatform.assemble.surface.Business;
import com.x.processplatform.core.entity.content.Snap;
import com.x.processplatform.core.entity.element.Process;
class ActionListNextWithProcess extends BaseAction {
ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, String id, Integer count, String processFlag)
throws Exception {
Predicate p = null;
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Business business = new Business(emc);
Process process = business.process().pick(processFlag);
if (null == process) {
throw new ExceptionEntityNotExist(processFlag, Process.class);
}
p = this.myProcessFilter(effectivePerson, business, process);
}
return this.standardListNext(Wo.copier, id, count, JpaObject.sequence_FIELDNAME, DESC, p);
}
public static class Wo extends RankWo {
private static final long serialVersionUID = 2988668146783909521L;
static WrapCopier<Snap, Wo> copier = WrapCopierFactory.wo(Snap.class, Wo.class, null,
JpaObject.FieldsInvisibleIncludeProperites);
}
}
package com.x.processplatform.assemble.surface.jaxrs.snap;
import java.util.List;
import javax.persistence.criteria.Predicate;
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.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.processplatform.assemble.surface.Business;
import com.x.processplatform.core.entity.content.Snap;
class ActionListPrev extends BaseAction {
ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, String id, Integer count) throws Exception {
Predicate p = null;
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Business business = new Business(emc);
p = myFilter(effectivePerson, business);
}
return this.standardListPrev(Wo.copier, id, count, JpaObject.sequence_FIELDNAME, DESC, p);
}
public static class Wo extends RankWo {
private static final long serialVersionUID = 6502735971303449356L;
static WrapCopier<Snap, Wo> copier = WrapCopierFactory.wo(Snap.class, Wo.class, null,
JpaObject.FieldsInvisibleIncludeProperites);
}
}
package com.x.processplatform.assemble.surface.jaxrs.snap;
import java.util.List;
import javax.persistence.criteria.Predicate;
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.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.processplatform.assemble.surface.Business;
import com.x.processplatform.core.entity.content.Snap;
import com.x.processplatform.core.entity.element.Application;
class ActionListPrevWithApplication extends BaseAction {
ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, String id, Integer count, String applicationFlag)
throws Exception {
Predicate p = null;
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Business business = new Business(emc);
Application application = business.application().pick(applicationFlag);
if (null == application) {
throw new ExceptionEntityNotExist(applicationFlag, Application.class);
}
p = myApplicationFilter(effectivePerson, business, application);
}
return this.standardListPrev(Wo.copier, id, count, JpaObject.sequence_FIELDNAME, DESC, p);
}
public static class Wo extends RankWo {
private static final long serialVersionUID = 3075270584151179370L;
static WrapCopier<Snap, Wo> copier = WrapCopierFactory.wo(Snap.class, Wo.class, null,
JpaObject.FieldsInvisibleIncludeProperites);
}
}
package com.x.processplatform.assemble.surface.jaxrs.snap;
import java.util.List;
import javax.persistence.criteria.Predicate;
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.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.processplatform.assemble.surface.Business;
import com.x.processplatform.core.entity.content.Snap;
import com.x.processplatform.core.entity.element.Process;
class ActionListPrevWithProcess extends BaseAction {
ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, String id, Integer count, String processFlag)
throws Exception {
Predicate p = null;
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Business business = new Business(emc);
Process process = business.process().pick(processFlag);
if (null == process) {
throw new ExceptionEntityNotExist(processFlag, Process.class);
}
p = this.myProcessFilter(effectivePerson, business, process);
}
return this.standardListPrev(Wo.copier, id, count, JpaObject.sequence_FIELDNAME, DESC, p);
}
public static class Wo extends RankWo {
private static final long serialVersionUID = 2988668146783909521L;
static WrapCopier<Snap, Wo> copier = WrapCopierFactory.wo(Snap.class, Wo.class, null,
JpaObject.FieldsInvisibleIncludeProperites);
}
}
package com.x.processplatform.assemble.surface.jaxrs.snap;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import org.apache.commons.lang3.BooleanUtils;
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.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.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.processplatform.assemble.surface.Business;
import com.x.processplatform.core.entity.content.Snap;
class ActionManageListFilterPaging extends BaseAction {
ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, Integer page, Integer size, JsonElement jsonElement)
throws Exception {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Business business = new Business(emc);
ActionResult<List<Wo>> result = new ActionResult<>();
if (BooleanUtils.isNotTrue(business.canManageApplication(effectivePerson, null))) {
throw new ExceptionAccessDenied(effectivePerson);
}
Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
if (wi == null) {
wi = new Wi();
}
Integer adjustPage = this.adjustPage(page);
Integer adjustPageSize = this.adjustSize(size);
Predicate p = manageFilter(business, wi);
List<Snap> os = this.list(business, adjustPage, adjustPageSize, p);
List<Wo> wos = Wo.copier.copy(os);
result.setData(wos);
result.setCount(this.count(business, p));
return result;
}
}
private List<Snap> list(Business business, Integer adjustPage, Integer adjustPageSize, Predicate p)
throws Exception {
EntityManager em = business.entityManagerContainer().get(Snap.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Snap> cq = cb.createQuery(Snap.class);
Root<Snap> root = cq.from(Snap.class);
cq.select(root).where(p).orderBy(cb.desc(root.get(JpaObject_.sequence)));
return em.createQuery(cq).setFirstResult((adjustPage - 1) * adjustPageSize).setMaxResults(adjustPageSize)
.getResultList();
}
private Long count(Business business, Predicate p) throws Exception {
EntityManager em = business.entityManagerContainer().get(Snap.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Long> cq = cb.createQuery(Long.class);
Root<Snap> root = cq.from(Snap.class);
return em.createQuery(cq.select(cb.count(root)).where(p)).getSingleResult();
}
public class Wi extends FilterWi {
}
public static class Wo extends RankWo {
private static final long serialVersionUID = 2279846765261247910L;
static WrapCopier<Snap, Wo> copier = WrapCopierFactory.wo(Snap.class, Wo.class,
JpaObject.singularAttributeField(Snap.class, true, true), null);
}
}
package com.x.processplatform.assemble.surface.jaxrs.snap;
import java.util.List;
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.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.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.processplatform.assemble.surface.Business;
import com.x.processplatform.core.entity.content.Snap;
class ActionManageListNext extends BaseAction {
ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, String id, Integer count) throws Exception {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Business business = new Business(emc);
if (BooleanUtils.isNotTrue(business.canManageApplication(effectivePerson, null))) {
throw new ExceptionAccessDenied(effectivePerson);
}
}
return this.standardListNext(Wo.copier, id, count, JpaObject.sequence_FIELDNAME, DESC, null);
}
public static class Wo extends RankWo {
private static final long serialVersionUID = 7593097665520980060L;
static WrapCopier<Snap, Wo> copier = WrapCopierFactory.wo(Snap.class, Wo.class, null,
JpaObject.FieldsInvisible);
}
}
package com.x.processplatform.assemble.surface.jaxrs.snap;
import java.util.List;
import javax.persistence.criteria.Predicate;
import org.apache.commons.lang3.BooleanUtils;
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.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.processplatform.assemble.surface.Business;
import com.x.processplatform.core.entity.content.Snap;
class ActionManageListNextFilter extends BaseAction {
ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, String id, Integer count, JsonElement jsonElement)
throws Exception {
Predicate p = null;
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
Business business = new Business(emc);
if (BooleanUtils.isNotTrue(business.canManageApplication(effectivePerson, null))) {
throw new ExceptionAccessDenied(effectivePerson);
}
p = manageFilter(business, wi);
}
return this.standardListNext(Wo.copier, id, count, JpaObject.sequence_FIELDNAME, DESC, p);
}
public class Wi extends FilterWi {
}
public static class Wo extends RankWo {
private static final long serialVersionUID = 2279846765261247910L;
static WrapCopier<Snap, Wo> copier = WrapCopierFactory.wo(Snap.class, Wo.class, null,
JpaObject.FieldsInvisible);
}
}
package com.x.processplatform.assemble.surface.jaxrs.snap;
import java.util.List;
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.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.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.processplatform.assemble.surface.Business;
import com.x.processplatform.core.entity.content.Snap;
class ActionManageListPrev extends BaseAction {
ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, String id, Integer count) throws Exception {
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Business business = new Business(emc);
if (BooleanUtils.isNotTrue(business.canManageApplication(effectivePerson, null))) {
throw new ExceptionAccessDenied(effectivePerson);
}
}
return this.standardListPrev(Wo.copier, id, count, JpaObject.sequence_FIELDNAME, DESC, null);
}
public static class Wo extends RankWo {
private static final long serialVersionUID = 7593097665520980060L;
static WrapCopier<Snap, Wo> copier = WrapCopierFactory.wo(Snap.class, Wo.class, null,
JpaObject.FieldsInvisible);
}
}
package com.x.processplatform.assemble.surface.jaxrs.snap;
import java.util.List;
import javax.persistence.criteria.Predicate;
import org.apache.commons.lang3.BooleanUtils;
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.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.processplatform.assemble.surface.Business;
import com.x.processplatform.core.entity.content.Snap;
class ActionManageListPrevFilter extends BaseAction {
ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, String id, Integer count, JsonElement jsonElement)
throws Exception {
Predicate p = null;
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
Business business = new Business(emc);
if (BooleanUtils.isNotTrue(business.canManageApplication(effectivePerson, null))) {
throw new ExceptionAccessDenied(effectivePerson);
}
p = manageFilter(business, wi);
}
return this.standardListPrev(Wo.copier, id, count, JpaObject.sequence_FIELDNAME, DESC, p);
}
public class Wi extends FilterWi {
}
public static class Wo extends RankWo {
private static final long serialVersionUID = 2279846765261247910L;
static WrapCopier<Snap, Wo> copier = WrapCopierFactory.wo(Snap.class, Wo.class, null,
JpaObject.FieldsInvisible);
}
}
package com.x.processplatform.assemble.surface.jaxrs.snap;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
import com.x.base.core.project.Applications;
import com.x.base.core.project.x_processplatform_service_processing;
import com.x.base.core.project.exception.ExceptionAccessDenied;
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.WoId;
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.assemble.surface.ThisApplication;
import com.x.processplatform.core.entity.content.Snap;
class ActionRestore extends BaseAction {
private static Logger logger = LoggerFactory.getLogger(ActionRestore.class);
ActionResult<Wo> execute(EffectivePerson effectivePerson, String id) throws Exception {
String job = null;
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Business business = new Business(emc);
Snap snap = emc.find(id, Snap.class);
if (null == snap) {
throw new ExceptionEntityNotExist(id, Snap.class);
}
if (!allow(effectivePerson, business, snap)) {
throw new ExceptionAccessDenied(effectivePerson, snap);
}
job = snap.getJob();
}
ActionResult<Wo> result = new ActionResult<>();
Wo wo = ThisApplication.context().applications().getQuery(effectivePerson.getDebugger(),
x_processplatform_service_processing.class, Applications.joinQueryUri("snap", id, "restore"), job)
.getData(Wo.class);
result.setData(wo);
return result;
}
private boolean allow(EffectivePerson effectivePerson, Business business, Snap snap) throws Exception {
return (business.canManageApplicationOrProcess(effectivePerson, snap.getApplication(), snap.getProcess())
|| effectivePerson.isNotPerson(snap.getPerson()));
}
public static class Wo extends WoId {
private static final long serialVersionUID = -2577413577740827608L;
}
}
package com.x.processplatform.assemble.surface.jaxrs.snap;
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.Applications;
import com.x.base.core.project.x_processplatform_service_processing;
import com.x.base.core.project.exception.ExceptionAccessDenied;
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.WoId;
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.assemble.surface.ThisApplication;
import com.x.processplatform.core.entity.content.Work;
import com.x.processplatform.core.entity.element.Activity;
class ActionTypeSnap extends BaseAction {
private static Logger logger = LoggerFactory.getLogger(ActionTypeSnap.class);
ActionResult<Wo> execute(EffectivePerson effectivePerson, String workId) throws Exception {
String job = null;
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Business business = new Business(emc);
Work work = emc.find(workId, Work.class);
if (null == work) {
throw new ExceptionEntityNotExist(workId, Work.class);
}
job = work.getJob();
if (BooleanUtils.isNotTrue(business.canManageApplicationOrProcess(effectivePerson, work.getApplication(),
work.getProcess()))) {
throw new ExceptionAccessDenied(effectivePerson, work);
}
}
Wo wo = ThisApplication.context().applications()
.getQuery(effectivePerson.getDebugger(), x_processplatform_service_processing.class,
Applications.joinQueryUri("snap", "work", workId, "type", "snap"), job)
.getData(Wo.class);
ActionResult<Wo> result = new ActionResult<>();
result.setData(wo);
return result;
}
public static class Wo extends WoId {
private static final long serialVersionUID = -2577413577740827608L;
}
}
package com.x.processplatform.assemble.surface.jaxrs.snap;
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.Applications;
import com.x.base.core.project.x_processplatform_service_processing;
import com.x.base.core.project.exception.ExceptionAccessDenied;
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.WoId;
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.assemble.surface.ThisApplication;
import com.x.processplatform.core.entity.content.Work;
import com.x.processplatform.core.entity.element.Activity;
class ActionTypeSuspend extends BaseAction {
private static Logger logger = LoggerFactory.getLogger(ActionTypeSuspend.class);
ActionResult<Wo> execute(EffectivePerson effectivePerson, String workId) throws Exception {
String job = null;
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Business business = new Business(emc);
Work work = emc.find(workId, Work.class);
if (null == work) {
throw new ExceptionEntityNotExist(workId, Work.class);
}
job = work.getJob();
Activity activity = business.getActivity(work.getActivity(), work.getActivityType());
if (BooleanUtils.isNotTrue(
business.canManageApplicationOrProcess(effectivePerson, work.getApplication(), work.getProcess()))
&& ((!business.editable(effectivePerson, work))
|| (BooleanUtils.isNotTrue(activity.getAllowSuspend())))) {
throw new ExceptionAccessDenied(effectivePerson, work);
}
}
Wo wo = ThisApplication.context().applications()
.getQuery(effectivePerson.getDebugger(), x_processplatform_service_processing.class,
Applications.joinQueryUri("snap", "work", workId, "type", "suspend"), job)
.getData(Wo.class);
ActionResult<Wo> result = new ActionResult<>();
result.setData(wo);
return result;
}
public static class Wo extends WoId {
private static final long serialVersionUID = -2577413577740827608L;
}
}
package com.x.processplatform.assemble.surface.jaxrs.snap;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import org.apache.commons.lang3.StringUtils;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.gson.GsonPropertyObject;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.jaxrs.StandardJaxrsAction;
import com.x.base.core.project.tools.ListTools;
import com.x.base.core.project.tools.StringTools;
import com.x.processplatform.assemble.surface.Business;
import com.x.processplatform.core.entity.content.Snap;
import com.x.processplatform.core.entity.content.Snap_;
import com.x.processplatform.core.entity.element.Application;
import com.x.processplatform.core.entity.element.Process;
abstract class BaseAction extends StandardJaxrsAction {
protected Predicate manageFilter(Business business, FilterWi wi) throws Exception {
EntityManager em = business.entityManagerContainer().get(Snap.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Snap> cq = cb.createQuery(Snap.class);
Root<Snap> root = cq.from(Snap.class);
Predicate p = cb.conjunction();
if (ListTools.isNotEmpty(wi.getApplicationList())) {
p = cb.and(p, root.get(Snap_.application).in(wi.getApplicationList()));
}
if (ListTools.isNotEmpty(wi.getProcessList())) {
p = cb.and(p, root.get(Snap_.process).in(business.process().listEditionProcess(wi.getProcessList())));
}
if (ListTools.isNotEmpty(wi.getPersonList())) {
p = cb.and(p, root.get(Snap_.person).in(business.organization().person().list(wi.getPersonList())));
}
if (StringUtils.isNoneBlank(wi.getKey())) {
String key = StringTools.escapeSqlLikeKey(wi.getKey());
p = cb.and(p,
cb.or(cb.like(root.get(Snap_.title), "%" + key + "%", StringTools.SQL_ESCAPE_CHAR),
cb.like(root.get(Snap_.creatorPerson), "%" + key + "%", StringTools.SQL_ESCAPE_CHAR),
cb.like(root.get(Snap_.creatorUnit), "%" + key + "%", StringTools.SQL_ESCAPE_CHAR)));
}
return p;
}
protected Predicate filter(EffectivePerson effectivePerson, Business business, FilterWi wi) throws Exception {
EntityManager em = business.entityManagerContainer().get(Snap.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Snap> cq = cb.createQuery(Snap.class);
Root<Snap> root = cq.from(Snap.class);
Predicate p = cb.equal(root.get(Snap_.person), effectivePerson.getDistinguishedName());
if (ListTools.isNotEmpty(wi.getApplicationList())) {
p = cb.and(p, root.get(Snap_.application).in(wi.getApplicationList()));
}
if (ListTools.isNotEmpty(wi.getProcessList())) {
p = cb.and(p, root.get(Snap_.process).in(business.process().listEditionProcess(wi.getProcessList())));
}
if (StringUtils.isNoneBlank(wi.getKey())) {
String key = StringTools.escapeSqlLikeKey(wi.getKey());
p = cb.and(p,
cb.or(cb.like(root.get(Snap_.title), "%" + key + "%", StringTools.SQL_ESCAPE_CHAR),
cb.like(root.get(Snap_.creatorPerson), "%" + key + "%", StringTools.SQL_ESCAPE_CHAR),
cb.like(root.get(Snap_.creatorUnit), "%" + key + "%", StringTools.SQL_ESCAPE_CHAR)));
}
return p;
}
protected Predicate myFilter(EffectivePerson effectivePerson, Business business) throws Exception {
EntityManager em = business.entityManagerContainer().get(Snap.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Snap> cq = cb.createQuery(Snap.class);
Root<Snap> root = cq.from(Snap.class);
return cb.equal(root.get(Snap_.person), effectivePerson.getDistinguishedName());
}
protected Predicate myApplicationFilter(EffectivePerson effectivePerson, Business business, Application application)
throws Exception {
EntityManager em = business.entityManagerContainer().get(Snap.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Snap> cq = cb.createQuery(Snap.class);
Root<Snap> root = cq.from(Snap.class);
Predicate p = cb.equal(root.get(Snap_.person), effectivePerson.getDistinguishedName());
p = cb.and(p, cb.equal(root.get(Snap_.application), application.getId()));
return p;
}
protected Predicate myProcessFilter(EffectivePerson effectivePerson, Business business, Process process) throws Exception {
EntityManager em = business.entityManagerContainer().get(Snap.class);
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Snap> cq = cb.createQuery(Snap.class);
Root<Snap> root = cq.from(Snap.class);
Predicate p = cb.equal(root.get(Snap_.person), effectivePerson.getDistinguishedName());
p = cb.and(p, cb.equal(root.get(Snap_.process), process.getId()));
return p;
}
protected class FilterWi {
@FieldDescribe("应用id")
private List<String> applicationList;
@FieldDescribe("流程")
private List<String> processList;
@FieldDescribe("创建人")
private List<String> personList;
@FieldDescribe("匹配关键字")
private String key;
public List<String> getApplicationList() {
return applicationList;
}
public void setApplicationList(List<String> applicationList) {
this.applicationList = applicationList;
}
public List<String> getProcessList() {
return processList;
}
public void setProcessList(List<String> processList) {
this.processList = processList;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public List<String> getPersonList() {
return personList;
}
public void setPersonList(List<String> personList) {
this.personList = personList;
}
}
protected abstract static class RankWo extends GsonPropertyObject {
private static final long serialVersionUID = 2279846765261247910L;
}
}
package com.x.processplatform.assemble.surface.jaxrs.snap;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.container.AsyncResponse;
import javax.ws.rs.container.Suspended;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import com.google.gson.JsonElement;
import com.x.base.core.project.annotation.JaxrsDescribe;
import com.x.base.core.project.annotation.JaxrsMethodDescribe;
import com.x.base.core.project.annotation.JaxrsParameterDescribe;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.http.HttpMediaType;
import com.x.base.core.project.jaxrs.ResponseFactory;
import com.x.base.core.project.jaxrs.StandardJaxrsAction;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
@Path("snap")
@JaxrsDescribe("快照")
public class SnapAction extends StandardJaxrsAction {
private static Logger logger = LoggerFactory.getLogger(SnapAction.class);
@JaxrsMethodDescribe(value = "对工作进行快照", action = ActionTypeSnap.class)
@GET
@Path("work/{workId}/type/snap")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void typeSnap(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("工作标识") @PathParam("workId") String workId) {
ActionResult<ActionTypeSnap.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionTypeSnap().execute(effectivePerson, workId);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "挂起工作", action = ActionTypeSuspend.class)
@GET
@Path("work/{workId}/type/suspend")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void typeSuspend(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("工作标识") @PathParam("workId") String workId) {
ActionResult<ActionTypeSuspend.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionTypeSuspend().execute(effectivePerson, workId);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "删除快照", action = ActionDelete.class)
@DELETE
@Path("{id}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void delete(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("标识") @PathParam("id") String id) {
ActionResult<ActionDelete.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionDelete().execute(effectivePerson, id);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "恢复快照", action = ActionRestore.class)
@GET
@Path("{id}/restore")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void restore(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("标识") @PathParam("id") String id) {
ActionResult<ActionRestore.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionRestore().execute(effectivePerson, id);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "列示当前用户的快照,分页.", action = ActionListMyPaging.class)
@GET
@Path("list/my/paging/{page}/size/{size}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listMyPaging(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("分页") @PathParam("page") Integer page,
@JaxrsParameterDescribe("数量") @PathParam("size") Integer size) {
ActionResult<List<ActionListMyPaging.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionListMyPaging().execute(effectivePerson, page, size);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "按条件对当前用户快照分页显示.", action = ActionListMyFilterPaging.class)
@POST
@Path("list/my/filter/{page}/size/{size}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listMyFilterPaging(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("分页") @PathParam("page") Integer page,
@JaxrsParameterDescribe("数量") @PathParam("size") Integer size, JsonElement jsonElement) {
ActionResult<List<ActionListMyFilterPaging.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionListMyFilterPaging().execute(effectivePerson, page, size, jsonElement);
} catch (Exception e) {
logger.error(e, effectivePerson, request, jsonElement);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "列示当前用户创建的快照对象,下一页.", action = ActionListNext.class)
@GET
@Path("list/{id}/next/{count}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listNext(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("标识") @PathParam("id") String id,
@JaxrsParameterDescribe("数量") @PathParam("count") Integer count) {
ActionResult<List<ActionListNext.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionListNext().execute(effectivePerson, id, count);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "列示当前用户创建的快照对象,上一页.", action = ActionListPrev.class)
@GET
@Path("list/{id}/prev/{count}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listPrev(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("标识") @PathParam("id") String id,
@JaxrsParameterDescribe("数量") @PathParam("count") Integer count) {
ActionResult<List<ActionListPrev.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionListPrev().execute(effectivePerson, id, count);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "列示指定应用当前用户的快照对象,下一页.", action = ActionListNextWithApplication.class)
@GET
@Path("list/{id}/next/{count}/application/{applicationFlag}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listNextWithApplication(@Suspended final AsyncResponse asyncResponse,
@Context HttpServletRequest request, @JaxrsParameterDescribe("标识") @PathParam("id") String id,
@JaxrsParameterDescribe("数量") @PathParam("count") Integer count,
@JaxrsParameterDescribe("应用标识") @PathParam("applicationFlag") String applicationFlag) {
ActionResult<List<ActionListNextWithApplication.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionListNextWithApplication().execute(effectivePerson, id, count, applicationFlag);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "列示指定应用当前用户的快照对象,上一页.", action = ActionListPrevWithApplication.class)
@GET
@Path("list/{id}/prev/{count}/application/{applicationFlag}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listPrevWithApplication(@Suspended final AsyncResponse asyncResponse,
@Context HttpServletRequest request, @JaxrsParameterDescribe("标识") @PathParam("id") String id,
@JaxrsParameterDescribe("数量") @PathParam("count") Integer count,
@JaxrsParameterDescribe("应用标识") @PathParam("applicationFlag") String applicationFlag) {
ActionResult<List<ActionListPrevWithApplication.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionListPrevWithApplication().execute(effectivePerson, id, count, applicationFlag);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "列示指定流程当前用户的快照对象,下一页.", action = ActionListNextWithProcess.class)
@GET
@Path("list/{id}/next/{count}/process/{processFlag}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listNextWithProcess(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("标识") @PathParam("id") String id,
@JaxrsParameterDescribe("数量") @PathParam("count") Integer count,
@JaxrsParameterDescribe("流程标识") @PathParam("processFlag") String processFlag) {
ActionResult<List<ActionListNextWithProcess.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionListNextWithProcess().execute(effectivePerson, id, count, processFlag);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "列示指定流程当前用户的快照对象,上一页.", action = ActionListPrevWithProcess.class)
@GET
@Path("list/{id}/prev/{count}/process/{processFlag}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void listPrevWithProcess(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("标识") @PathParam("id") String id,
@JaxrsParameterDescribe("数量") @PathParam("count") Integer count,
@JaxrsParameterDescribe("流程标识") @PathParam("processFlag") String processFlag) {
ActionResult<List<ActionListPrevWithProcess.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionListPrevWithProcess().execute(effectivePerson, id, count, processFlag);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "列示所有创建的快照对象,下一页.", action = ActionManageListNext.class)
@GET
@Path("list/{id}/next/{count}/manage")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void manageListNext(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("标识") @PathParam("id") String id,
@JaxrsParameterDescribe("数量") @PathParam("count") Integer count) {
ActionResult<List<ActionManageListNext.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionManageListNext().execute(effectivePerson, id, count);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "列示所有创建的快照对象,上一页.", action = ActionManageListPrev.class)
@GET
@Path("list/{id}/prev/{count}/manage")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void manageListPrev(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("标识") @PathParam("id") String id,
@JaxrsParameterDescribe("数量") @PathParam("count") Integer count) {
ActionResult<List<ActionManageListPrev.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionManageListPrev().execute(effectivePerson, id, count);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "获取指定条件的快照,下一页.", action = ActionManageListNextFilter.class)
@POST
@Path("list/{id}/next/{count}/filter/manage")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void manageListNextWithFilter(@Suspended final AsyncResponse asyncResponse,
@Context HttpServletRequest request, @JaxrsParameterDescribe("标识") @PathParam("id") String id,
@JaxrsParameterDescribe("数量") @PathParam("count") Integer count, JsonElement jsonElement) {
ActionResult<List<ActionManageListNextFilter.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionManageListNextFilter().execute(effectivePerson, id, count, jsonElement);
} catch (Exception e) {
logger.error(e, effectivePerson, request, jsonElement);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "获取指定条件的快照,上一页.", action = ActionManageListPrevFilter.class)
@POST
@Path("list/{id}/prev/{count}/filter/manage")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void manageListPrevWithFilter(@Suspended final AsyncResponse asyncResponse,
@Context HttpServletRequest request, @JaxrsParameterDescribe("标识") @PathParam("id") String id,
@JaxrsParameterDescribe("数量") @PathParam("count") Integer count, JsonElement jsonElement) {
ActionResult<List<ActionManageListPrevFilter.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionManageListPrevFilter().execute(effectivePerson, id, count, jsonElement);
} catch (Exception e) {
logger.error(e, effectivePerson, request, jsonElement);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "按条件对快照分页显示.", action = ActionManageListFilterPaging.class)
@POST
@Path("list/filter/{page}/size/{size}/manage")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void manageListFilterPaging(@Suspended final AsyncResponse asyncResponse,
@Context HttpServletRequest request, @JaxrsParameterDescribe("分页") @PathParam("page") Integer page,
@JaxrsParameterDescribe("数量") @PathParam("size") Integer size, JsonElement jsonElement) {
ActionResult<List<ActionManageListFilterPaging.Wo>> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionManageListFilterPaging().execute(effectivePerson, page, size, jsonElement);
} catch (Exception e) {
logger.error(e, effectivePerson, request, jsonElement);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
}
\ No newline at end of file
package com.x.processplatform.core.entity.content;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.PostLoad;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;
import org.apache.commons.lang3.StringUtils;
import org.apache.openjpa.persistence.Persistent;
import org.apache.openjpa.persistence.jdbc.Index;
import org.apache.openjpa.persistence.jdbc.Strategy;
import com.x.base.core.entity.JpaObject;
import com.x.base.core.entity.SliceJpaObject;
import com.x.base.core.entity.annotation.CheckPersist;
import com.x.base.core.entity.annotation.ContainerEntity;
import com.x.base.core.project.annotation.FieldDescribe;
import com.x.base.core.project.tools.StringTools;
import com.x.processplatform.core.entity.PersistenceProperties;
import com.x.processplatform.core.entity.element.ActivityType;
@Entity
@ContainerEntity(dumpSize = 2, type = ContainerEntity.Type.content, reference = ContainerEntity.Reference.strong)
@Table(name = PersistenceProperties.Content.Snap.table, uniqueConstraints = {
@UniqueConstraint(name = PersistenceProperties.Content.Snap.table + JpaObject.IndexNameMiddle
+ JpaObject.DefaultUniqueConstraintSuffix, columnNames = { JpaObject.IDCOLUMN,
JpaObject.CREATETIMECOLUMN, JpaObject.UPDATETIMECOLUMN, JpaObject.SEQUENCECOLUMN }) })
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public class Snap extends SliceJpaObject {
private static final long serialVersionUID = -1821792646042264572L;
private static final String TABLE = PersistenceProperties.Content.Snap.table;
public static final String TYPE_SNAP = "snap";
public static final String TYPE_SUSPEND = "suspend";
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
@FieldDescribe("数据库主键,自动生成.")
@Id
@Column(length = length_id, name = ColumnNamePrefix + id_FIELDNAME)
private String id = createId();
// 更新运行方法
public void onPersist() throws Exception {
if (StringTools.utf8Length(this.getProperties().getTitle()) > length_255B) {
this.title = StringTools.utf8SubString(this.getProperties().getTitle(), length_255B - 3) + "...";
}
}
@PostLoad
public void postLoad() {
if ((null != this.properties) && StringUtils.isNotEmpty(this.getProperties().getTitle())) {
this.title = this.getProperties().getTitle();
}
}
public void setTitle(String title) {
this.title = title;
this.getProperties().setTitle(title);
}
public String getTitle() {
if ((null != this.properties) && StringUtils.isNotEmpty(this.properties.getTitle())) {
return this.properties.getTitle();
} else {
return this.title;
}
}
public Snap() {
// nothing
}
public Snap(Work work) {
this.setTitle(work.getTitle());
this.setJob(work.getJob());
this.setApplication(work.getApplication());
this.setApplicationName(work.getApplicationName());
this.setApplicationAlias(work.getApplicationAlias());
this.setProcess(work.getProcess());
this.setProcessName(work.getProcessName());
this.setProcessAlias(work.getProcessAlias());
this.setCreatorIdentity(work.getCreatorIdentity());
this.setCreatorPerson(work.getCreatorPerson());
this.setCreatorUnit(work.getCreatorUnit());
this.setActivity(work.getActivity());
this.setActivityAlias(work.getActivityAlias());
this.setActivityDescription(work.getActivityDescription());
this.setActivityName(work.getActivityName());
this.setActivityToken(work.getActivityToken());
this.setActivityType(work.getActivityType());
}
public SnapProperties getProperties() {
if (null == this.properties) {
this.properties = new SnapProperties();
}
return this.properties;
}
public void setProperties(SnapProperties properties) {
this.properties = properties;
}
public static final String type_FIELDNAME = "type";
@FieldDescribe("类型.")
@Column(length = length_32B, name = ColumnNamePrefix + type_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + type_FIELDNAME)
@CheckPersist(allowEmpty = false)
private String type;
public static final String person_FIELDNAME = "person";
@FieldDescribe("快照创建人.")
@Column(length = length_255B, name = ColumnNamePrefix + creatorPerson_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + person_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String person;
public static final String title_FIELDNAME = "title";
@FieldDescribe("标题.")
@Column(length = length_255B, name = ColumnNamePrefix + title_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + title_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String title;
public static final String job_FIELDNAME = "job";
@FieldDescribe("任务.")
@Column(length = JpaObject.length_id, name = ColumnNamePrefix + job_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + job_FIELDNAME)
@CheckPersist(allowEmpty = false)
private String job;
public static final String application_FIELDNAME = "application";
@FieldDescribe("应用.")
@Column(length = JpaObject.length_id, name = ColumnNamePrefix + application_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + application_FIELDNAME)
@CheckPersist(allowEmpty = false)
private String application;
public static final String applicationName_FIELDNAME = "applicationName";
@FieldDescribe("应用名称.")
@Column(length = length_255B, name = ColumnNamePrefix + applicationName_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + applicationName_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String applicationName;
public static final String applicationAlias_FIELDNAME = "applicationAlias";
@FieldDescribe("应用别名.")
@Column(length = length_255B, name = ColumnNamePrefix + applicationAlias_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + applicationAlias_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String applicationAlias;
public static final String process_FIELDNAME = "process";
@FieldDescribe("流程ID.")
@Column(length = JpaObject.length_id, name = ColumnNamePrefix + process_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + process_FIELDNAME)
@CheckPersist(allowEmpty = false)
private String process;
public static final String processName_FIELDNAME = "processName";
@FieldDescribe("流程名称.")
@Column(length = length_255B, name = ColumnNamePrefix + processName_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + processName_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String processName;
public static final String processAlias_FIELDNAME = "processAlias";
@FieldDescribe("流程别名.")
@Column(length = length_255B, name = ColumnNamePrefix + processAlias_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + processAlias_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String processAlias;
public static final String creatorPerson_FIELDNAME = "creatorPerson";
@FieldDescribe("创建人,可能为空,如果由系统创建.")
@Column(length = length_255B, name = ColumnNamePrefix + creatorPerson_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + creatorPerson_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String creatorPerson;
public static final String creatorIdentity_FIELDNAME = "creatorIdentity";
@FieldDescribe("创建人Identity,可能为空,如果由系统创建.")
@Column(length = length_255B, name = ColumnNamePrefix + creatorIdentity_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + creatorIdentity_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String creatorIdentity;
public static final String creatorUnit_FIELDNAME = "creatorUnit";
@FieldDescribe("创建人组织,可能为空,如果由系统创建。")
@Column(length = length_255B, name = ColumnNamePrefix + creatorUnit_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + creatorUnit_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String creatorUnit;
public static final String activity_FIELDNAME = "activity";
@FieldDescribe("活动ID,针对已完成工作添加待阅字段为空.")
@Column(length = JpaObject.length_id, name = ColumnNamePrefix + activity_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + activity_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String activity;
public static final String activityName_FIELDNAME = "activityName";
@FieldDescribe("活动名称,针对已完成工作添加待阅字段为空.")
@Column(length = length_255B, name = ColumnNamePrefix + activityName_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + activityName_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String activityName;
public static final String activityAlias_FIELDNAME = "activityAlias";
@FieldDescribe("活动别名,针对已完成工作添加待阅字段为空.")
@Column(length = length_255B, name = ColumnNamePrefix + activityAlias_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + activityAlias_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String activityAlias;
public static final String activityDescription_FIELDNAME = "activityDescription";
@FieldDescribe("活动说明,针对已完成工作添加待阅字段为空.")
@Column(length = length_255B, name = ColumnNamePrefix + activityDescription_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + activityDescription_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String activityDescription;
public static final String activityType_FIELDNAME = "activityType";
@FieldDescribe("活动类型,针对已完成工作添加待阅字段为空.")
@Enumerated(EnumType.STRING)
@Column(length = ActivityType.length, name = ColumnNamePrefix + activityType_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + activityType_FIELDNAME)
@CheckPersist(allowEmpty = true)
private ActivityType activityType;
public static final String activityToken_FIELDNAME = "activityToken";
@FieldDescribe("活动Token,针对已完成工作添加待阅字段为空.")
@Column(length = JpaObject.length_id, name = ColumnNamePrefix + activityToken_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + activityToken_FIELDNAME)
@CheckPersist(allowEmpty = true)
private String activityToken;
public static final String properties_FIELDNAME = "properties";
@FieldDescribe("属性对象存储字段.")
@Persistent
@Strategy(JsonPropertiesValueHandler)
@Column(length = JpaObject.length_10M, name = ColumnNamePrefix + properties_FIELDNAME)
@CheckPersist(allowEmpty = true)
private SnapProperties properties;
public String getProcess() {
return process;
}
public void setProcess(String process) {
this.process = process;
}
public String getApplication() {
return application;
}
public void setApplication(String application) {
this.application = application;
}
public String getApplicationName() {
return applicationName;
}
public void setApplicationName(String applicationName) {
this.applicationName = applicationName;
}
public String getProcessName() {
return processName;
}
public void setProcessName(String processName) {
this.processName = processName;
}
public String getProcessAlias() {
return processAlias;
}
public void setProcessAlias(String processAlias) {
this.processAlias = processAlias;
}
public String getApplicationAlias() {
return applicationAlias;
}
public void setApplicationAlias(String applicationAlias) {
this.applicationAlias = applicationAlias;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getJob() {
return job;
}
public void setJob(String job) {
this.job = job;
}
public String getCreatorPerson() {
return creatorPerson;
}
public void setCreatorPerson(String creatorPerson) {
this.creatorPerson = creatorPerson;
}
public String getCreatorIdentity() {
return creatorIdentity;
}
public void setCreatorIdentity(String creatorIdentity) {
this.creatorIdentity = creatorIdentity;
}
public String getCreatorUnit() {
return creatorUnit;
}
public void setCreatorUnit(String creatorUnit) {
this.creatorUnit = creatorUnit;
}
public String getPerson() {
return person;
}
public void setPerson(String person) {
this.person = person;
}
public String getActivity() {
return activity;
}
public void setActivity(String activity) {
this.activity = activity;
}
public String getActivityName() {
return activityName;
}
public void setActivityName(String activityName) {
this.activityName = activityName;
}
public String getActivityAlias() {
return activityAlias;
}
public void setActivityAlias(String activityAlias) {
this.activityAlias = activityAlias;
}
public String getActivityDescription() {
return activityDescription;
}
public void setActivityDescription(String activityDescription) {
this.activityDescription = activityDescription;
}
public ActivityType getActivityType() {
return activityType;
}
public void setActivityType(ActivityType activityType) {
this.activityType = activityType;
}
public String getActivityToken() {
return activityToken;
}
public void setActivityToken(String activityToken) {
this.activityToken = activityToken;
}
}
\ No newline at end of file
package com.x.processplatform.core.entity.content;
import java.util.ArrayList;
import java.util.List;
import com.x.base.core.entity.JsonProperties;
import com.x.base.core.project.annotation.FieldDescribe;
public class SnapProperties extends JsonProperties {
private static final long serialVersionUID = -2320401657143206452L;
@FieldDescribe("业务数据")
private Data data = new Data();
@FieldDescribe("标题")
private String title;
@FieldDescribe("标识")
private String job;
@FieldDescribe("工作")
private List<Work> workList = new ArrayList<>();
@FieldDescribe("待办")
private List<Task> taskList = new ArrayList<>();
@FieldDescribe("已办")
private List<TaskCompleted> taskCompletedList = new ArrayList<>();
@FieldDescribe("待阅")
private List<Read> readList = new ArrayList<>();
@FieldDescribe("已阅")
private List<ReadCompleted> readCompletedList = new ArrayList<>();
@FieldDescribe("参阅")
private List<Review> reviewList = new ArrayList<>();
@FieldDescribe("附件")
private List<Attachment> attachmentList = new ArrayList<>();
@FieldDescribe("记录")
private List<Record> recordList = new ArrayList<>();
@FieldDescribe("工作日志")
private List<WorkLog> workLogList = new ArrayList<>();
public Data getData() {
return data;
}
public void setData(Data data) {
this.data = data;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getJob() {
return job;
}
public List<Work> getWorkList() {
if (null == this.workList) {
this.workList = new ArrayList<>();
}
return workList;
}
public List<Task> getTaskList() {
if (null == this.taskList) {
this.taskList = new ArrayList<>();
}
return taskList;
}
public List<TaskCompleted> getTaskCompletedList() {
if (null == this.taskCompletedList) {
this.taskCompletedList = new ArrayList<>();
}
return taskCompletedList;
}
public List<Read> getReadList() {
if (null == this.readList) {
this.readList = new ArrayList<>();
}
return readList;
}
public List<ReadCompleted> getReadCompletedList() {
if (null == this.readCompletedList) {
this.readCompletedList = new ArrayList<>();
}
return readCompletedList;
}
public List<Review> getReviewList() {
if (null == this.reviewList) {
this.reviewList = new ArrayList<>();
}
return reviewList;
}
public List<Attachment> getAttachmentList() {
if (null == this.attachmentList) {
this.attachmentList = new ArrayList<>();
}
return attachmentList;
}
public List<Record> getRecordList() {
if (null == this.recordList) {
this.recordList = new ArrayList<>();
}
return recordList;
}
public List<WorkLog> getWorkLogList() {
if (null == this.workLogList) {
this.workLogList = new ArrayList<>();
}
return workLogList;
}
public void setJob(String job) {
this.job = job;
}
public void setWorkList(List<Work> workList) {
this.workList = workList;
}
public void setTaskList(List<Task> taskList) {
this.taskList = taskList;
}
public void setTaskCompletedList(List<TaskCompleted> taskCompletedList) {
this.taskCompletedList = taskCompletedList;
}
public void setReadList(List<Read> readList) {
this.readList = readList;
}
public void setReadCompletedList(List<ReadCompleted> readCompletedList) {
this.readCompletedList = readCompletedList;
}
public void setReviewList(List<Review> reviewList) {
this.reviewList = reviewList;
}
public void setAttachmentList(List<Attachment> attachmentList) {
this.attachmentList = attachmentList;
}
public void setRecordList(List<Record> recordList) {
this.recordList = recordList;
}
public void setWorkLogList(List<WorkLog> workLogList) {
this.workLogList = workLogList;
}
}
......@@ -102,16 +102,26 @@ public abstract class Activity extends SliceJpaObject {
public abstract void setOpinionGroup(String opinionGroup);
/* 是否允许调度 */
// 是否允许调度
public abstract Boolean getAllowReroute();
public abstract void setAllowReroute(Boolean allowReroute);
/* 是否允许调度到此节点 */
// 是否允许调度到此节点
public abstract Boolean getAllowRerouteTo();
public abstract void setAllowRerouteTo(Boolean allowReroute);
// 是否允许快照
// public abstract Boolean getAllowSnap();
//
// public abstract void setAllowSnap(Boolean allowSnap);
// 是否允许挂起
public abstract Boolean getAllowSuspend();
public abstract void setAllowSuspend(Boolean allowSuspend);
public ActivityType getActivityType() throws Exception {
if (this instanceof Agent) {
return ActivityType.agent;
......@@ -182,6 +192,7 @@ public abstract class Activity extends SliceJpaObject {
public static final String afterInquireScriptText_FIELDNAME = "afterInquireScriptText";
public static final String allowReroute_FIELDNAME = "allowReroute";
public static final String allowRerouteTo_FIELDNAME = "allowRerouteTo";
public static final String allowSuspend_FIELDNAME = "allowSuspend";
public static final String displayLogScript_FIELDNAME = "displayLogScript";
public static final String displayLogScriptText_FIELDNAME = "displayLogScriptText";
public static final String resetRangeScriptText_FIELDNAME = "resetRangeScriptText";
......
......@@ -57,7 +57,7 @@ public class Agent extends Activity {
/* 以上为 JpaObject 默认字段 */
public void onPersist() throws Exception {
//nothing
// nothing
}
/* 更新运行方法 */
......@@ -333,6 +333,11 @@ public class Agent extends Activity {
@Index(name = TABLE + IndexNameMiddle + allowRerouteTo_FIELDNAME)
private Boolean allowRerouteTo;
@FieldDescribe("允许挂起")
@CheckPersist(allowEmpty = true)
@Column(name = ColumnNamePrefix + allowSuspend_FIELDNAME)
private Boolean allowSuspend;
public static final String route_FIELDNAME = "route";
@IdReference(Route.class)
@FieldDescribe("出口路由.")
......@@ -388,6 +393,14 @@ public class Agent extends Activity {
@Column(length = JpaObject.length_255B, name = ColumnNamePrefix + edition_FIELDNAME)
private String edition;
public Boolean getAllowSuspend() {
return allowSuspend;
}
public void setAllowSuspend(Boolean allowSuspend) {
this.allowSuspend = allowSuspend;
}
public String getDisplayLogScript() {
return displayLogScript;
}
......
......@@ -57,7 +57,7 @@ public class Begin extends Activity {
/* 以上为 JpaObject 默认字段 */
public void onPersist() throws Exception {
//nothing
// nothing
}
/* 更新运行方法 */
......@@ -331,6 +331,11 @@ public class Begin extends Activity {
@Index(name = TABLE + IndexNameMiddle + allowRerouteTo_FIELDNAME)
private Boolean allowRerouteTo;
@FieldDescribe("允许挂起")
@CheckPersist(allowEmpty = true)
@Column(name = ColumnNamePrefix + allowSuspend_FIELDNAME)
private Boolean allowSuspend;
@IdReference(Script.class)
@FieldDescribe("生成displayLog脚本.")
@Column(length = length_255B, name = ColumnNamePrefix + displayLogScript_FIELDNAME)
......@@ -425,6 +430,14 @@ public class Begin extends Activity {
return extension;
}
public Boolean getAllowSuspend() {
return allowSuspend;
}
public void setAllowSuspend(Boolean allowSuspend) {
this.allowSuspend = allowSuspend;
}
public void setExtension(String extension) {
this.extension = extension;
}
......
......@@ -330,6 +330,11 @@ public class Cancel extends Activity {
@Index(name = TABLE + IndexNameMiddle + allowRerouteTo_FIELDNAME)
private Boolean allowRerouteTo;
@FieldDescribe("允许挂起")
@CheckPersist(allowEmpty = true)
@Column(name = ColumnNamePrefix + allowSuspend_FIELDNAME)
private Boolean allowSuspend;
@IdReference(Script.class)
@FieldDescribe("生成displayLog脚本.")
@Column(length = length_255B, name = ColumnNamePrefix + displayLogScript_FIELDNAME)
......@@ -408,6 +413,14 @@ public class Cancel extends Activity {
return extension;
}
public Boolean getAllowSuspend() {
return allowSuspend;
}
public void setAllowSuspend(Boolean allowSuspend) {
this.allowSuspend = allowSuspend;
}
public void setExtension(String extension) {
this.extension = extension;
}
......
......@@ -332,6 +332,11 @@ public class Choice extends Activity {
@Column(name = ColumnNamePrefix + allowRerouteTo_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + allowRerouteTo_FIELDNAME)
private Boolean allowRerouteTo;
@FieldDescribe("允许挂起")
@CheckPersist(allowEmpty = true)
@Column(name = ColumnNamePrefix + allowSuspend_FIELDNAME)
private Boolean allowSuspend;
public static final String routeList_FIELDNAME = "routeList";
@IdReference(Route.class)
......@@ -411,6 +416,14 @@ public class Choice extends Activity {
this.process = process;
}
public Boolean getAllowSuspend() {
return allowSuspend;
}
public void setAllowSuspend(Boolean allowSuspend) {
this.allowSuspend = allowSuspend;
}
public String getPosition() {
return position;
}
......
......@@ -333,6 +333,11 @@ public class Delay extends Activity {
@Index(name = TABLE + IndexNameMiddle + allowRerouteTo_FIELDNAME)
private Boolean allowRerouteTo;
@FieldDescribe("允许挂起")
@CheckPersist(allowEmpty = true)
@Column(name = ColumnNamePrefix + allowSuspend_FIELDNAME)
private Boolean allowSuspend;
public static final String route_FIELDNAME = "route";
@IdReference(Route.class)
@FieldDescribe("出口路由.")
......@@ -440,6 +445,14 @@ public class Delay extends Activity {
return description;
}
public Boolean getAllowSuspend() {
return allowSuspend;
}
public void setAllowSuspend(Boolean allowSuspend) {
this.allowSuspend = allowSuspend;
}
public void setDescription(String description) {
this.description = description;
}
......
......@@ -334,6 +334,11 @@ public class Embed extends Activity {
@Column(name = ColumnNamePrefix + allowRerouteTo_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + allowRerouteTo_FIELDNAME)
private Boolean allowRerouteTo;
@FieldDescribe("允许挂起")
@CheckPersist(allowEmpty = true)
@Column(name = ColumnNamePrefix + allowSuspend_FIELDNAME)
private Boolean allowSuspend;
public static final String route_FIELDNAME = "route";
@IdReference(Route.class)
......@@ -533,6 +538,14 @@ public class Embed extends Activity {
return process;
}
public Boolean getAllowSuspend() {
return allowSuspend;
}
public void setAllowSuspend(Boolean allowSuspend) {
this.allowSuspend = allowSuspend;
}
public void setProcess(String process) {
this.process = process;
}
......
......@@ -56,7 +56,7 @@ public class End extends Activity {
/* 以上为 JpaObject 默认字段 */
public void onPersist() throws Exception {
//nothing
// nothing
}
/* 更新运行方法 */
......@@ -330,6 +330,11 @@ public class End extends Activity {
@Index(name = TABLE + IndexNameMiddle + allowRerouteTo_FIELDNAME)
private Boolean allowRerouteTo;
@FieldDescribe("允许挂起")
@CheckPersist(allowEmpty = true)
@Column(name = ColumnNamePrefix + allowSuspend_FIELDNAME)
private Boolean allowSuspend;
public static final String allowRollback_FIELDNAME = "allowRollback";
@FieldDescribe("允许回滚")
@CheckPersist(allowEmpty = true)
......@@ -414,6 +419,14 @@ public class End extends Activity {
return extension;
}
public Boolean getAllowSuspend() {
return allowSuspend;
}
public void setAllowSuspend(Boolean allowSuspend) {
this.allowSuspend = allowSuspend;
}
public void setExtension(String extension) {
this.extension = extension;
}
......
......@@ -329,6 +329,11 @@ public class Invoke extends Activity {
@Column(name = ColumnNamePrefix + allowRerouteTo_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + allowRerouteTo_FIELDNAME)
private Boolean allowRerouteTo;
@FieldDescribe("允许挂起")
@CheckPersist(allowEmpty = true)
@Column(name = ColumnNamePrefix + allowSuspend_FIELDNAME)
private Boolean allowSuspend;
public static final String route_FIELDNAME = "route";
@IdReference(Route.class)
......@@ -556,6 +561,14 @@ public class Invoke extends Activity {
return process;
}
public Boolean getAllowSuspend() {
return allowSuspend;
}
public void setAllowSuspend(Boolean allowSuspend) {
this.allowSuspend = allowSuspend;
}
public void setProcess(String process) {
this.process = process;
}
......
......@@ -351,6 +351,11 @@ public class Manual extends Activity {
@Index(name = TABLE + IndexNameMiddle + allowRerouteTo_FIELDNAME)
private Boolean allowRerouteTo;
@FieldDescribe("允许挂起")
@CheckPersist(allowEmpty = true)
@Column(name = ColumnNamePrefix + allowSuspend_FIELDNAME)
private Boolean allowSuspend;
public static final String routeList_FIELDNAME = "routeList";
@IdReference(Route.class)
@FieldDescribe("出口路由,多值.")
......@@ -931,41 +936,13 @@ public class Manual extends Activity {
this.afterInquireScriptText = afterInquireScriptText;
}
// public String getBeforeArrivedExecuteScript() {
// return beforeArrivedExecuteScript;
// }
//
// public void setBeforeArrivedExecuteScript(String
// beforeArrivedExecuteScript) {
// this.beforeArrivedExecuteScript = beforeArrivedExecuteScript;
// }
//
// public String getBeforeArrivedExecuteScriptText() {
// return beforeArrivedExecuteScriptText;
// }
//
// public void setBeforeArrivedExecuteScriptText(String
// beforeArrivedExecuteScriptText) {
// this.beforeArrivedExecuteScriptText = beforeArrivedExecuteScriptText;
// }
//
// public String getAfterArrivedExecuteScript() {
// return afterArrivedExecuteScript;
// }
//
// public void setAfterArrivedExecuteScript(String
// afterArrivedExecuteScript) {
// this.afterArrivedExecuteScript = afterArrivedExecuteScript;
// }
//
// public String getAfterArrivedExecuteScriptText() {
// return afterArrivedExecuteScriptText;
// }
//
// public void setAfterArrivedExecuteScriptText(String
// afterArrivedExecuteScriptText) {
// this.afterArrivedExecuteScriptText = afterArrivedExecuteScriptText;
// }
public Boolean getAllowSuspend() {
return allowSuspend;
}
public void setAllowSuspend(Boolean allowSuspend) {
this.allowSuspend = allowSuspend;
}
public Boolean getAllowReset() {
return allowReset;
......
......@@ -330,6 +330,11 @@ public class Merge extends Activity {
@Index(name = TABLE + IndexNameMiddle + allowRerouteTo_FIELDNAME)
private Boolean allowRerouteTo;
@FieldDescribe("允许挂起")
@CheckPersist(allowEmpty = true)
@Column(name = ColumnNamePrefix + allowSuspend_FIELDNAME)
private Boolean allowSuspend;
public static final String route_FIELDNAME = "route";
@IdReference(Route.class)
@FieldDescribe("出口路由.")
......@@ -683,4 +688,12 @@ public class Merge extends Activity {
this.edition = edition;
}
public Boolean getAllowSuspend() {
return allowSuspend;
}
public void setAllowSuspend(Boolean allowSuspend) {
this.allowSuspend = allowSuspend;
}
}
......@@ -60,11 +60,6 @@ public class Message extends Activity {
// nothing
}
/* 更新运行方法 */
/* flag标志位 */
/* Entity 默认字段结束 */
@FieldDescribe("分组")
@CheckPersist(allowEmpty = true)
@Column(length = JpaObject.length_255B, name = ColumnNamePrefix + group_FIELDNAME)
......@@ -330,6 +325,11 @@ public class Message extends Activity {
@Column(name = ColumnNamePrefix + allowRerouteTo_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + allowRerouteTo_FIELDNAME)
private Boolean allowRerouteTo;
@FieldDescribe("允许挂起")
@CheckPersist(allowEmpty = true)
@Column(name = ColumnNamePrefix + allowSuspend_FIELDNAME)
private Boolean allowSuspend;
public static final String route_FIELDNAME = "route";
@IdReference(Route.class)
......@@ -700,4 +700,12 @@ public class Message extends Activity {
this.edition = edition;
}
public Boolean getAllowSuspend() {
return allowSuspend;
}
public void setAllowSuspend(Boolean allowSuspend) {
this.allowSuspend = allowSuspend;
}
}
......@@ -63,10 +63,7 @@ public class Parallel extends Activity {
// nothing
}
/* 更新运行方法 */
/* flag标志位 */
/* Entity 默认字段结束 */
@FieldDescribe("分组")
@CheckPersist(allowEmpty = true)
......@@ -333,6 +330,11 @@ public class Parallel extends Activity {
@Column(name = ColumnNamePrefix + allowRerouteTo_FIELDNAME)
@Index(name = TABLE + IndexNameMiddle + allowRerouteTo_FIELDNAME)
private Boolean allowRerouteTo;
@FieldDescribe("允许挂起")
@CheckPersist(allowEmpty = true)
@Column(name = ColumnNamePrefix + allowSuspend_FIELDNAME)
private Boolean allowSuspend;
public static final String routeList_FIELDNAME = "routeList";
@IdReference(Route.class)
......@@ -692,4 +694,12 @@ public class Parallel extends Activity {
this.edition = edition;
}
public Boolean getAllowSuspend() {
return allowSuspend;
}
public void setAllowSuspend(Boolean allowSuspend) {
this.allowSuspend = allowSuspend;
}
}
......@@ -56,11 +56,10 @@ public class Service extends Activity {
/* 以上为 JpaObject 默认字段 */
public void onPersist() throws Exception {
//nothing
// nothing
}
/* 更新运行方法 */
/* flag标志位 */
/* Entity 默认字段结束 */
......@@ -331,6 +330,11 @@ public class Service extends Activity {
@Index(name = TABLE + IndexNameMiddle + allowRerouteTo_FIELDNAME)
private Boolean allowRerouteTo;
@FieldDescribe("允许挂起")
@CheckPersist(allowEmpty = true)
@Column(name = ColumnNamePrefix + allowSuspend_FIELDNAME)
private Boolean allowSuspend;
public static final String route_FIELDNAME = "route";
@IdReference(Route.class)
@FieldDescribe("出口路由.")
......@@ -735,4 +739,12 @@ public class Service extends Activity {
this.edition = edition;
}
public Boolean getAllowSuspend() {
return allowSuspend;
}
public void setAllowSuspend(Boolean allowSuspend) {
this.allowSuspend = allowSuspend;
}
}
\ No newline at end of file
......@@ -60,7 +60,7 @@ public class Split extends Activity {
/* 以上为 JpaObject 默认字段 */
public void onPersist() throws Exception {
//nothing
// nothing
}
/* 更新运行方法 */
......@@ -331,6 +331,11 @@ public class Split extends Activity {
@Index(name = TABLE + IndexNameMiddle + allowRerouteTo_FIELDNAME)
private Boolean allowRerouteTo;
@FieldDescribe("允许挂起")
@CheckPersist(allowEmpty = true)
@Column(name = ColumnNamePrefix + allowSuspend_FIELDNAME)
private Boolean allowSuspend;
public static final String route_FIELDNAME = "route";
@IdReference(Route.class)
@FieldDescribe("出口路由.")
......@@ -715,4 +720,13 @@ public class Split extends Activity {
public void setEdition(String edition) {
this.edition = edition;
}
public Boolean getAllowSuspend() {
return allowSuspend;
}
public void setAllowSuspend(Boolean allowSuspend) {
this.allowSuspend = allowSuspend;
}
}
......@@ -5,6 +5,7 @@ import java.util.Set;
import javax.ws.rs.ApplicationPath;
import com.x.base.core.project.jaxrs.AbstractActionApplication;
import com.x.processplatform.core.entity.content.Snap;
import com.x.processplatform.service.processing.jaxrs.applicationdict.ApplicationDictAction;
import com.x.processplatform.service.processing.jaxrs.attachment.AttachmentAction;
import com.x.processplatform.service.processing.jaxrs.data.DataAction;
......@@ -40,6 +41,7 @@ public class ActionApplication extends AbstractActionApplication {
classes.add(TestAction.class);
classes.add(RecordAction.class);
classes.add(ServiceAction.class);
classes.add(Snap.class);
return classes;
}
......
package com.x.processplatform.service.processing.jaxrs;
import javax.servlet.annotation.WebFilter;
import com.x.base.core.project.jaxrs.CipherManagerJaxrsFilter;
@WebFilter(urlPatterns = "/jaxrs/snap/*", asyncSupported = true)
public class SnapJaxrsFilter extends CipherManagerJaxrsFilter {
}
package com.x.processplatform.service.processing.jaxrs.snap;
import java.util.concurrent.Callable;
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.entity.annotation.CheckRemoveType;
import com.x.base.core.project.config.StorageMapping;
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.http.EffectivePerson;
import com.x.base.core.project.jaxrs.WoId;
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.processplatform.core.entity.content.Attachment;
import com.x.processplatform.core.entity.content.Snap;
import com.x.processplatform.core.entity.content.Work;
import com.x.processplatform.core.entity.content.WorkCompleted;
import com.x.processplatform.service.processing.ThisApplication;
class ActionDelete extends BaseAction {
private static Logger logger = LoggerFactory.getLogger(ActionDelete.class);
ActionResult<Wo> execute(EffectivePerson effectivePerson, String id) throws Exception {
String job = null;
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Snap snap = emc.fetch(id, Snap.class, ListTools.toList(Snap.job_FIELDNAME));
if (null == snap) {
throw new ExceptionEntityNotExist(id, Snap.class);
}
job = snap.getJob();
}
return ProcessPlatformExecutorFactory.get(job).submit(new CallableImpl(id)).get();
}
public class CallableImpl implements Callable<ActionResult<Wo>> {
private String id;
public CallableImpl(String id) {
this.id = id;
}
public ActionResult<Wo> call() throws Exception {
ActionResult<Wo> result = new ActionResult<>();
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Snap snap = emc.find(id, Snap.class);
if (null == snap) {
throw new ExceptionEntityNotExist(id, Snap.class);
}
// 已经没有work,workCompleted以及snap所以附件可以删除了
if ((emc.countEqual(Work.class, Work.job_FIELDNAME, snap.getJob()) == 0)
&& (emc.countEqual(WorkCompleted.class, WorkCompleted.job_FIELDNAME, snap.getJob()) == 0)
&& (emc.countEqualAndNotEqual(Snap.class, Snap.job_FIELDNAME, snap.getJob(),
JpaObject.id_FIELDNAME, snap.getId()) == 0)) {
emc.beginTransaction(Attachment.class);
emc.listEqual(Attachment.class, Attachment.job_FIELDNAME, snap.getJob()).forEach(o -> {
try {
StorageMapping mapping = ThisApplication.context().storageMappings().get(Attachment.class,
o.getStorage());
if (null != mapping) {
o.deleteContent(mapping);
}
emc.remove(o, CheckRemoveType.all);
} catch (Exception e) {
logger.error(e);
}
});
emc.commit();
}
emc.beginTransaction(Snap.class);
emc.remove(snap, CheckRemoveType.all);
emc.commit();
Wo wo = new Wo();
wo.setId(snap.getId());
result.setData(wo);
return result;
}
}
}
public static class Wo extends WoId {
private static final long serialVersionUID = -2577413577740827608L;
}
}
package com.x.processplatform.service.processing.jaxrs.snap;
import java.util.List;
import java.util.concurrent.Callable;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
import com.x.base.core.entity.annotation.CheckPersistType;
import com.x.base.core.entity.annotation.CheckRemoveType;
import com.x.base.core.project.config.StorageMapping;
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.http.EffectivePerson;
import com.x.base.core.project.jaxrs.WoId;
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.processplatform.core.entity.content.Attachment;
import com.x.processplatform.core.entity.content.Read;
import com.x.processplatform.core.entity.content.ReadCompleted;
import com.x.processplatform.core.entity.content.Record;
import com.x.processplatform.core.entity.content.Review;
import com.x.processplatform.core.entity.content.Snap;
import com.x.processplatform.core.entity.content.Task;
import com.x.processplatform.core.entity.content.TaskCompleted;
import com.x.processplatform.core.entity.content.Work;
import com.x.processplatform.core.entity.content.WorkLog;
import com.x.processplatform.service.processing.Business;
import com.x.processplatform.service.processing.ThisApplication;
import com.x.processplatform.service.processing.WorkDataHelper;
import com.x.query.core.entity.Item;
class ActionRestore extends BaseAction {
private static Logger logger = LoggerFactory.getLogger(ActionRestore.class);
ActionResult<Wo> execute(EffectivePerson effectivePerson, String id) throws Exception {
String job = null;
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Snap snap = emc.fetch(id, Snap.class, ListTools.toList(Snap.job_FIELDNAME));
if (null == snap) {
throw new ExceptionEntityNotExist(id, Snap.class);
}
job = snap.getJob();
}
return ProcessPlatformExecutorFactory.get(job).submit(new CallableImpl(id)).get();
}
public class CallableImpl implements Callable<ActionResult<Wo>> {
private String id;
public CallableImpl(String id) {
this.id = id;
}
public ActionResult<Wo> call() throws Exception {
ActionResult<Wo> result = new ActionResult<>();
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Business business = new Business(emc);
Snap snap = emc.find(id, Snap.class);
if (null == snap) {
throw new ExceptionEntityNotExist(id, Snap.class);
}
clean(business, snap.getJob());
restore(business, snap);
emc.beginTransaction(Snap.class);
emc.remove(snap, CheckRemoveType.all);
emc.commit();
Wo wo = new Wo();
wo.setId(snap.getId());
result.setData(wo);
return result;
}
}
private void attachment(Business business, Snap snap) throws Exception {
EntityManagerContainer emc = business.entityManagerContainer();
List<Attachment> attachments = emc.listEqual(Attachment.class, Attachment.job_FIELDNAME, snap.getJob());
attachments.stream().filter(o -> !snap.getProperties().getAttachmentList().contains(o)).forEach(o -> {
try {
StorageMapping mapping = ThisApplication.context().storageMappings().get(Attachment.class,
o.getStorage());
if (null != mapping) {
o.deleteContent(mapping);
}
emc.remove(o, CheckRemoveType.all);
} catch (Exception e) {
logger.error(e);
}
});
attachments.stream().filter(o -> snap.getProperties().getAttachmentList().contains(o)).forEach(o -> {
try {
emc.remove(o, CheckRemoveType.all);
} catch (Exception e) {
logger.error(e);
}
});
}
private void restore(Business business, Snap snap) throws Exception {
EntityManagerContainer emc = business.entityManagerContainer();
emc.beginTransaction(Work.class);
emc.beginTransaction(Task.class);
emc.beginTransaction(TaskCompleted.class);
emc.beginTransaction(Read.class);
emc.beginTransaction(ReadCompleted.class);
emc.beginTransaction(Review.class);
emc.beginTransaction(Record.class);
emc.beginTransaction(WorkLog.class);
emc.beginTransaction(Attachment.class);
emc.beginTransaction(Item.class);
for (Task o : snap.getProperties().getTaskList()) {
emc.persist(o, CheckPersistType.all);
}
for (TaskCompleted o : snap.getProperties().getTaskCompletedList()) {
emc.persist(o, CheckPersistType.all);
}
for (Read o : snap.getProperties().getReadList()) {
emc.persist(o, CheckPersistType.all);
}
for (ReadCompleted o : snap.getProperties().getReadCompletedList()) {
emc.persist(o, CheckPersistType.all);
}
for (Review o : snap.getProperties().getReviewList()) {
emc.persist(o, CheckPersistType.all);
}
for (Record o : snap.getProperties().getRecordList()) {
emc.persist(o, CheckPersistType.all);
}
for (WorkLog o : snap.getProperties().getWorkLogList()) {
emc.persist(o, CheckPersistType.all);
}
for (Attachment o : snap.getProperties().getAttachmentList()) {
emc.persist(o, CheckPersistType.all);
}
if (ListTools.isNotEmpty(snap.getProperties().getWorkList())) {
WorkDataHelper workDataHelper = new WorkDataHelper(emc, snap.getProperties().getWorkList().get(0));
for (Work o : snap.getProperties().getWorkList()) {
emc.persist(o, CheckPersistType.all);
}
workDataHelper.update(snap.getProperties().getData());
}
attachment(business, snap);
emc.commit();
}
}
public static class Wo extends WoId {
private static final long serialVersionUID = -2577413577740827608L;
}
}
\ No newline at end of file
package com.x.processplatform.service.processing.jaxrs.snap;
import java.util.concurrent.Callable;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
import com.x.base.core.entity.annotation.CheckPersistType;
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.http.EffectivePerson;
import com.x.base.core.project.jaxrs.WoId;
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.processplatform.core.entity.content.Snap;
import com.x.processplatform.core.entity.content.Work;
import com.x.processplatform.service.processing.Business;
class ActionTypeSnap extends BaseAction {
private static Logger logger = LoggerFactory.getLogger(ActionTypeSnap.class);
ActionResult<Wo> execute(EffectivePerson effectivePerson, String workId) throws Exception {
String job = null;
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Work work = emc.fetch(workId, Work.class, ListTools.toList(Work.job_FIELDNAME));
if (null == work) {
throw new ExceptionEntityNotExist(workId, Work.class);
}
job = work.getJob();
}
return ProcessPlatformExecutorFactory.get(job).submit(new CallableImpl(workId)).get();
}
public class CallableImpl implements Callable<ActionResult<Wo>> {
private String id;
public CallableImpl(String id) {
this.id = id;
}
public ActionResult<Wo> call() throws Exception {
ActionResult<Wo> result = new ActionResult<>();
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Business business = new Business(emc);
Work work = emc.find(id, Work.class);
if (null == work) {
throw new ExceptionEntityNotExist(id, Work.class);
}
Snap snap = new Snap(work);
snap.setProperties(snap(business, work.getId()));
snap.setType(Snap.TYPE_SNAP);
emc.beginTransaction(Snap.class);
emc.persist(snap, CheckPersistType.all);
emc.commit();
Wo wo = new Wo();
wo.setId(snap.getId());
result.setData(wo);
return result;
}
}
}
public static class Wo extends WoId {
private static final long serialVersionUID = -2577413577740827608L;
}
}
package com.x.processplatform.service.processing.jaxrs.snap;
import java.util.concurrent.Callable;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.container.factory.EntityManagerContainerFactory;
import com.x.base.core.entity.annotation.CheckPersistType;
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.http.EffectivePerson;
import com.x.base.core.project.jaxrs.WoId;
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.processplatform.core.entity.content.Snap;
import com.x.processplatform.core.entity.content.Work;
import com.x.processplatform.service.processing.Business;
class ActionTypeSuspend extends BaseAction {
private static Logger logger = LoggerFactory.getLogger(ActionTypeSuspend.class);
ActionResult<Wo> execute(EffectivePerson effectivePerson, String workId) throws Exception {
String job = null;
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Work work = emc.fetch(workId, Work.class, ListTools.toList(Work.job_FIELDNAME));
if (null == work) {
throw new ExceptionEntityNotExist(workId, Work.class);
}
job = work.getJob();
}
return ProcessPlatformExecutorFactory.get(job).submit(new CallableImpl(workId)).get();
}
public class CallableImpl implements Callable<ActionResult<Wo>> {
private String id;
public CallableImpl(String id) {
this.id = id;
}
public ActionResult<Wo> call() throws Exception {
ActionResult<Wo> result = new ActionResult<>();
try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {
Business business = new Business(emc);
Work work = emc.find(id, Work.class);
if (null == work) {
throw new ExceptionEntityNotExist(id, Work.class);
}
Snap snap = new Snap(work);
snap.setProperties(snap(business, work.getId()));
snap.setType(Snap.TYPE_SUSPEND);
emc.beginTransaction(Snap.class);
emc.persist(snap, CheckPersistType.all);
emc.commit();
clean(business, work.getJob());
Wo wo = new Wo();
wo.setId(snap.getId());
result.setData(wo);
return result;
}
}
}
public static class Wo extends WoId {
private static final long serialVersionUID = -2577413577740827608L;
}
}
package com.x.processplatform.service.processing.jaxrs.snap;
import com.x.base.core.container.EntityManagerContainer;
import com.x.base.core.entity.dataitem.DataItem;
import com.x.base.core.entity.dataitem.ItemCategory;
import com.x.base.core.project.jaxrs.StandardJaxrsAction;
import com.x.base.core.project.tools.ListTools;
import com.x.processplatform.core.entity.content.Attachment;
import com.x.processplatform.core.entity.content.Read;
import com.x.processplatform.core.entity.content.ReadCompleted;
import com.x.processplatform.core.entity.content.Record;
import com.x.processplatform.core.entity.content.Review;
import com.x.processplatform.core.entity.content.SnapProperties;
import com.x.processplatform.core.entity.content.Task;
import com.x.processplatform.core.entity.content.TaskCompleted;
import com.x.processplatform.core.entity.content.Work;
import com.x.processplatform.core.entity.content.WorkLog;
import com.x.processplatform.service.processing.Business;
import com.x.processplatform.service.processing.WorkDataHelper;
import com.x.query.core.entity.Item;
abstract class BaseAction extends StandardJaxrsAction {
protected SnapProperties snap(Business business, String job) throws Exception {
SnapProperties properties = new SnapProperties();
EntityManagerContainer emc = business.entityManagerContainer();
properties.setJob(job);
properties.setWorkList(emc.listEqual(Work.class, Work.job_FIELDNAME, job));
properties.setTaskList(emc.listEqual(Task.class, Task.job_FIELDNAME, job));
properties.setTaskCompletedList(emc.listEqual(TaskCompleted.class, TaskCompleted.job_FIELDNAME, job));
properties.setReadList(emc.listEqual(Read.class, Read.job_FIELDNAME, job));
properties.setReadCompletedList(emc.listEqual(ReadCompleted.class, ReadCompleted.job_FIELDNAME, job));
properties.setReviewList(emc.listEqual(Review.class, Review.job_FIELDNAME, job));
properties.setAttachmentList(emc.listEqual(Attachment.class, Attachment.job_FIELDNAME, job));
properties.setRecordList(emc.listEqual(Record.class, Record.job_FIELDNAME, job));
properties.setWorkLogList(emc.listEqual(WorkLog.class, WorkLog.job_FIELDNAME, job));
if (ListTools.isNotEmpty(properties.getWorkList())) {
Work work = properties.getWorkList().get(0);
properties.setTitle(work.getTitle());
WorkDataHelper workDataHelper = new WorkDataHelper(business.entityManagerContainer(), work);
properties.setData(workDataHelper.get());
}
return properties;
}
protected void clean(Business business, String job) throws Exception {
EntityManagerContainer emc = business.entityManagerContainer();
emc.beginTransaction(Work.class);
emc.beginTransaction(Task.class);
emc.beginTransaction(TaskCompleted.class);
emc.beginTransaction(Read.class);
emc.beginTransaction(ReadCompleted.class);
emc.beginTransaction(Review.class);
emc.beginTransaction(Record.class);
emc.beginTransaction(WorkLog.class);
emc.beginTransaction(Item.class);
emc.deleteEqual(Work.class, Work.job_FIELDNAME, job);
emc.deleteEqual(Task.class, Task.job_FIELDNAME, job);
emc.deleteEqual(TaskCompleted.class, TaskCompleted.job_FIELDNAME, job);
emc.deleteEqual(Read.class, Read.job_FIELDNAME, job);
emc.deleteEqual(ReadCompleted.class, ReadCompleted.job_FIELDNAME, job);
emc.deleteEqual(Review.class, Review.job_FIELDNAME, job);
emc.deleteEqual(Record.class, Record.job_FIELDNAME, job);
emc.deleteEqual(WorkLog.class, WorkLog.job_FIELDNAME, job);
emc.deleteEqualAndEqual(Item.class, DataItem.bundle_FIELDNAME, job, DataItem.itemCategory_FIELDNAME,
ItemCategory.pp);
emc.commit();
}
}
package com.x.processplatform.service.processing.jaxrs.snap;
import com.x.base.core.project.exception.PromptException;
class ExceptionActivityNotService extends PromptException {
private static final long serialVersionUID = -7038279889683420366L;
ExceptionActivityNotService(String id) {
super("工作:{}, 未处于服务活动环节.", id);
}
}
package com.x.processplatform.service.processing.jaxrs.snap;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.container.AsyncResponse;
import javax.ws.rs.container.Suspended;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import com.x.base.core.project.annotation.JaxrsDescribe;
import com.x.base.core.project.annotation.JaxrsMethodDescribe;
import com.x.base.core.project.annotation.JaxrsParameterDescribe;
import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.http.HttpMediaType;
import com.x.base.core.project.jaxrs.ResponseFactory;
import com.x.base.core.project.jaxrs.StandardJaxrsAction;
import com.x.base.core.project.logger.Logger;
import com.x.base.core.project.logger.LoggerFactory;
@Path("snap")
@JaxrsDescribe("快照")
public class SnapAction extends StandardJaxrsAction {
private static Logger logger = LoggerFactory.getLogger(SnapAction.class);
@JaxrsMethodDescribe(value = "对工作进行快照", action = ActionTypeSnap.class)
@GET
@Path("work/{workId}/type/snap")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void typeSnap(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("工作标识") @PathParam("workId") String workId) {
ActionResult<ActionTypeSnap.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionTypeSnap().execute(effectivePerson, workId);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "挂起工作", action = ActionTypeSuspend.class)
@GET
@Path("work/{workId}/type/suspend")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void typeSuspend(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("工作标识") @PathParam("workId") String workId) {
ActionResult<ActionTypeSuspend.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionTypeSuspend().execute(effectivePerson, workId);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "删除快照", action = ActionDelete.class)
@DELETE
@Path("{id}")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void delete(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("标识") @PathParam("id") String id) {
ActionResult<ActionDelete.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionDelete().execute(effectivePerson, id);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
@JaxrsMethodDescribe(value = "恢复快照", action = ActionRestore.class)
@GET
@Path("{id}/restore")
@Produces(HttpMediaType.APPLICATION_JSON_UTF_8)
@Consumes(MediaType.APPLICATION_JSON)
public void restore(@Suspended final AsyncResponse asyncResponse, @Context HttpServletRequest request,
@JaxrsParameterDescribe("标识") @PathParam("id") String id) {
ActionResult<ActionRestore.Wo> result = new ActionResult<>();
EffectivePerson effectivePerson = this.effectivePerson(request);
try {
result = new ActionRestore().execute(effectivePerson, id);
} catch (Exception e) {
logger.error(e, effectivePerson, request, null);
result.error(e);
}
asyncResponse.resume(ResponseFactory.getEntityTagActionResultResponse(request, result));
}
}
\ No newline at end of file
......@@ -37,6 +37,7 @@ import com.x.processplatform.core.entity.content.Read;
import com.x.processplatform.core.entity.content.ReadCompleted;
import com.x.processplatform.core.entity.content.Record;
import com.x.processplatform.core.entity.content.Review;
import com.x.processplatform.core.entity.content.Snap;
import com.x.processplatform.core.entity.content.Task;
import com.x.processplatform.core.entity.content.TaskCompleted;
import com.x.processplatform.core.entity.content.Work;
......@@ -103,6 +104,8 @@ public class AeiObjects extends GsonPropertyObject {
// 使用用懒加载,初始为null
private List<DocumentVersion> documentVersions = null;
// 使用用懒加载,初始为null
private List<Snap> snaps = null;
// 使用用懒加载,初始为null
private List<Record> records = null;
// 使用用懒加载,初始为null
private List<Attachment> attachments = null;
......@@ -167,6 +170,10 @@ public class AeiObjects extends GsonPropertyObject {
private List<DocumentVersion> updateDocumentVersions = new ArrayList<>();
private List<DocumentVersion> deleteDocumentVersions = new ArrayList<>();
private List<Snap> createSnaps = new ArrayList<>();
private List<Snap> updateSnaps = new ArrayList<>();
private List<Snap> deleteSnaps = new ArrayList<>();
private List<Record> createRecords = new ArrayList<>();
private List<Record> updateRecords = new ArrayList<>();
private List<Record> deleteRecords = new ArrayList<>();
......@@ -335,6 +342,14 @@ public class AeiObjects extends GsonPropertyObject {
return this.documentVersions;
}
public List<Snap> getSnaps() throws Exception {
if (null == this.snaps) {
this.snaps = this.business.entityManagerContainer().listEqual(Snap.class, Snap.job_FIELDNAME,
this.work.getJob());
}
return this.snaps;
}
public List<Record> getRecords() throws Exception {
if (null == this.records) {
this.records = this.business.entityManagerContainer().listEqual(Record.class, Record.job_FIELDNAME,
......@@ -458,6 +473,22 @@ public class AeiObjects extends GsonPropertyObject {
return deleteDocumentVersions;
}
public List<DocumentVersion> getUpdateDocumentVersions() {
return updateDocumentVersions;
}
public List<Snap> getCreateSnaps() {
return createSnaps;
}
public List<Snap> getDeleteSnaps() {
return deleteSnaps;
}
public List<Snap> getUpdateSnaps() {
return updateSnaps;
}
public List<Task> getCreateTasks() {
return createTasks;
}
......@@ -536,6 +567,7 @@ public class AeiObjects extends GsonPropertyObject {
/* review必须在task,taskCompleted,read,readCompleted之后提交,需要创建新的review */
this.commitReview();
this.commitDocumentVersion();
this.commitSnap();
this.commitRecord();
this.commitAttachment();
this.commitData();
......@@ -1191,6 +1223,37 @@ public class AeiObjects extends GsonPropertyObject {
}
}
private void commitSnap() throws Exception {
if (ListTools.isNotEmpty(this.getCreateSnaps()) || ListTools.isNotEmpty(this.getDeleteSnaps())
|| ListTools.isNotEmpty(this.getUpdateSnaps())) {
this.entityManagerContainer().beginTransaction(Snap.class);
this.getCreateSnaps().stream().forEach(o -> {
try {
this.business.entityManagerContainer().persist(o, CheckPersistType.all);
} catch (Exception e) {
logger.error(e);
}
});
this.getUpdateSnaps().stream().forEach(o -> {
try {
this.business.entityManagerContainer().check(o, CheckPersistType.all);
} catch (Exception e) {
logger.error(e);
}
});
this.getDeleteSnaps().stream().forEach(o -> {
try {
Snap obj = this.business.entityManagerContainer().find(o.getId(), Snap.class);
if (null != obj) {
this.business.entityManagerContainer().remove(obj, CheckRemoveType.all);
}
} catch (Exception e) {
logger.error(e);
}
});
}
}
private void commitRecord() throws Exception {
if (ListTools.isNotEmpty(this.getCreateRecords()) || ListTools.isNotEmpty(this.getDeleteRecords())
|| ListTools.isNotEmpty(this.getUpdateRecords())) {
......@@ -1498,10 +1561,6 @@ public class AeiObjects extends GsonPropertyObject {
return updateReviews;
}
public List<DocumentVersion> getUpdateDocumentVersions() {
return updateDocumentVersions;
}
public List<WorkLog> getCreateWorkLogs() {
return createWorkLogs;
}
......
......@@ -5,6 +5,7 @@ import java.util.List;
import java.util.Objects;
import java.util.function.Predicate;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
import com.x.base.core.container.EntityManagerContainer;
......@@ -59,22 +60,21 @@ public class CancelProcessor extends AbstractCancelProcessor {
aeiObjects.getDocumentVersions().stream().forEach(o -> aeiObjects.getDeleteDocumentVersions().add(o));
aeiObjects.getRecords().stream().forEach(o -> aeiObjects.getDeleteRecords().add(o));
aeiObjects.getWorkLogs().stream().forEach(o -> aeiObjects.getDeleteWorkLogs().add(o));
/* 附件删除单独处理,需要删除Attachment的二进制文件 */
// 附件删除单独处理,需要删除Attachment的二进制文件
aeiObjects.getAttachments().stream().forEach(o -> aeiObjects.getDeleteAttachments().add(o));
/* 如果只有一份数据,没有拆分,那么删除Data */
// 如果只有一份数据,没有拆分,那么删除Data
aeiObjects.getWorkDataHelper().remove();
aeiObjects.getWorks().stream().forEach(o -> aeiObjects.getDeleteWorks().add(o));
// cancel 可以不删除快照
}
return new ArrayList<>();
}
@Override
protected void executingCommitted(AeiObjects aeiObjects, Cancel cancel) throws Exception {
/** 删除后再次检查,如果存在多个副本,且都已经在End状态,那么试图推动一个 */
if (aeiObjects.getWorks().size() > 0) {
Predicate<Work> p = o -> {
return Objects.equals(ActivityType.end, o.getActivityType());
};
// 删除后再次检查,如果存在多个副本,且都已经在End状态,那么试图推动一个
if (!aeiObjects.getWorks().isEmpty()) {
Predicate<Work> p = o -> Objects.equals(ActivityType.end, o.getActivityType());
if (aeiObjects.getWorks().stream().allMatch(p)) {
Processing processing = new Processing(new ProcessingAttributes());
processing.processing(aeiObjects.getWorks().get(0).getId());
......
......@@ -138,6 +138,8 @@ public class EndProcessor extends AbstractEndProcessor {
aeiObjects.getData().setWork(workCompleted);
aeiObjects.getData().setAttachmentList(aeiObjects.getAttachments());
aeiObjects.getDeleteWorks().addAll(aeiObjects.getWorks());
// 删除快照
aeiObjects.getDeleteSnaps().addAll(aeiObjects.getSnaps());
}
return results;
......
package com.x.program.center.jaxrs.collect;
import com.x.program.center.schedule.CollectMarket;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;
......@@ -14,12 +13,16 @@ import com.x.base.core.project.http.ActionResult;
import com.x.base.core.project.http.EffectivePerson;
import com.x.base.core.project.jaxrs.WrapBoolean;
import com.x.program.center.ThisApplication;
import com.x.program.center.schedule.CollectMarket;
import com.x.program.center.schedule.CollectPerson;
class ActionRegist extends BaseAction {
ActionResult<Wo> execute(EffectivePerson effectivePerson, JsonElement jsonElement) throws Exception {
ActionResult<Wo> result = new ActionResult<>();
if (BooleanUtils.isNotTrue(Config.nodes().centerServers().first().getValue().getConfigApiEnable())) {
throw new ExceptionModifyConfig();
}
Wi wi = this.convertToWrapIn(jsonElement, Wi.class);
String name = wi.getName();
String password = wi.getPassword();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册