ActionListPrevWithProcess.java 1.8 KB
Newer Older
Z
snap  
zhourui 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14
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;
Z
zhourui 已提交
15
import com.x.base.core.project.tools.ListTools;
Z
snap  
zhourui 已提交
16
import com.x.processplatform.assemble.surface.Business;
Z
zhourui 已提交
17
import com.x.processplatform.assemble.surface.jaxrs.snap.ActionListMyFilterPaging.Wo;
Z
snap  
zhourui 已提交
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
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;

Z
zhourui 已提交
41
		static WrapCopier<Snap, Wo> copier = WrapCopierFactory.wo(Snap.class, Wo.class,
Z
zhourui 已提交
42
				JpaObject.singularAttributeField(Snap.class, true, true), ListTools.toList(Snap.properties_FIELDNAME));
Z
snap  
zhourui 已提交
43 44 45 46

	}

}