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

Z
zhourui 已提交
46 47
		static WrapCopier<Snap, Wo> copier = WrapCopierFactory.wo(Snap.class, Wo.class,
				JpaObject.singularAttributeField(Snap.class, true, true), null);
Z
snap  
zhourui 已提交
48 49 50 51

	}

}